CS fixes, updated changelog

pull/5468/head
Aleksander Machniak 8 years ago
parent 7f4ab8c14a
commit affec47eab

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Password: Added LDAP PPolicy driver (#5364)
- Implement separate action to mark all messages in a folder as \Seen (#5006)
- Implement marking as \Seen in all folders or in a folder and its subfolders (#5076)
- Archive: Don't reload messages list when it's not needed (#5225)

@ -6,11 +6,9 @@
* Driver that adds functionality to change the user password via
* the 'change_ldap_pass.pl' command respecting password policy (history) in LDAP.
*
*
* @version 1.0
* @author Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
*
*/
class rcube_ldap_ppolicy_password
@ -74,7 +72,6 @@ class rcube_ldap_ppolicy_password
return PASSWORD_SUCCESS;
case "Password is in history of old passwords":
return PASSWORD_IN_HISTORY;
case "Cannot connect to any server":
return PASSWORD_CONNECT_ERROR;
default:
@ -96,5 +93,4 @@ class rcube_ldap_ppolicy_password
rcube::write_log('password_ldap_ppolicy', $str);
}
}
}

@ -29,9 +29,9 @@ my @servers = split (/\s+/, $PAR{'uri'});
my $active_server = 0;
my $ldap;
while ((my $serwer = shift @servers) && !($active_server)){
while ((my $serwer = shift @servers) && !($active_server)) {
my $ldap_uri = URI->new($serwer);
if ($ldap_uri->secure){
if ($ldap_uri->secure) {
$ldap = Net::LDAP->new($ldap_uri->as_string,
version => 3,
verify => 'require',
@ -43,34 +43,33 @@ while ((my $serwer = shift @servers) && !($active_server)){
$active_server = 1 if ($ldap);
}
if ($active_server){
my $mesg = $ldap->bind( $PAR{'binddn'}, password => $PAR{'bindpw'} );
if ($mesg->code != 0){
if ($active_server) {
my $mesg = $ldap->bind($PAR{'binddn'}, password => $PAR{'bindpw'});
if ($mesg->code != 0) {
print "Cannot login: ". $mesg->error;
} else {
# Wyszukanie usera wg filtra
$PAR{'filter'} =~ s/\%login/$PAR{'user'}/;
my @search_args = (base => $PAR{'base'},
my @search_args = (
base => $PAR{'base'},
scope => 'sub',
filter => $PAR{'filter'},
attrs => ['1.1'],
);
my $result = $ldap->search( @search_args );
if ($result->code){
my $result = $ldap->search(@search_args);
if ($result->code) {
print $result->error;
} else {
my $count = $result->count;
if ($count == 1){
if ($count == 1) {
my @users = $result->entries;
my $dn = $users[0]->dn();
$result = $ldap->bind($dn, password => $PAR{'pass'});
if ($result->code){
print $result->error;
} else {
$result = $ldap->set_password(
newpasswd => $PAR{'new_pass'},
);
if ($result->code){
$result = $ldap->set_password(newpasswd => $PAR{'new_pass'});
if ($result->code) {
print $result->error;
} else {
print "OK";
@ -80,7 +79,6 @@ if ($active_server){
print "User not found in LDAP\n" if $count == 0;
print "Found $count users\n";
}
}
}
$ldap->unbind();

Loading…
Cancel
Save