pkgsrc/sysutils/smbldap-tools/patches/patch-ad
taca 55a29dc539 Importing smbldap-tools version 0.9.5. It has still experimental phase.
Smbldap-tools is a set of scripts designed to help integrate Samba and
a LDAP directory.  They target both users and administrators of unix
systems.

Users can change their password in a way similar to the standard
`passwd' command.

Administrators can perform user and group management command line
actions and synchronise Samba account management consistently.

A version of these tools are bundled with samba, but this set is from
the master development site and is generally more up to date.
2008-06-16 16:04:25 +00:00

31 lines
1.1 KiB
Text

$NetBSD: patch-ad,v 1.1.1.1 2008/06/16 16:04:25 taca Exp $
--- smbldap-passwd.orig 2008-04-22 17:13:29.000000000 +0900
+++ smbldap-passwd
@@ -99,6 +99,17 @@ if ($< != 0) {
system "/bin/stty echo" if (-t STDIN);
print "\n";
+ { # Check if user dn is stored in subtree.
+ my $test_conn = connect_ldap_master();
+ my $usersdn = &get_user_dn($user);
+ if ($usersdn && $usersdn =~ /^dn: uid=(.+?)(,(.*))?$config{usersdn}/) {
+ my ($uid,$subtree) = ("","");
+ $uid = $1; $subtree = defined($3)?$3 : "";
+ $config{usersdn} = $subtree . $config{usersdn};
+ }
+ $test_conn->unbind;
+ }
+
$config{masterDN}="uid=$user,$config{usersdn}";
$config{masterPw}="$oldpass";
$ldap_master=connect_ldap_master();
@@ -228,7 +239,7 @@ if ( $samba and $update_samba_passwd ) {
my $winmagic = 2147483647;
my $valacctflags = "[U]";
push(@mods, 'sambaPwdMustChange' => 0);
- push(@mods, 'sambaPwdLastSet' => 0);
+ push(@mods, 'sambaPwdLastSet' => $date);
push(@mods, 'sambaAcctFlags' => $valacctflags);
}
# Let's change nt/lm passwords