diff options
author | Gerald Carter <jerry@samba.org> | 2004-01-06 14:45:56 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2004-01-06 14:45:56 +0000 |
commit | 077d5b2f69f2b32dd6b58c8931909a222401ceaf (patch) | |
tree | 3432b5e1664a3af24861ba3d778529d4088d9b64 /examples/LDAP/smbldap-tools/smbldap-userdel.pl | |
parent | f4a17613110562e3102c10b0cd762ba59bb5c099 (diff) | |
download | samba-077d5b2f69f2b32dd6b58c8931909a222401ceaf.tar.gz samba-077d5b2f69f2b32dd6b58c8931909a222401ceaf.tar.bz2 samba-077d5b2f69f2b32dd6b58c8931909a222401ceaf.zip |
merging from 3.0
(This used to be commit 694052f8a9cc703d4e4ec8075c623ab7122a169b)
Diffstat (limited to 'examples/LDAP/smbldap-tools/smbldap-userdel.pl')
-rwxr-xr-x | examples/LDAP/smbldap-tools/smbldap-userdel.pl | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/examples/LDAP/smbldap-tools/smbldap-userdel.pl b/examples/LDAP/smbldap-tools/smbldap-userdel.pl index 1a1a3214b5..f1e69e209c 100755 --- a/examples/LDAP/smbldap-tools/smbldap-userdel.pl +++ b/examples/LDAP/smbldap-tools/smbldap-userdel.pl @@ -37,9 +37,9 @@ my %Options; my $ok = getopts('r?', \%Options); if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) ) { - print "Usage: $0 [-r?] username\n"; - print " -r remove home directory\n"; - exit (1); + print "Usage: $0 [-r?] username\n"; + print " -r remove home directory\n"; + exit (1); } # Read only first @ARGV @@ -48,34 +48,34 @@ my $user = $ARGV[0]; my $dn; # user must not exist in LDAP if (!defined($dn=get_user_dn($user))) { - print "$0: user $user does not exist\n"; - exit (6); + print "$0: user $user does not exist\n"; + exit (6); } if ($< != 0) { - print "You must be root to delete an user\n"; - exit (1); + print "You must be root to delete an user\n"; + exit (1); } my $homedir; if (defined($Options{'r'})) { - $homedir=get_homedir($user); + $homedir=get_homedir($user); } # remove user from groups my $groups = find_groups_of $user; -my @grplines = split(/\n/, $groups); +my @grplines = split(/\n/,$groups); my $grp; foreach $grp (@grplines) { - my $gname = ""; - if ( $grp =~ /dn: cn=([^,]+),/) { + my $gname = ""; + if ( $grp =~ /dn: cn=([^,]+),/) { $gname = $1; #print "xx $gname\n"; - } - if ($gname ne "") { + } + if ($gname ne "") { group_remove_member($gname, $user); - } + } } # XXX @@ -83,9 +83,9 @@ delete_user($user); # delete dir -- be sure that homeDir is not a strange value if (defined($Options{'r'})) { - if ($homedir !~ /^\/dev/ and $homedir !~ /^\/$/) { + if ($homedir !~ /^\/dev/ and $homedir !~ /^\/$/) { system "rm -rf $homedir"; - } + } } my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; |