[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Fri May 21 10:15:12 MDT 2010


The branch, master has been updated
       via  dd3c367... s4-smbtorture: Fix NetUserPasswordSet2 RAP tests.
       via  94d41dd... s4-smbtorture: fix smbcli_rap_netuserpasswordset2().
       via  032c051... rap: fix rap_NetUserPasswordSet2 IDL.
      from  7c979ad... s3-net: fix net_ads_gpo() for non-ads case.

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


- Log -----------------------------------------------------------------
commit dd3c367153353407f41642b6da4549057cc4c1e7
Author: Günther Deschner <gd at samba.org>
Date:   Fri May 21 18:05:48 2010 +0200

    s4-smbtorture: Fix NetUserPasswordSet2 RAP tests.
    
    Guenther

commit 94d41ddc8f7c97069f0d3c331f65932365c5eb8e
Author: Günther Deschner <gd at samba.org>
Date:   Fri May 21 18:05:10 2010 +0200

    s4-smbtorture: fix smbcli_rap_netuserpasswordset2().
    
    Guenther

commit 032c0515233551bf1d170a8b0a1fe970425d69c5
Author: Günther Deschner <gd at samba.org>
Date:   Fri May 21 18:02:45 2010 +0200

    rap: fix rap_NetUserPasswordSet2 IDL.
    
    Guenther

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

Summary of changes:
 librpc/idl/rap.idl        |    4 ++--
 source4/torture/rap/rap.c |    4 ++--
 source4/torture/rap/sam.c |   45 ++++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 44 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/rap.idl b/librpc/idl/rap.idl
index 8392c27..58afcf4 100644
--- a/librpc/idl/rap.idl
+++ b/librpc/idl/rap.idl
@@ -756,8 +756,8 @@ interface rap
 
 	[public] void rap_NetUserPasswordSet2(
 		[in] astring UserName,
-		[in] [charset(DOS)] uint8 OldPassword[16],
-		[in] [charset(DOS)] uint8 NewPassword[16],
+		[in] uint8 OldPassword[16],
+		[in] uint8 NewPassword[16],
 		[in] uint16 EncryptedPassword,
 		[in] uint16 RealPasswordLength,
 		[out] rap_status status,
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index e0c9277..4468545 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -1602,11 +1602,11 @@ NTSTATUS smbcli_rap_netuserpasswordset2(struct smbcli_tree *tree,
 	rap_cli_push_paramdesc(call, 'b');
 	rap_cli_push_paramdesc(call, '1');
 	rap_cli_push_paramdesc(call, '6');
-	ndr_push_charset(call->ndr_push_param, NDR_SCALARS, r->in.OldPassword, 16, sizeof(uint8_t), CH_DOS);
+	ndr_push_array_uint8(call->ndr_push_param, NDR_SCALARS, r->in.OldPassword, 16);
 	rap_cli_push_paramdesc(call, 'b');
 	rap_cli_push_paramdesc(call, '1');
 	rap_cli_push_paramdesc(call, '6');
-	ndr_push_charset(call->ndr_push_param, NDR_SCALARS, r->in.NewPassword, 16, sizeof(uint8_t), CH_DOS);
+	ndr_push_array_uint8(call->ndr_push_param, NDR_SCALARS, r->in.NewPassword, 16);
 	rap_cli_push_word(call, r->in.EncryptedPassword);
 	rap_cli_push_word(call, r->in.RealPasswordLength);
 
diff --git a/source4/torture/rap/sam.c b/source4/torture/rap/sam.c
index d99c348..0149322 100644
--- a/source4/torture/rap/sam.c
+++ b/source4/torture/rap/sam.c
@@ -49,11 +49,45 @@ static bool test_userpasswordset2_args(struct torture_context *tctx,
 	struct rap_NetUserPasswordSet2 r;
 	char *newpass = samr_rand_pass(tctx, 8);
 
+	ZERO_STRUCT(r);
+
 	r.in.UserName = username;
-	r.in.OldPassword = *password;
-	r.in.NewPassword = newpass;
+
+	memcpy(r.in.OldPassword, *password, MIN(strlen(*password), 16));
+	memcpy(r.in.NewPassword, newpass, MIN(strlen(newpass), 16));
 	r.in.EncryptedPassword = 0;
-	r.in.RealPasswordLength = strlen(r.in.NewPassword);
+	r.in.RealPasswordLength = strlen(newpass);
+
+	torture_comment(tctx, "Testing rap_NetUserPasswordSet2(%s)\n", r.in.UserName);
+
+	torture_assert_ntstatus_ok(tctx,
+		smbcli_rap_netuserpasswordset2(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r),
+		"smbcli_rap_netuserpasswordset2 failed");
+	if (!W_ERROR_IS_OK(W_ERROR(r.out.status))) {
+		torture_warning(tctx, "RAP NetUserPasswordSet2 gave: %s\n",
+			win_errstr(W_ERROR(r.out.status)));
+	} else {
+		*password = newpass;
+	}
+
+	return true;
+}
+
+static bool test_userpasswordset2_crypt_args(struct torture_context *tctx,
+					     struct smbcli_state *cli,
+					     const char *username,
+					     const char **password)
+{
+	struct rap_NetUserPasswordSet2 r;
+	char *newpass = samr_rand_pass(tctx, 8);
+
+	r.in.UserName = username;
+
+	E_deshash(*password, r.in.OldPassword);
+	E_deshash(newpass, r.in.NewPassword);
+
+	r.in.RealPasswordLength = strlen(newpass);
+	r.in.EncryptedPassword = 1;
 
 	torture_comment(tctx, "Testing rap_NetUserPasswordSet2(%s)\n", r.in.UserName);
 
@@ -75,7 +109,7 @@ static bool test_userpasswordset2(struct torture_context *tctx,
 {
 	struct test_join *join_ctx;
 	const char *password;
-	bool ret;
+	bool ret = true;
 
 	join_ctx = torture_create_testuser_max_pwlen(tctx, TEST_RAP_USER,
 						     torture_setting_string(tctx, "workgroup", NULL),
@@ -85,7 +119,8 @@ static bool test_userpasswordset2(struct torture_context *tctx,
 		torture_fail(tctx, "failed to create user\n");
 	}
 
-	ret = test_userpasswordset2_args(tctx, cli, TEST_RAP_USER, &password);
+	ret &= test_userpasswordset2_args(tctx, cli, TEST_RAP_USER, &password);
+	ret &= test_userpasswordset2_crypt_args(tctx, cli, TEST_RAP_USER, &password);
 
 	torture_leave_domain(tctx, join_ctx);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list