]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-samr: merge samr_GetUserPwInfo from s3 idl. (fixme: python)
authorGünther Deschner <gd@samba.org>
Wed, 5 Nov 2008 00:28:49 +0000 (01:28 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 10 Nov 2008 20:46:27 +0000 (21:46 +0100)
Guenther

librpc/idl/samr.idl
source4/libnet/libnet_join.c
source4/rpc_server/samr/dcesrv_samr.c
source4/torture/rpc/samr.c
source4/torture/rpc/testjoin.c

index b0dacc91d4e0fd5de8f9f81a18907f202dcb878f..7fb3d95ea20f716f93fe82a21d1bc6cf41004a29 100644 (file)
@@ -1177,7 +1177,7 @@ import "misc.idl", "lsa.idl", "security.idl";
 
        [public] NTSTATUS samr_GetUserPwInfo(
                [in,ref]    policy_handle *user_handle,
-               [out]       samr_PwInfo info
+               [out,ref]   samr_PwInfo *info
                );
 
        /************************/
index 0ed5e8ae2623b9d44e8045aa515314f472079829..e18797c3d5937a4e89a6088e48ef16d36a3c0f5f 100644 (file)
@@ -451,6 +451,7 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru
        struct samr_UserInfo21 u_info21;
        union libnet_SetPassword r2;
        struct samr_GetUserPwInfo pwp;
+       struct samr_PwInfo info;
        struct lsa_String samr_account_name;
        
        uint32_t acct_flags, old_acct_flags;
@@ -778,10 +779,11 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru
 
        /* Find out what password policy this user has */
        pwp.in.user_handle = u_handle;
+       pwp.out.info = &info;
 
        status = dcerpc_samr_GetUserPwInfo(samr_pipe, tmp_ctx, &pwp);                           
        if (NT_STATUS_IS_OK(status)) {
-               policy_min_pw_len = pwp.out.info.min_password_length;
+               policy_min_pw_len = pwp.out.info->min_password_length;
        }
        
        /* Grab a password of that minimum length */
index 37446f5aa2c40ee38a1fe86196ea8c596eee8b66..2cd3f8896ebc24e9400cf81b67a4fced3f0a1b47 100644 (file)
@@ -3928,18 +3928,18 @@ static NTSTATUS dcesrv_samr_GetUserPwInfo(struct dcesrv_call_state *dce_call, TA
        struct dcesrv_handle *h;
        struct samr_account_state *a_state;
 
-       ZERO_STRUCT(r->out.info);
+       ZERO_STRUCTP(r->out.info);
 
        DCESRV_PULL_HANDLE(h, r->in.user_handle, SAMR_HANDLE_USER);
 
        a_state = h->data;
 
-       r->out.info.min_password_length = samdb_search_uint(a_state->sam_ctx, mem_ctx, 0,
-                                                           a_state->domain_state->domain_dn, "minPwdLength", 
-                                                           NULL);
-       r->out.info.password_properties = samdb_search_uint(a_state->sam_ctx, mem_ctx, 0,
-                                                           a_state->account_dn, 
-                                                           "pwdProperties", NULL);
+       r->out.info->min_password_length = samdb_search_uint(a_state->sam_ctx, mem_ctx, 0,
+                                                            a_state->domain_state->domain_dn, "minPwdLength",
+                                                            NULL);
+       r->out.info->password_properties = samdb_search_uint(a_state->sam_ctx, mem_ctx, 0,
+                                                            a_state->account_dn,
+                                                            "pwdProperties", NULL);
        return NT_STATUS_OK;
 }
 
index 8e527d990b1f80a20c93d8ee4ceec31f6617e2e2..aebef28a19d37ffceb4e7b45e3bf7ecaeb405053 100644 (file)
@@ -553,12 +553,14 @@ static bool test_SetUserPass(struct dcerpc_pipe *p, struct torture_context *tctx
        DATA_BLOB session_key;
        char *newpass;
        struct samr_GetUserPwInfo pwp;
+       struct samr_PwInfo info;
        int policy_min_pw_len = 0;
        pwp.in.user_handle = handle;
+       pwp.out.info = &info;
 
        status = dcerpc_samr_GetUserPwInfo(p, tctx, &pwp);
        if (NT_STATUS_IS_OK(status)) {
-               policy_min_pw_len = pwp.out.info.min_password_length;
+               policy_min_pw_len = pwp.out.info->min_password_length;
        }
        newpass = samr_rand_pass(tctx, policy_min_pw_len);
 
@@ -605,12 +607,14 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t
        DATA_BLOB session_key;
        char *newpass;
        struct samr_GetUserPwInfo pwp;
+       struct samr_PwInfo info;
        int policy_min_pw_len = 0;
        pwp.in.user_handle = handle;
+       pwp.out.info = &info;
 
        status = dcerpc_samr_GetUserPwInfo(p, tctx, &pwp);
        if (NT_STATUS_IS_OK(status)) {
-               policy_min_pw_len = pwp.out.info.min_password_length;
+               policy_min_pw_len = pwp.out.info->min_password_length;
        }
        newpass = samr_rand_pass(tctx, policy_min_pw_len);
 
@@ -684,12 +688,14 @@ static bool test_SetUserPassEx(struct dcerpc_pipe *p, struct torture_context *tc
        char *newpass;
        struct MD5Context ctx;
        struct samr_GetUserPwInfo pwp;
+       struct samr_PwInfo info;
        int policy_min_pw_len = 0;
        pwp.in.user_handle = handle;
+       pwp.out.info = &info;
 
        status = dcerpc_samr_GetUserPwInfo(p, tctx, &pwp);
        if (NT_STATUS_IS_OK(status)) {
-               policy_min_pw_len = pwp.out.info.min_password_length;
+               policy_min_pw_len = pwp.out.info->min_password_length;
        }
        if (makeshort && policy_min_pw_len) {
                newpass = samr_rand_pass_fixed_len(tctx, policy_min_pw_len - 1);
@@ -766,12 +772,14 @@ static bool test_SetUserPass_25(struct dcerpc_pipe *p, struct torture_context *t
        uint8_t confounder[16];
        char *newpass;
        struct samr_GetUserPwInfo pwp;
+       struct samr_PwInfo info;
        int policy_min_pw_len = 0;
        pwp.in.user_handle = handle;
+       pwp.out.info = &info;
 
        status = dcerpc_samr_GetUserPwInfo(p, tctx, &pwp);
        if (NT_STATUS_IS_OK(status)) {
-               policy_min_pw_len = pwp.out.info.min_password_length;
+               policy_min_pw_len = pwp.out.info->min_password_length;
        }
        newpass = samr_rand_pass(tctx, policy_min_pw_len);
 
@@ -934,10 +942,12 @@ static bool test_GetUserPwInfo(struct dcerpc_pipe *p, struct torture_context *tc
 {
        NTSTATUS status;
        struct samr_GetUserPwInfo r;
+       struct samr_PwInfo info;
 
        torture_comment(tctx, "Testing GetUserPwInfo\n");
 
        r.in.user_handle = handle;
+       r.out.info = &info;
 
        status = dcerpc_samr_GetUserPwInfo(p, tctx, &r);
        torture_assert_ntstatus_ok(tctx, status, "GetUserPwInfo");
@@ -1112,6 +1122,7 @@ static bool test_ChangePasswordUser(struct dcerpc_pipe *p, struct torture_contex
 
        char *newpass;
        struct samr_GetUserPwInfo pwp;
+       struct samr_PwInfo info;
        int policy_min_pw_len = 0;
 
        status = test_OpenUser_byname(p, tctx, handle, acct_name, &user_handle);
@@ -1119,10 +1130,11 @@ static bool test_ChangePasswordUser(struct dcerpc_pipe *p, struct torture_contex
                return false;
        }
        pwp.in.user_handle = &user_handle;
+       pwp.out.info = &info;
 
        status = dcerpc_samr_GetUserPwInfo(p, tctx, &pwp);
        if (NT_STATUS_IS_OK(status)) {
-               policy_min_pw_len = pwp.out.info.min_password_length;
+               policy_min_pw_len = pwp.out.info->min_password_length;
        }
        newpass = samr_rand_pass(tctx, policy_min_pw_len);
 
index 3408a1924cfe82e18868bb9921084c86a0851815..d01334052820beb70cfe583f2ad545d2fd4777ca 100644 (file)
@@ -114,6 +114,7 @@ struct test_join *torture_create_testuser(struct torture_context *torture,
        struct samr_OpenDomain o;
        struct samr_LookupDomain l;
        struct samr_GetUserPwInfo pwp;
+       struct samr_PwInfo info;
        struct samr_SetUserInfo s;
        union samr_UserInfo u;
        struct policy_handle handle;
@@ -224,10 +225,11 @@ again:
        join->user_sid = dom_sid_add_rid(join, join->dom_sid, rid);
 
        pwp.in.user_handle = &join->user_handle;
+       pwp.out.info = &info;
 
        status = dcerpc_samr_GetUserPwInfo(join->p, join, &pwp);
        if (NT_STATUS_IS_OK(status)) {
-               policy_min_pw_len = pwp.out.info.min_password_length;
+               policy_min_pw_len = pwp.out.info->min_password_length;
        }
 
        random_pw = generate_random_str(join, MAX(8, policy_min_pw_len));