diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-10-02 16:03:02 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-10-02 16:03:02 +1000 |
commit | 7bdb4306b033be3fdb49773560bd84a1202c3457 (patch) | |
tree | 7fd8f424704c0ae976248d7c6c29b034420b423a /source4 | |
parent | caa9e3ff8e0da229253f43e26980a394bb76e3ca (diff) | |
download | samba-7bdb4306b033be3fdb49773560bd84a1202c3457.tar.gz samba-7bdb4306b033be3fdb49773560bd84a1202c3457.tar.bz2 samba-7bdb4306b033be3fdb49773560bd84a1202c3457.zip |
s4-torture: added a very simple samr ValidatePassword test
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/rpc/samr.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index f8853c1093..6717195f55 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -6754,6 +6754,35 @@ static bool test_Connect(struct dcerpc_pipe *p, struct torture_context *tctx, } +static bool test_samr_ValidatePassword(struct dcerpc_pipe *p, struct torture_context *tctx) +{ + struct samr_ValidatePassword r; + union samr_ValidatePasswordReq req; + union samr_ValidatePasswordRep *repp = NULL; + NTSTATUS status; + const char *passwords[] = { "penguin", "p@ssw0rd", "p@ssw0rd123$", NULL }; + int i; + + ZERO_STRUCT(r); + r.in.level = NetValidatePasswordReset; + r.in.req = &req; + r.out.rep = &repp; + + ZERO_STRUCT(req); + req.req3.account.string = "non-existant-account-aklsdji"; + + for (i=0; passwords[i]; i++) { + req.req3.password.string = passwords[i]; + status = dcerpc_samr_ValidatePassword(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "samr_ValidatePassword"); + torture_comment(tctx, "Server %s password '%s'\n", + repp->ctr3.status==SAMR_VALIDATION_STATUS_SUCCESS?"allowed":"refused", + req.req3.password.string); + } + + return true; +} + bool torture_rpc_samr(struct torture_context *torture) { NTSTATUS status; @@ -6766,6 +6795,9 @@ bool torture_rpc_samr(struct torture_context *torture) return false; } + ret &= test_samr_ValidatePassword(p, torture); + exit(1); + ret &= test_Connect(p, torture, &handle); if (!torture_setting_bool(torture, "samba3", false)) { |