Changeset 3187b26 for npl/fileserver/smb-ldap-tool/modified
- Timestamp:
- 03/12/18 14:22:15 (7 years ago)
- Branches:
- master, perl-5.22
- Children:
- fdfd619
- Parents:
- 1051986
- Location:
- npl/fileserver/smb-ldap-tool/modified
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
npl/fileserver/smb-ldap-tool/modified/smbldap-groupdel
r1051986 r3187b26 57 57 group_del($dn); 58 58 59 my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 60 61 if ($nscd_status == 0) { 62 system "/etc/init.d/nscd restart > /dev/null 2>&1"; 63 } 59 # my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 60 # 61 # if ($nscd_status == 0) { 62 # system "/etc/init.d/nscd restart > /dev/null 2>&1"; 63 # } 64 system "nscd -i passwd; nscd -i group"; 64 65 65 66 #if (defined($dn_line = get_group_dn($_groupName))) { -
npl/fileserver/smb-ldap-tool/modified/smbldap-groupmod
r1051986 r3187b26 48 48 print " -r group-rid\n"; 49 49 print " -s group-sid\n"; 50 print " -t group-type\n"; 50 print " -t group-type\n"; 51 51 print " -x delete members (comma delimted)\n"; 52 52 print " -? show this help message\n"; … … 66 66 my $newname = $Options{'n'}; 67 67 68 my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 69 70 if ($nscd_status == 0) { 71 system "/etc/init.d/nscd restart > /dev/null 2>&1"; 72 } 68 # my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 69 # 70 # if ($nscd_status == 0) { 71 # system "/etc/init.d/nscd restart > /dev/null 2>&1"; 72 # } 73 system "nscd -i passwd; nscd -i group"; 73 74 74 75 my $gid = getgrnam($groupName); … … 223 224 } 224 225 225 $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 226 227 if ($nscd_status == 0) { 228 system "/etc/init.d/nscd restart > /dev/null 2>&1"; 229 } 226 # $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 227 # 228 # if ($nscd_status == 0) { 229 # system "/etc/init.d/nscd restart > /dev/null 2>&1"; 230 # } 231 system "nscd -i passwd; nscd -i group"; 230 232 231 233 # take down session -
npl/fileserver/smb-ldap-tool/modified/smbldap-useradd
r1051986 r3187b26 149 149 150 150 my $userUidNumber = $Options{'u'}; 151 if (!defined($userUidNumber)) { 151 if (!defined($userUidNumber)) { 152 152 $userUidNumber=get_next_id($config{usersdn},"uidNumber"); 153 153 } elsif (getpwuid($userUidNumber)) { … … 158 158 system "/etc/init.d/nscd start > /dev/null 2>&1"; 159 159 } 160 system "nscd -i passwd; nscd -i group"; 160 161 161 162 my $createGroup = 0; 162 163 my $userGidNumber = $Options{'g'}; 163 # gid not specified ? 164 # gid not specified ? 164 165 if (!defined($userGidNumber)) { 165 166 # windows machine => $config{defaultComputerGid} … … 252 253 # MACHINE ACCOUNT 253 254 if (defined($Options{'w'}) or defined($Options{'i'})) { 254 255 255 256 # if Options{'i'} and username does not end with $ caracter => we add it 256 257 if ( $Options{'i'} and !($userName =~ m/\$$/) ) { … … 270 271 system "stty -echo"; 271 272 print "New password : "; 272 chomp($pass=<STDIN>); 273 chomp($pass=<STDIN>); 273 274 print "\n"; 274 275 system "stty echo"; … … 345 346 my $OX_TZ = "Europe/Amsterdam"; 346 347 my $WRITE_GLOBAL_ADDR = "TRUE"; 347 348 348 349 my $GROUPWARE_SERVER="none"; 349 350 if (defined($Options{'W'})) … … 388 389 $add->code && warn "failed to add entry: ", $add->error ; 389 390 390 my $add2 = $ldap_master->add ("ou=addr,uid=$userName,$config{usersdn}", attr => [ 'objectclass' => ['top','organizationalUnit'], 'ou' => "addr" ] ); 391 my $add2 = $ldap_master->add ("ou=addr,uid=$userName,$config{usersdn}", attr => [ 'objectclass' => ['top','organizationalUnit'], 'ou' => "addr" ] ); 391 392 392 393 my $add3 = $ldap_master->modify ("cn=AddressAdmins,o=AddressBook,$config{suffix}",add => { member => "uid=$userName,$config{usersdn}" }); 393 394 $add3->code && warn "failed to add entry: ", $add3->error ; 394 395 395 396 396 397 #if ($createGroup) { … … 416 417 system "chown -R $userUidNumber:$userGidNumber $userHomeDirectory 2>/dev/null"; 417 418 if (defined $config{userHomeDirectoryMode}) { 418 system "chmod $config{userHomeDirectoryMode} $userHomeDirectory 2>/dev/null"; 419 system "chmod $config{userHomeDirectoryMode} $userHomeDirectory 2>/dev/null"; 419 420 } else { 420 system "chmod 700 $userHomeDirectory 2>/dev/null"; 421 system "chmod 700 $userHomeDirectory 2>/dev/null"; 421 422 } 422 423 } … … 498 499 ] 499 500 ); 500 501 501 502 $modify->code && die "failed to add entry: ", $modify->error ; 502 503 -
npl/fileserver/smb-ldap-tool/modified/smbldap-userdel
r1051986 r3187b26 105 105 system "/etc/init.d/nscd restart > /dev/null 2>&1"; 106 106 } 107 system "nscd -i passwd; nscd -i group"; 107 108 108 109 $ldap_master->unbind; # take down session -
npl/fileserver/smb-ldap-tool/modified/smbldap-usermod
r1051986 r3187b26 113 113 my $valpwdcanchange = 0; 114 114 my $valpwdmustchange = $winmagic; 115 my $valpwdlastset = 0; 115 my $valpwdlastset = 0; 116 116 my $valacctflags = "[UX]"; 117 117 my $user_entry=read_user_entry($user); … … 143 143 if (defined($Options{'o'})) { 144 144 $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 145 145 146 146 if ($nscd_status == 0) { 147 147 system "/etc/init.d/nscd stop > /dev/null 2>&1"; … … 152 152 system "/etc/init.d/nscd start > /dev/null 2>&1"; 153 153 } 154 system "nscd -i passwd; nscd -i group"; 154 155 155 156 print "$0: uid number $tmp exists\n"; … … 219 220 } 220 221 221 if (defined($tmp = $Options{'N'})) { 222 if (defined($tmp = $Options{'N'})) { 222 223 push(@mods, 'cn' => $tmp); 223 224 } … … 227 228 push(@mods, 'givenName' => $tmp); 228 229 } 229 230 if (defined($tmp = $Options{'S'})) { 230 231 if (defined($tmp = $Options{'S'})) { 231 232 push(@mods, 'sn' => $tmp); 232 233 } … … 580 581 system "/etc/init.d/nscd restart > /dev/null 2>&1"; 581 582 } 583 system "nscd -i passwd; nscd -i group"; 582 584 583 585 if (defined($Options{'P'})) { -
npl/fileserver/smb-ldap-tool/modified/smbldap_tools.pm
r1051986 r3187b26 241 241 undef $smbconf{$parameter_smb}; 242 242 } 243 243 244 244 } 245 245 … … 287 287 # debug => 0xffff, 288 288 ); 289 289 290 290 if ($ldap_master) 291 291 { … … 542 542 ] 543 543 ); 544 544 545 545 $add->code && warn "failed to add entry: ", $add->error ; 546 546 sleep($wait); … … 564 564 $name =~ s/.$//s; 565 565 566 my ($lmpassword,$ntpassword) = ntlmgen $name; 566 my ($lmpassword,$ntpassword) = ntlmgen $name; 567 567 my $modify = $ldap->modify ( "uid=$user,$config{computersdn}", 568 568 changes => [ … … 581 581 ] 582 582 ); 583 583 584 584 $modify->code && die "failed to add entry: ", $modify->error ; 585 585 … … 594 594 if (!defined(get_group_dn($group))) { 595 595 print "$0: group \"$group\" doesn't exist\n"; 596 exit (6); 596 exit (6); 597 597 } 598 598 if (!defined($dn_line)) { … … 666 666 } 667 667 668 668 669 669 sub add_grouplist_user 670 670 { … … 683 683 my $dn_line; 684 684 my $dn = get_dn_from_line($dn_line); 685 685 686 686 if (!defined($dn_line = get_user_dn($user))) { 687 687 print "$0: user $user doesn't exist\n"; … … 725 725 { 726 726 my ($gname, $gid, $force) = @_; 727 my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";728 if ($nscd_status == 0) {729 system "/etc/init.d/nscd stop > /dev/null 2>&1";730 }727 # my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 728 # if ($nscd_status == 0) { 729 # system "/etc/init.d/nscd stop > /dev/null 2>&1"; 730 # } 731 731 if (!defined($gid)) { 732 732 #while (defined(getgrgid($config{GID_START}))) { … … 742 742 } 743 743 } 744 if ($nscd_status == 0) { 745 system "/etc/init.d/nscd start > /dev/null 2>&1"; 746 } 744 # if ($nscd_status == 0) { 745 # system "/etc/init.d/nscd start > /dev/null 2>&1"; 746 system "nscd -i passwd; nscd -i group"; 747 # } 747 748 my $modify = $ldap->add ( "cn=$gname,$config{groupsdn}", 748 749 attrs => [ … … 752 753 ] 753 754 ); 754 755 755 756 $modify->code && die "failed to add entry: ", $modify->error ; 756 757 return $gid; … … 1078 1079 } 1079 1080 my $entry = $next_uid_mesg->entry(0); 1080 1081 1081 1082 $nextuid = $entry->get_value($attribute); 1082 1083 my $modify=$ldap->modify( "$config{sambaUnixIdPooldn}", … … 1103 1104 1104 1105 sub utf8Encode { 1105 my $arg = shift; 1106 my $arg = shift; 1106 1107 1107 1108 return to_utf8( … … 1118 1119 -charset => 'ISO-8859-1', 1119 1120 ); 1120 } 1121 } 1121 1122 1122 1123 1; 1123
Note: See TracChangeset
for help on using the changeset viewer.