diff options
Diffstat (limited to 'lib/Fripost/Schema.pm')
-rw-r--r-- | lib/Fripost/Schema.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Fripost/Schema.pm b/lib/Fripost/Schema.pm index 236b407..63df10f 100644 --- a/lib/Fripost/Schema.pm +++ b/lib/Fripost/Schema.pm @@ -20,7 +20,7 @@ use utf8; use Net::LDAP; use Authen::SASL; -use Fripost::Schema::Misc 'split_addr'; +use Fripost::Schema::Misc qw/canonical_dn ldap_explode_dn split_addr/; use Fripost::Schema::Domain; use Fripost::Schema::User; use Fripost::Schema::Alias; @@ -48,10 +48,10 @@ sub SASLauth { my %cfg = @_; my $self = bless {}, $class; - $self->suffix( join ',', @{$cfg{ldap_suffix}} ); - $self->whoami( "fvu=$l,fvd=$d,".$self->suffix ); return $self unless defined $cfg{ldap_SASL_mechanism}; + $self->suffix( ldap_explode_dn(@{$cfg{ldap_suffix}}) ); + $self->whoami( canonical_dn( {fvu => $l}, {fvd => $d}, @{$self->suffix} )); $self->ldap( Net::LDAP::->new( $cfg{ldap_uri}, async => 0 )); my $callback; @@ -96,14 +96,14 @@ sub auth { my %cfg = @_; my $self = bless {}, $class; - $self->suffix( join ',', @{$cfg{ldap_suffix}} ); + $self->suffix( ldap_explode_dn(@{$cfg{ldap_suffix}}) ); if (not (defined $id) or defined $cfg{ldap_bind_dn}) { - $self->whoami( $cfg{ldap_bind_dn} ); + $self->whoami( join ',', @{$cfg{ldap_bind_dn}} ); } else { my ($l,$d) = split_addr($id); - $self->whoami( "fvu=$l,fvd=$d,".$self->suffix ); + $self->whoami( canonical_dn( {fvu => $l}, {fvd => $d}, @{$self->suffix} )); } $self->ldap( Net::LDAP::->new( $cfg{ldap_uri}, async => 0 ) ); |