[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Mon Jun 28 06:45:33 MDT 2010


The branch, master has been updated
       via  f2e0ca2... s4:torture/rpc/samr.c - test_SetPassword_LastSet - fix "pwdLastSet" test
      from  c5bab3e... s4-smbtorture: add trustDomainPasswords blob test to LOCAL-NDR testsuite.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f2e0ca2662af172868c5a06bd41177cfd8b2aa93
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Mon Jun 28 10:24:28 2010 +0200

    s4:torture/rpc/samr.c - test_SetPassword_LastSet - fix "pwdLastSet" test
    
    - Remove superflous checks (on level 18, 24, 26 we do always have "pwdLastSet"
      resets if "password_expired" > 0)
    - Fixed some bugs
    
    Signed-off-by: Günther Deschner <gd at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source4/torture/rpc/samr.c |   64 +++++++++++++++++++++----------------------
 1 files changed, 31 insertions(+), 33 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index acb033d..c514ed6 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -3177,7 +3177,7 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 					    password,
 					    machine_credentials,
 					    query_levels[q],
-					    &pwdlastset_old,
+					    &pwdlastset_new,
 					    expected_samlogon_result)) {
 			ret = false;
 		}
@@ -3202,6 +3202,7 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 					"been set\n");
 				break;
 			}
+			break;
 		default:
 			if (pwdlastset_new != 0) {
 				torture_warning(tctx, "pwdLastSet test failed: "
@@ -3224,15 +3225,10 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 				ret = false;
 			}
 			break;
-		default:
-			if ((pwdlastset_old > 0) && (pwdlastset_new > 0) &&
-			    (pwdlastset_old >= pwdlastset_new)) {
-				torture_warning(tctx, "pwdlastset not increasing\n");
-				ret = false;
-			}
-			break;
 		}
 
+		pwdlastset_old = pwdlastset_new;
+
 		usleep(delay);
 
 		/* set #2 */
@@ -3262,7 +3258,6 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 		case 21:
 		case 23:
 		case 25:
-
 			/* SAMR_FIELD_EXPIRED_FLAG has not been set and no
 			 * password has been changed, old and new pwdlastset
 			 * need to be the same value */
@@ -3275,6 +3270,7 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 					pwdlastset_new, "pwdlastset must be equal");
 				break;
 			}
+			break;
 		default:
 			if (pwdlastset_old >= pwdlastset_new) {
 				torture_warning(tctx, "pwdLastSet test failed: "
@@ -3288,6 +3284,7 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 					pwdlastset_new);
 				ret = false;
 			}
+			break;
 		}
 
 		switch (levels[l]) {
@@ -3302,13 +3299,6 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 				ret = false;
 			}
 			break;
-		default:
-			if ((pwdlastset_old > 0) && (pwdlastset_new > 0) &&
-			    (pwdlastset_old >= pwdlastset_new)) {
-				torture_warning(tctx, "pwdlastset not increasing\n");
-				ret = false;
-			}
-			break;
 		}
 
 		pwdlastset_old = pwdlastset_new;
@@ -3343,16 +3333,19 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 		case 23:
 		case 25:
 
-			/* if no password has been changed, old and new pwdlastset
+			/* SAMR_FIELD_EXPIRED_FLAG has not been set and no
+			 * password has been changed, old and new pwdlastset
 			 * need to be the same value */
 
-			if (!((fields_present[f] & SAMR_FIELD_NT_PASSWORD_PRESENT) ||
+			if (!(fields_present[f] & SAMR_FIELD_EXPIRED_FLAG) &&
+			    !((fields_present[f] & SAMR_FIELD_NT_PASSWORD_PRESENT) ||
 			      (fields_present[f] & SAMR_FIELD_LM_PASSWORD_PRESENT)))
 			{
 				torture_assert_int_equal(tctx, pwdlastset_old,
 					pwdlastset_new, "pwdlastset must be equal");
 				break;
 			}
+			break;
 		default:
 			if (pwdlastset_old >= pwdlastset_new) {
 				torture_warning(tctx, "pwdLastSet test failed: "
@@ -3366,8 +3359,27 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 					pwdlastset_new);
 				ret = false;
 			}
+			break;
+		}
+
+		switch (levels[l]) {
+		case 21:
+		case 23:
+		case 25:
+			if (((fields_present[f] & SAMR_FIELD_NT_PASSWORD_PRESENT) ||
+			     (fields_present[f] & SAMR_FIELD_LM_PASSWORD_PRESENT)) &&
+			     (pwdlastset_old > 0) && (pwdlastset_new > 0) &&
+			     (pwdlastset_old >= pwdlastset_new)) {
+				torture_warning(tctx, "pwdlastset not increasing\n");
+				ret = false;
+			}
+			break;
 		}
 
+		pwdlastset_old = pwdlastset_new;
+
+		usleep(delay);
+
 		/* set #3 */
 
 		/* set a password and force password change (pwdlastset 0) by
@@ -3416,15 +3428,8 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 					pwdlastset_new, "pwdlastset must be equal");
 				break;
 			}
+			break;
 		default:
-
-			if (pwdlastset_old == pwdlastset_new) {
-				torture_warning(tctx, "pwdLastSet test failed: "
-					"expected last pwdlastset (%lld) != new pwdlastset (%lld)\n",
-					pwdlastset_old, pwdlastset_new);
-				ret = false;
-			}
-
 			if (pwdlastset_new != 0) {
 				torture_warning(tctx, "pwdLastSet test failed: "
 					"expected pwdLastSet 0, got %lld\n",
@@ -3446,13 +3451,6 @@ static bool test_SetPassword_pwdlastset(struct dcerpc_pipe *p,
 				ret = false;
 			}
 			break;
-		default:
-			if ((pwdlastset_old > 0) && (pwdlastset_new > 0) &&
-			    (pwdlastset_old >= pwdlastset_new)) {
-				torture_warning(tctx, "pwdlastset not increasing\n");
-				ret = false;
-			}
-			break;
 		}
 
 		/* if the level we are testing does not have a fields_present


-- 
Samba Shared Repository


More information about the samba-cvs mailing list