From: Dobrica Pavlinusic Date: Wed, 21 Oct 2009 18:17:38 +0000 (+0000) Subject: rewrite DN from login@domain.com into uid=login,dc=domain,dc=com X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=commitdiff_plain;h=704421304e70ffc488ce7bd9a58dd8ee9cd64915;hp=9321cb27258346136fb30f0e909c43d1020ed645 rewrite DN from login@domain.com into uid=login,dc=domain,dc=com --- diff --git a/lib/LDAP/Virtual.pm b/lib/LDAP/Virtual.pm index 32df546..4ee090e 100644 --- a/lib/LDAP/Virtual.pm +++ b/lib/LDAP/Virtual.pm @@ -156,6 +156,14 @@ sub bind { my $bind; $bind->{dn} = $req->{name} if $req->{name}; + + if ( $bind->{dn} =~ m{@} ) { + + $bind->{dn} =~ s/[@\.]/,dc=/g; + $bind->{dn} =~ s/^/uid=/; + + } + $bind->{password} = $req->{authentication}->{simple} if $req->{authentication}->{simple}; warn "# bind ",dump( $bind ); $msg = $self->{upstream}->bind( %$bind );