svn commit: samba r20905 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_24/source/nsswitch

jerry at samba.org jerry at samba.org
Fri Jan 19 14:54:05 GMT 2007


Author: jerry
Date: 2007-01-19 14:54:05 +0000 (Fri, 19 Jan 2007)
New Revision: 20905

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20905

Log:
Windows 2000 returns NT_STATUS_ACCOUNT_RESTRICTION if the pw
chnage fails due to policy settings where as 2003 (the chgpasswd3()
request) fails with NT_STATUS_PASSWORD_RESTRICTION.  Thunk down
to the same return code so we correctly retreive the password policy
in both cases.


Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_pam.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c	2007-01-19 14:33:36 UTC (rev 20904)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c	2007-01-19 14:54:05 UTC (rev 20905)
@@ -1865,9 +1865,9 @@
 
 	result = rpccli_samr_chgpasswd3(cli, state->mem_ctx, user, newpass, oldpass, &info, &reject);
 
-	/* FIXME: need to check for other error codes ? */
-	if (NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_RESTRICTION)) {
+ 	/* Windows 2003 returns NT_STATUS_PASSWORD_RESTRICTION */
 
+	if (NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_RESTRICTION) ) {
 		state->response.data.auth.policy.min_length_password = 
 			info.min_length_password;
 		state->response.data.auth.policy.password_history = 
@@ -1883,9 +1883,10 @@
 			reject.reject_reason;
 
 		got_info = True;
+	}
 
 	/* only fallback when the chgpasswd3 call is not supported */
-	} else if ((NT_STATUS_EQUAL(result, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR))) ||
+	if ((NT_STATUS_EQUAL(result, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR))) ||
 		   (NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED)) ||
 		   (NT_STATUS_EQUAL(result, NT_STATUS_NOT_IMPLEMENTED))) {
 
@@ -1893,6 +1894,13 @@
 			nt_errstr(result)));
 		
 		result = rpccli_samr_chgpasswd_user(cli, state->mem_ctx, user, newpass, oldpass);
+
+		/* Windows 2000 returns NT_STATUS_ACCOUNT_RESTRICTION.
+		   Map to the same status code as Windows 2003. */
+
+		if ( NT_STATUS_EQUAL(NT_STATUS_ACCOUNT_RESTRICTION, result ) ) {
+			result = NT_STATUS_PASSWORD_RESTRICTION;			
+		}
 	}
 
 done: 

Modified: branches/SAMBA_3_0_24/source/nsswitch/winbindd_pam.c
===================================================================
--- branches/SAMBA_3_0_24/source/nsswitch/winbindd_pam.c	2007-01-19 14:33:36 UTC (rev 20904)
+++ branches/SAMBA_3_0_24/source/nsswitch/winbindd_pam.c	2007-01-19 14:54:05 UTC (rev 20905)
@@ -1867,9 +1867,9 @@
 
 	result = rpccli_samr_chgpasswd3(cli, state->mem_ctx, user, newpass, oldpass, &info, &reject);
 
-	/* FIXME: need to check for other error codes ? */
-	if (NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_RESTRICTION)) {
+ 	/* Windows 2003 returns NT_STATUS_PASSWORD_RESTRICTION */
 
+	if (NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_RESTRICTION) ) {
 		state->response.data.auth.policy.min_length_password = 
 			info.min_length_password;
 		state->response.data.auth.policy.password_history = 
@@ -1885,9 +1885,10 @@
 			reject.reject_reason;
 
 		got_info = True;
+	}
 
 	/* only fallback when the chgpasswd3 call is not supported */
-	} else if ((NT_STATUS_EQUAL(result, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR))) ||
+	if ((NT_STATUS_EQUAL(result, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR))) ||
 		   (NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED)) ||
 		   (NT_STATUS_EQUAL(result, NT_STATUS_NOT_IMPLEMENTED))) {
 
@@ -1895,6 +1896,13 @@
 			nt_errstr(result)));
 		
 		result = rpccli_samr_chgpasswd_user(cli, state->mem_ctx, user, newpass, oldpass);
+
+		/* Windows 2000 returns NT_STATUS_ACCOUNT_RESTRICTION.
+		   Map to the same status code as Windows 2003. */
+
+		if ( NT_STATUS_EQUAL(NT_STATUS_ACCOUNT_RESTRICTION, result ) ) {
+			result = NT_STATUS_PASSWORD_RESTRICTION;			
+		}
 	}
 
 done: 



More information about the samba-cvs mailing list