[Samba] smbldap tools

Jérôme Tournier jerome.tournier at idealx.com
Tue Nov 18 10:07:55 GMT 2003


> Still none, seems the list manager removes the attachments
Well, i don't understand... I think that the problem come from me.
I'll copy-paste the patch bellow:


diff -rup sbin.orig/smbldap-usermod.pl sbin/smbldap-usermod.pl
--- sbin.orig/smbldap-usermod.pl        2003-11-18 10:02:12.000000000 +0100
+++ sbin/smbldap-usermod.pl     2003-11-18 09:56:27.000000000 +0100
@@ -37,7 +37,7 @@ use Getopt::Std;
 my %Options;
 my $nscd_status;

-my $ok = getopts('A:B:C:D:E:F:H:IJN:S:me:f:u:g:G:d:l:s:c:ok:?h', \%Options);
+my $ok = getopts('A:B:C:D:E:F:H:IJN:S:ame:f:u:g:G:d:l:s:c:ok:?h', \%Options);
 if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) || ($Options{'h'}) ) {
   print "Usage: $0 [-awmugdsckxABCDEFGHI?h] username\n";
   print "Available options are:\n";
@@ -54,6 +54,7 @@ if ( (!$ok) || (@ARGV < 1) || ($Options{
   print "  -N    canonical name\n";
   print "  -S    surname\n";
   print " For samba users:\n";
+  print "  -a    add sambaSAMAccount objectclass\n";
   print "  -e    expire date (\"YYYY-MM-DD HH:MM:SS\")\n";
   print "  -A    can change password ? 0 if no, 1 if yes\n";
   print "  -B    must change password ? 0 if no, 1 if yes\n";
@@ -93,6 +94,34 @@ my $dn= $user_entry->dn();

 my $tmp;
 my @mods;
+if (defined($tmp = $Options{'a'})) {
+       # Let's connect to the directory first
+       my $ldap_master=connect_ldap_master();
+        my $winmagic = 2147483647;
+        my $valpwdcanchange = 0;
+        my $valpwdmustchange = $winmagic;
+        my $valpwdlastset = 0;
+        my $valacctflags = "[UX]";
+       my $user_entry=read_user_entry($user);
+       my $uidNumber = $user_entry->get_value('uidNumber');
+       my $userRid = 2 * $uidNumber + 1000;
+       # apply changes
+       my $modify = $ldap_master->modify ( "$dn",
+                                                                                changes => [
+                                                                                                        add => [objectClass => 'sambaSAMAccount'],
+                                                                                                        add => [sambaPwdLastSet => "$valpwdlastset"],
+                                                                                                        add => [sambaLogonTime => '0'],
+                                                                                                        add => [sambaLogoffTime => '2147483647'],
+                                                                                                        add => [sambaKickoffTime => '2147483647'],
+                                                                                                        add => [sambaPwdCanChange => "$valpwdcanchange"],
+                                                                                                        add => [sambaPwdMustChange => "$valpwdmustchange"],
+                                                                                                        add => [displayName => "$_userGecos"],
+                                                                                                        add => [sambaSID=> "$SID-$userRid"],
+                                                                                                        add => [sambaAcctFlags => "$valacctflags"],
+                                                                                                   ]
+                                                                 );
+       $modify->code && warn "failed to modify entry: ", $modify->error ;
+}

 # Process options
 my $changed_uid;






More information about the samba mailing list