summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>2002-01-30 04:07:42 +0000
committerHerb Lewis <herb@samba.org>2002-01-30 04:07:42 +0000
commit967af63a5f05fcdaebb60dce5984bed9ff0e5ce6 (patch)
tree247e85fd17e621908f3f33484233ae327d00d1f6
parent62ea16ae360f7fde644823443da407659be734f9 (diff)
downloadsamba-967af63a5f05fcdaebb60dce5984bed9ff0e5ce6.tar.gz
samba-967af63a5f05fcdaebb60dce5984bed9ff0e5ce6.tar.bz2
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)
-rw-r--r--source3/passdb/passdb.c17
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);