summaryrefslogtreecommitdiffstats
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
commit86d5326d0dc6a070dfeb24a5306a2b4404bfc0f1 (patch)
treed27637f952f28dae5341a7f8514bd621341e99c1
parent3a413ef1eabbb28b589e5238d9c837a8275b54d0 (diff)
downloadsamba-86d5326d0dc6a070dfeb24a5306a2b4404bfc0f1.tar.gz
samba-86d5326d0dc6a070dfeb24a5306a2b4404bfc0f1.tar.xz
samba-86d5326d0dc6a070dfeb24a5306a2b4404bfc0f1.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
-rw-r--r--source/passdb/passdb.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/source/passdb/passdb.c b/source/passdb/passdb.c
index e1f4958b943..5ae1b710f59 100644
--- a/source/passdb/passdb.c
+++ b/source/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);