Commit 356a588a authored by Clément OUDOT's avatar Clément OUDOT

Fix DN encoding issue in LDAP password modification (#1540)

parent 322adb91
......@@ -10,6 +10,7 @@ use Lemonldap::NG::Portal::Main::Constants ':all';
use Encode;
use Unicode::String qw(utf8);
use Scalar::Util 'weaken';
use utf8;
our $VERSION = '2.0.0';
our $ppLoaded = 0;
......@@ -89,6 +90,9 @@ sub new {
# @return Net::LDAP::Message
sub bind {
my ( $self, $dn, %args ) = @_;
$self->{portal}->logger->debug("Call bind for $dn");
my $mesg;
unless ($dn) {
$dn = $self->{conf}->{managerDn};
......@@ -259,6 +263,9 @@ sub userModifyPassword {
my $err;
my $mesg;
utf8::downgrade($dn);
$self->{portal}->logger->debug("Call modify password for $dn");
# Adjust configuration for AD
if ($ad) {
$ppolicyControl = 0;
......
......@@ -24,7 +24,15 @@ sub confirm {
sub modifyPassword {
my ( $self, $req, $pwd ) = @_;
my $dn = $req->userData->{_dn} || $req->sessionInfo->{_dn};
my $dn;
if ( $req->userData->{_dn} ) {
$dn = $req->userData->{_dn};
$self->logger->debug("Get DN from request data: $dn");
}
else {
$dn = $req->sessionInfo->{_dn};
$self->logger->debug("Get DN from session data: $dn");
}
unless ($dn) {
$self->logger->error('"dn" is not set, aborting password modification');
return PE_ERROR;
......
Markdown is supported
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