summaryrefslogtreecommitdiffstats
path: root/source/smbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-01-23 11:57:11 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-01-23 11:57:11 +0000
commit635942ae21793136814a84b1d344f411a5d6e242 (patch)
tree999cc1e2d043326e6dc2fb135ac1f28d291cd1e8 /source/smbd
parent6025ab201aa34bbf4a7e897149ef6ba370a89703 (diff)
downloadsamba-635942ae21793136814a84b1d344f411a5d6e242.tar.gz
samba-635942ae21793136814a84b1d344f411a5d6e242.tar.xz
samba-635942ae21793136814a84b1d344f411a5d6e242.zip
Change the order of this a bit - as unix password change can fail.
This due for abstraction into chgpasswd.c shortly. Andrew Bartlett
Diffstat (limited to 'source/smbd')
-rw-r--r--source/smbd/lanman.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c
index d755bb42f8b..f6ebbc82adc 100644
--- a/source/smbd/lanman.c
+++ b/source/smbd/lanman.c
@@ -1951,29 +1951,30 @@ static BOOL api_SetUserPassword(connection_struct *conn,uint16 vuid, char *param
auth_serversupplied_info *server_info = NULL;
DATA_BLOB password = data_blob(pass1, strlen(pass1)+1);
if (NT_STATUS_IS_OK(check_plaintext_password(user,password,&server_info))) {
- if (change_oem_password(server_info->sam_account,pass2))
- {
- SSVAL(*rparam,0,NERR_Success);
- }
-
+
/*
* If unix password sync was requested, attempt to change
- * the /etc/passwd database also. Return failure if this cannot
+ * the /etc/passwd database first. Return failure if this cannot
* be done.
*
- * This occours regardless of the previous result, becouse
- * It might not have been testing the password against the SAM backend.
- * (and therefore the change_oem_password would fail).
+ * This occurs before the oem change, becouse we don't want to
+ * update it if chgpasswd failed.
*
* Conditional on lp_unix_password_sync() becouse we don't want
* to touch the unix db unless we have admin permission.
*/
- if(lp_unix_password_sync() && !chgpasswd(pdb_get_username(server_info->sam_account),
- pass1,pass2,False)) {
+ if(lp_unix_password_sync() && IS_SAM_UNIX_USER(server->sam_account)
+ && !chgpasswd(pdb_get_username(server_info->sam_account),
+ pass1,pass2,False)) {
SSVAL(*rparam,0,NERR_badpass);
}
+ if (change_oem_password(server_info->sam_account,pass2))
+ {
+ SSVAL(*rparam,0,NERR_Success);
+ }
+
free_server_info(&server_info);
}
data_blob_clear_free(&password);