diff options
author | Luke Leighton <lkcl@samba.org> | 1998-12-07 22:52:13 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-12-07 22:52:13 +0000 |
commit | 656a7565e9beecc4a5be4e9ac62815d61548dd46 (patch) | |
tree | 3b7a63fc6fe963c3601f455aec3939e34612cf5d /source3 | |
parent | e50ab2b528a3dd176d98f95cb644fc6695c55318 (diff) | |
download | samba-656a7565e9beecc4a5be4e9ac62815d61548dd46.tar.gz samba-656a7565e9beecc4a5be4e9ac62815d61548dd46.tar.bz2 samba-656a7565e9beecc4a5be4e9ac62815d61548dd46.zip |
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)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/passdb/smbpasschange.c | 29 |
1 files changed, 0 insertions, 29 deletions
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; } |