From odip@bionet.nsc.ru  Wed Aug 29 07:43:29 2007
Return-Path: <odip@bionet.nsc.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D92516A46D;
	Wed, 29 Aug 2007 07:43:29 +0000 (UTC)
	(envelope-from odip@bionet.nsc.ru)
Received: from manticore.bionet.nsc.ru (manticore.bionet.nsc.ru [84.237.118.164])
	by mx1.freebsd.org (Postfix) with SMTP id 6511D13C481;
	Wed, 29 Aug 2007 07:43:18 +0000 (UTC)
	(envelope-from odip@bionet.nsc.ru)
Received: by manticore.bionet.nsc.ru (Postfix, from userid 1001)
	id EE81221902; Wed, 29 Aug 2007 14:19:43 +0700 (NOVST)
Message-Id: <20070829071943.EE81221902@manticore.bionet.nsc.ru>
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: [PATCH] smbldap-passwd failed when unset defaultMaxPasswordAge
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         115919
>Category:       ports
>Synopsis:       [PATCH] net/smbldap-tools - smbldap-passwd failed when unset defaultMaxPasswordAge
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    miwi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 29 07:50:03 GMT 2007
>Closed-Date:    Tue Sep 18 12:42:12 GMT 2007
>Last-Modified:  Fri Sep 21 09:00:05 GMT 2007
>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:

From: Dmitry A Grigorovich <odip@bionet.nsc.ru>
To: bug-followup@FreeBSD.org,  odip@bionet.nsc.ru
Cc:  
Subject: Re: ports/115919: [PATCH] smbldap-passwd failed when unset defaultMaxPasswordAge
Date: Wed, 29 Aug 2007 16:32:01 +0700

 This is a multi-part message in MIME format.
 --------------010602040000060705090206
 Content-Type: text/plain; charset=KOI8-R; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Sorry, corrected patch
 
 -- 
 
 [ODiP] == Grigorovich Dmitry
 
 --------------010602040000060705090206
 Content-Type: text/plain;
  name="patch-smbldap-passwd"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="patch-smbldap-passwd"
 
 --- smbldap-passwd.orig	Thu Jul 19 16:54:33 2007
 +++ smbldap-passwd	Wed Aug 29 16:18:21 2007
 @@ -266,22 +266,18 @@
  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";
 +	push @mods, 'shadowLastChange' => "$shadowLastChange";
      } 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 ;
  }
  
 
 --------------010602040000060705090206--
Responsible-Changed-From-To: freebsd-ports-bugs->miwi 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Wed Aug 29 11:21:56 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115919 
State-Changed-From-To: open->closed 
State-Changed-By: miwi 
State-Changed-When: Tue Sep 18 12:42:08 UTC 2007 
State-Changed-Why:  
fixed with the update to 0.9.4. Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115919 

From: Dmitry A Grigorovich <odip@bionet.nsc.ru>
To: bug-followup@FreeBSD.org,  odip@bionet.nsc.ru,  miwi@freebsd.org
Cc:  
Subject: Re: ports/115919: [PATCH] net/smbldap-tools - smbldap-passwd failed
 when unset defaultMaxPasswordAge
Date: Wed, 19 Sep 2007 13:16:06 +0700

 Cvsup-ing ports updates smbldap to 0.9.4
 but I can't see this patch in smbldap-0.9.4
 
 ???
 
 -- 
 
 [ODiP] == Grigorovich Dmitry

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/115919: commit references a PR
Date: Fri, 21 Sep 2007 08:53:56 +0000 (UTC)

 mm          2007-09-21 08:53:50 UTC
 
   FreeBSD ports repository
 
   Modified files:
     net/smbldap-tools    Makefile 
   Added files:
     net/smbldap-tools/files patch-smbldap-passwd 
   Log:
   - Add patch for smbldap-passwd
   - Update COMMENT
   - Bump PORTREVISION
   
   PR:             ports/115919
   
   Revision  Changes    Path
   1.18      +2 -1      ports/net/smbldap-tools/Makefile
   1.1       +11 -0     ports/net/smbldap-tools/files/patch-smbldap-passwd (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
