The branch, master has been updated
       via  7bdb4306b033be3fdb49773560bd84a1202c3457 (commit)
       via  caa9e3ff8e0da229253f43e26980a394bb76e3ca (commit)
      from  7a59e6c222595df7dbd345b468b46bdab845cbf0 (commit)

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


- Log -----------------------------------------------------------------
commit 7bdb4306b033be3fdb49773560bd84a1202c3457
Author: Andrew Tridgell <[email protected]>
Date:   Fri Oct 2 16:03:02 2009 +1000

    s4-torture: added a very simple samr ValidatePassword test

commit caa9e3ff8e0da229253f43e26980a394bb76e3ca
Author: Andrew Tridgell <[email protected]>
Date:   Fri Oct 2 16:02:42 2009 +1000

    s4-samr: fake up a samr_ValidatePassword response
    
    mdw is working on the correct call to check the password strength

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

Summary of changes:
 source4/rpc_server/samr/dcesrv_samr.c |    6 +++++-
 source4/torture/rpc/samr.c            |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/rpc_server/samr/dcesrv_samr.c 
b/source4/rpc_server/samr/dcesrv_samr.c
index 6dda06a..b8af5fd 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -4342,7 +4342,11 @@ static NTSTATUS dcesrv_samr_SetDsrmPassword(struct 
dcesrv_call_state *dce_call,
 static NTSTATUS dcesrv_samr_ValidatePassword(struct dcesrv_call_state 
*dce_call, TALLOC_CTX *mem_ctx,
                                      struct samr_ValidatePassword *r)
 {
-       DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+       /* just say it's OK for now - we need to hook this into our
+          password strength code later */
+       DEBUG(0,(__location__ ": Faking samr_ValidatePassword reply\n"));
+       (*r->out.rep) = talloc_zero(mem_ctx, union samr_ValidatePasswordRep);
+       return NT_STATUS_OK;
 }
 
 
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index f8853c1..6717195 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)) {


-- 
Samba Shared Repository

Reply via email to