From 656a7565e9beecc4a5be4e9ac62815d61548dd46 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 7 Dec 1998 22:52:13 +0000 Subject: Matthew Chapman spotted that smbpasschange was assuming the existence of a private/smbpasswd file, this will not be the case for other database APIs. removed startsmbdb and endsmbpwdb calls because add_smbpwd_entry() and mod_smbpwd_entry() don't need them. (This used to be commit 8b36c7c08ffa408506c35219e6453a595cbc3a4f) --- source3/passdb/smbpasschange.c | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'source3') diff --git a/source3/passdb/smbpasschange.c b/source3/passdb/smbpasschange.c index 22b71d672b..f001040682 100644 --- a/source3/passdb/smbpasschange.c +++ b/source3/passdb/smbpasschange.c @@ -63,7 +63,6 @@ BOOL local_password_change(char *user_name, BOOL trust_account, BOOL add_user, char *msg_str, size_t msg_str_len) { struct passwd *pwd; - void *vp; struct smb_passwd *smb_pwent; uchar new_p16[16]; uchar new_nt_p16[16]; @@ -101,46 +100,21 @@ exist in system password file (usually /etc/passwd).\n", user_name); /* Calculate the MD4 hash (NT compatible) of the new password. */ nt_lm_owf_gen(new_passwd, new_nt_p16, new_p16); - /* - * Open the smbpaswd file. - */ - vp = startsmbpwent(True); - if (!vp && errno == ENOENT) { - FILE *fp; - slprintf(msg_str,msg_str_len-1, - "smbpasswd file did not exist - attempting to create it.\n"); - fp = sys_fopen(lp_smb_passwd_file(), "w"); - if (fp) { - fprintf(fp, "# Samba SMB password file\n"); - fclose(fp); - vp = startsmbpwent(True); - } - } - - if (!vp) { - slprintf(err_str, err_str_len-1, "Cannot open file %s. Error was %s\n", - lp_smb_passwd_file(), strerror(errno) ); - return False; - } - /* Get the smb passwd entry for this user */ smb_pwent = getsmbpwnam(user_name); if (smb_pwent == NULL) { if(add_user == False) { slprintf(err_str, err_str_len-1, "Failed to find entry for user %s.\n", unix_name); - endsmbpwent(vp); return False; } if (add_new_user(user_name, unix_uid, trust_account, disable_user, set_no_password, new_p16, new_nt_p16)) { slprintf(msg_str, msg_str_len-1, "Added user %s.\n", user_name); - endsmbpwent(vp); return True; } else { slprintf(err_str, err_str_len-1, "Failed to add entry for user %s.\n", user_name); - endsmbpwent(vp); return False; } } else { @@ -175,11 +149,8 @@ exist in system password file (usually /etc/passwd).\n", user_name); if(mod_smbpwd_entry(smb_pwent,True) == False) { slprintf(err_str, err_str_len-1, "Failed to modify entry for user %s.\n", unix_name); - endsmbpwent(vp); return False; } - endsmbpwent(vp); - return True; } -- cgit