diff options
author | Herb Lewis <herb@samba.org> | 2002-01-30 04:07:42 +0000 |
---|---|---|
committer | Herb Lewis <herb@samba.org> | 2002-01-30 04:07:42 +0000 |
commit | 967af63a5f05fcdaebb60dce5984bed9ff0e5ce6 (patch) | |
tree | 247e85fd17e621908f3f33484233ae327d00d1f6 /source3 | |
parent | 62ea16ae360f7fde644823443da407659be734f9 (diff) | |
download | samba-967af63a5f05fcdaebb60dce5984bed9ff0e5ce6.tar.gz samba-967af63a5f05fcdaebb60dce5984bed9ff0e5ce6.tar.xz samba-967af63a5f05fcdaebb60dce5984bed9ff0e5ce6.zip |
merge change from @_2 to allow smbpasswd -x to delete user even if no
entry in /etc/passwd.
There are still differences in the local_password_change function. I'm
not sure which was the latest so I didn't change any thing else. Someone
needs to take a look and sync these up.
(This used to be commit 539b025397e569796f2349d33438c2be469c8c69)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/passdb/passdb.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index e6abb26b3f..fa3115d96e 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -1033,6 +1033,16 @@ BOOL local_password_change(const char *user_name, int local_flags, /* Get the smb passwd entry for this user */ pdb_init_sam(&sam_pass); + if (local_flags & LOCAL_DELETE_USER) { + if (!pdb_delete_sam_account(sam_pass)) { + slprintf(err_str,err_str_len-1, "Failed to delete entry for user %s.\n", user_name); + pdb_free_sam(&sam_pass); + return False; + } + slprintf(msg_str, msg_str_len-1, "Deleted user %s.\n", user_name); + pdb_free_sam(&sam_pass); + return True; + } if(!pdb_getsampwnam(sam_pass, user_name)) { pdb_free_sam(&sam_pass); @@ -1154,13 +1164,6 @@ BOOL local_password_change(const char *user_name, int local_flags, pdb_free_sam(&sam_pass); return False; } - } else if (local_flags & LOCAL_DELETE_USER) { - if (!pdb_delete_sam_account(sam_pass)) { - slprintf(err_str,err_str_len-1, "Failed to delete entry for user %s.\n", user_name); - pdb_free_sam(&sam_pass); - return False; - } - slprintf(msg_str, msg_str_len-1, "Deleted user %s.\n", user_name); } else { if(!pdb_update_sam_account(sam_pass)) { slprintf(err_str, err_str_len-1, "Failed to modify entry for user %s.\n", user_name); |