diff options
author | Guilhem Moulin <guilhem.moulin@fripost.org> | 2013-01-29 21:44:24 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@fripost.org> | 2013-01-29 21:44:24 +0100 |
commit | 465f8ed1b317afb1c7aefde04e53118a19be1a18 (patch) | |
tree | b9f92574022267058f34326edfa25195afdc4e4b /lib/Fripost/Schema/Auth.pm | |
parent | 38bbf969d6c29891f40973a0db376d5f5ee5ab07 (diff) |
Finished the factoring of localpart-related methods.
Diffstat (limited to 'lib/Fripost/Schema/Auth.pm')
-rw-r--r-- | lib/Fripost/Schema/Auth.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Fripost/Schema/Auth.pm b/lib/Fripost/Schema/Auth.pm index d9c0267..f06ce4f 100644 --- a/lib/Fripost/Schema/Auth.pm +++ b/lib/Fripost/Schema/Auth.pm @@ -83,8 +83,8 @@ sub SASLauth { $self->suffix( ldap_explode_dn(@{$options{ldap_suffix}}) ); $self->whoami( $self->mail2dn($user) ); - $self->ldap( Net::LDAP::->new( $options{ldap_uri} // 'ldap://127.0.0.1:389/' - , async => 0 ) ); + $self->ldap( Net::LDAP::->new( $options{ldap_uri} + // 'ldap://127.0.0.1:389/' ) ); assert( $self->ldap, -die => "Couldn't connect to the LDAP server." ); my $callback; @@ -167,8 +167,8 @@ sub auth { $self->whoami( $self->mail2dn($user) ); } - $self->ldap( Net::LDAP::->new( $options{ldap_uri} // 'ldap://127.0.0.1:389/' - , async => 0 ) ); + $self->ldap( Net::LDAP::->new( $options{ldap_uri} + // 'ldap://127.0.0.1:389/' ) ); assert( $self->ldap, -die => "Couldn't connect to the LDAP server." ); my $mesg = $self->ldap->bind( $self->whoami, password => $pw ); @@ -253,7 +253,10 @@ converted to ASCII. sub mail2dn { my $self = shift; - my ($l,$d) = split_addr(shift, -encode => 'ascii') or return; + my $mail = shift // return; + + $mail =~ s/^\@//; + my ($l,$d) = split_addr($mail, -encode => 'ascii') or return; my @dn = ({fvd => $d}, @{$self->suffix}); unshift @dn, {fvl => $l} if $l; |