summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-01-30 12:06:22 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-01-30 12:06:22 +0000
commit03a2391417e4d6cf6d7401d6d9a3616d08f66bb5 (patch)
tree02e3f3c788df2194704bc5efb467eb795fed690e /source3
parentc08186b947350b38f157ff037fd57327509a3a10 (diff)
downloadsamba-03a2391417e4d6cf6d7401d6d9a3616d08f66bb5.tar.gz
samba-03a2391417e4d6cf6d7401d6d9a3616d08f66bb5.tar.bz2
samba-03a2391417e4d6cf6d7401d6d9a3616d08f66bb5.zip
Back out herb's changes (to allow smbpasswd -x to work on accounts outside
/etc/passwd) and replace them with a version that works. Unfortunetly HEAD and 2.2 have different passdb interfaces and different local_password_change functions... Andrew Bartlett (This used to be commit 86d5326d0dc6a070dfeb24a5306a2b4404bfc0f1)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/passdb.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index e1f4958b94..5ae1b710f5 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -1032,21 +1032,13 @@ 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);
if (local_flags & LOCAL_ADD_USER) {
pwd = getpwnam_alloc(user_name);
+ } else if (local_flags & LOCAL_DELETE_USER) {
+ /* Might not exist in /etc/passwd */
} else {
slprintf(err_str, err_str_len-1,"Failed to find entry for user %s.\n", user_name);
return False;
@@ -1163,6 +1155,13 @@ 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);