summaryrefslogtreecommitdiff
path: root/source4/torture/ndr
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-11-08 15:58:34 +0100
committerGünther Deschner <gd@samba.org>2011-11-08 23:00:40 +0100
commitbfe084bd8bbdfa0a0fa31521584f3bc142785fb8 (patch)
tree462c6146ddba1bd4adcf3503c58a676f2261d229 /source4/torture/ndr
parent099d687d1a5df7c88deced386df38e6e716ca053 (diff)
downloadsamba-bfe084bd8bbdfa0a0fa31521584f3bc142785fb8.tar.gz
samba-bfe084bd8bbdfa0a0fa31521584f3bc142785fb8.tar.bz2
samba-bfe084bd8bbdfa0a0fa31521584f3bc142785fb8.zip
s4-smbtorture: demonstrate how broken our samr_ChangePasswordUser3 marshalling is...
Guenther
Diffstat (limited to 'source4/torture/ndr')
-rw-r--r--source4/torture/ndr/samr.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source4/torture/ndr/samr.c b/source4/torture/ndr/samr.c
index 8cc949e469..ce4d76c326 100644
--- a/source4/torture/ndr/samr.c
+++ b/source4/torture/ndr/samr.c
@@ -278,6 +278,32 @@ static const uint8_t samr_changepassworduser3_w2k_out_data[] = {
0xbb, 0x00, 0x00, 0xc0
};
+static const uint8_t samr_changepassworduser3_w2k8r2_out_data[] = {
+ 0x00, 0x00, 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0xa6, 0x0a, 0xff, 0xde, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0xc0
+};
+
+static bool samr_changepassworduser3_w2k8r2_out_check(struct torture_context *tctx,
+ struct samr_ChangePasswordUser3 *r)
+{
+ struct samr_DomInfo1 *dominfo = *r->out.dominfo;
+ struct userPwdChangeFailureInformation *reject = *r->out.reject;
+
+ torture_assert_int_equal(tctx, dominfo->min_password_length, 7, "min_password_length");
+ torture_assert_int_equal(tctx, dominfo->password_history_length, 0, "password_history_length");
+ torture_assert_int_equal(tctx, dominfo->password_properties, DOMAIN_PASSWORD_COMPLEX, "password_properties");
+ torture_assert_u64_equal(tctx, dominfo->max_password_age, 0xffffdeff0aa68000, "max_password_age");
+ torture_assert_u64_equal(tctx, dominfo->min_password_age, 0x0000000000000000, "min_password_age");
+
+ torture_assert_int_equal(tctx, reject->extendedFailureReason, SAM_PWD_CHANGE_NOT_COMPLEX, "extendedFailureReason");
+
+ torture_assert_ntstatus_equal(tctx, r->out.result, NT_STATUS_PASSWORD_RESTRICTION, "result");
+
+ return true;
+}
+
struct torture_suite *ndr_samr_suite(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(ctx, "samr");
@@ -314,6 +340,12 @@ struct torture_suite *ndr_samr_suite(TALLOC_CTX *ctx)
/* Samba currently fails to parse a w2k reply */
torture_suite_add_ndr_pull_fn_test(suite, samr_ChangePasswordUser3, samr_changepassworduser3_w2k_out_data, NDR_OUT, NULL);
#endif
+ torture_suite_add_ndr_pull_fn_test(suite,
+ samr_ChangePasswordUser3,
+ samr_changepassworduser3_w2k8r2_out_data,
+ NDR_OUT,
+ samr_changepassworduser3_w2k8r2_out_check);
+
return suite;
}