Commit 73f531fb authored by Clément OUDOT's avatar Clément OUDOT
Browse files

LEMONLDAP::NG : minor bugs in _LDAP.pm

parent c007a238
......@@ -8,10 +8,9 @@ our $VERSION = '0.1';
sub ldap {
my $self = shift;
unless ( ref( $self->{ldap} ) ) {
my $mesg = $self->{ldap}->{bind}
my $mesg = $self->{ldap}->bind
if ( $self->{ldap} = Lemonldap::NG::Portal::_LDAP->new($self) );
if ( $mesg->{code} ) {
print STDERR $mesg->error . "\n";
if ( $mesg->code != 0 ) {
return 0;
}
}
......
......@@ -4,6 +4,7 @@ use strict;
use warnings;
use Exporter 'import';
use Lemonldap::NG::Portal::SharedConf;
use Lemonldap::NG::Portal::_LDAP;
use XML::LibXML;
use Safe;
......@@ -67,6 +68,18 @@ sub new {
return $self;
}
sub ldap {
my $self = shift;
unless ( ref( $self->{ldap} ) ) {
my $mesg = $self->{ldap}->bind
if ( $self->{ldap} = Lemonldap::NG::Portal::_LDAP->new($self) );
if ( $mesg->code != 0 ) {
return 0;
}
}
return $self->{ldap};
}
sub error {
# Copied from Simple.pm
......@@ -324,12 +337,9 @@ sub _changePassword {
return PE_PASSWORD_MISMATCH unless ( $newpassword eq $confirmpassword );
# Connect to LDAP
$err = &Lemonldap::NG::Portal::Simple::connectLDAP( $self->{portalObject} );
return $err unless ( $err eq PE_OK );
# Bind with Manager
$err = &Lemonldap::NG::Portal::Simple::bind( $self->{portalObject} );
return $err unless ( $err eq PE_OK );
unless ( $self->{portalObject}->ldap ) {
return PE_LDAPCONNECTFAILED;
}
my $ldap = $self->{portalObject}->{ldap};
my $dn = $self->{portalObject}->{sessionInfo}->{"dn"};
......
......@@ -8,10 +8,9 @@ our $VERSION = '0.1';
sub ldap {
my $self = shift;
unless ( ref( $self->{ldap} ) ) {
my $mesg = $self->{ldap}->{bind}
my $mesg = $self->{ldap}->bind
if ( $self->{ldap} = Lemonldap::NG::Portal::_LDAP->new($self) );
if ( $mesg->{code} ) {
print STDERR $mesg->error . "\n";
if ( $mesg->code != 0 ) {
return 0;
}
}
......
......@@ -55,14 +55,8 @@ sub bind {
my $mesg;
my ( $dn, %args ) = @_;
$dn ||= $self->{portal}->{managerDn};
$args->{password} ||= $self->{portal}->{managerPassword};
$mesg = $self->SUPER::bind( $dn, %args );
if ( $mesg->code() != 0 ) {
print STDERR $mesg->error . "\n";
return 0;
}
return 1;
$args{password} ||= $self->{portal}->{managerPassword};
return $self->SUPER::bind( $dn, %args );
}
1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment