diff options
-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); |