Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2007 14:19:43 +0700 (NOVST)
From:      Dmitry A Grigorovich <odip@bionet.nsc.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        miwi@FreeBSD.org
Subject:   ports/115919: [PATCH] smbldap-passwd failed when unset defaultMaxPasswordAge
Message-ID:  <20070829071943.EE81221902@manticore.bionet.nsc.ru>
Resent-Message-ID: <200708290750.l7T7o33T067789@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         115919
>Category:       ports
>Synopsis:       [PATCH] smbldap-passwd failed when unset defaultMaxPasswordAge
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 29 07:50:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry A Grigorovich
>Release:        FreeBSD 6.2-RELEASE-p7 i386
>Organization:
ICiG SB RAS, Russia
>Environment:
FreeBSD cosmos.softberry.ru 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7

>Description:

root@cosmos# pkg_info -Ix smbldap-tools
smbldap-tools-0.9.3 Useful package for managing users and groups in a LDAP dire

I have unset defaultMaxPasswordAge in /usr/local/etc/smbldap-tools/smbldap.conf:

...
# Default password validation time (time in days) Comment the next line if
# you don't want password to be enable for defaultMaxPasswordAge days (be
# careful to the sambaPwdMustChange attribute's value)
#defaultMaxPasswordAge="45"
...

Trying to change password:

root@cosmos# smbldap-passwd -u odus
Changing UNIX password for odus
New password:
Retype new password:
Use of uninitialized value in string at /usr/local/sbin/smbldap-passwd line 277, <STDIN> line 2.
Unable to change password: shadowMax: value #0 invalid per syntax at /usr/local/sbin/smbldap-passwd line 285, <STDIN> line 2.

Failed!

>How-To-Repeat:

Comment out defaultMaxPasswordAge in smbldap.conf

Try to change password

smbldap-passwd -u SOME_USER

>Fix:

Add following patch to /usr/ports/net/smbldap-tools/files/
Reinstall net/smbldap-tools

Trying to change password again:

root@cosmos# smbldap-passwd -u odus
Changing UNIX password for odus
New password:Retype new password:
root@cosmos#

Worked !


--- smbldap-passwd.orig	Sun Aug 26 01:38:46 2007
+++ smbldap-passwd	Wed Aug 29 13:20:56 2007
@@ -266,22 +266,17 @@
 if ( $update_unix_passwd ) {
     my $shadowLastChange=int(time()/86400);
     my $modify;
+    my @mods;
     if ($< != 0) {
-	$modify = $ldap_master->modify ( "$dn",
-					    changes => [
-							replace => [userPassword => "$hash_password"],
-							replace => [shadowLastChange => "$shadowLastChange"]
-							]
-					    );
+	push @mods, 'userPassword' => "$hash_password";
     } else {
-	$modify = $ldap_master->modify ( "$dn",
-					    changes => [
-							replace => [userPassword => "$hash_password"],
-							replace => [shadowLastChange => "$shadowLastChange"],
-							replace => [shadowMax => "$config{defaultMaxPasswordAge}"]
-							]
-					    );
+	push @mods, 'userPassword' => "$hash_password";
+	push @mods, 'shadowLastChange' => "$shadowLastChange";
+	if ( defined $config{defaultMaxPasswordAge} ) {
+	    push @mods, 'shadowMax' => "$config{defaultMaxPasswordAge}";
+	}
     }
+    $modify = $ldap_master->modify ( "$dn", 'replace' => { @mods } );
     $modify->code && warn "Unable to change password: ", $modify->error ;
 }
 
--- patch-smbldap-passwd ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070829071943.EE81221902>