aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Schema/Auth.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Fripost/Schema/Auth.pm')
-rw-r--r--lib/Fripost/Schema/Auth.pm13
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;