svn commit: samba r10564 - in
branches/SAMBA_4_0/source/torture/rpc: .
abartlet at samba.org
abartlet at samba.org
Wed Sep 28 02:58:53 GMT 2005
Author: abartlet
Date: 2005-09-28 02:58:53 +0000 (Wed, 28 Sep 2005)
New Revision: 10564
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10564
Log:
Make the RPC-SCHANNEL test use the libnet_join code via torture_join_domain
Handle error cases in torture_create_testuser, where we can't connect
to the target server (we were segfaulting due to an untested error
path).
Andrew Bartlett
Modified:
branches/SAMBA_4_0/source/torture/rpc/schannel.c
branches/SAMBA_4_0/source/torture/rpc/testjoin.c
Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/schannel.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/schannel.c 2005-09-28 02:37:03 UTC (rev 10563)
+++ branches/SAMBA_4_0/source/torture/rpc/schannel.c 2005-09-28 02:58:53 UTC (rev 10564)
@@ -159,8 +159,8 @@
TALLOC_CTX *test_ctx = talloc_named(mem_ctx, 0, "test_schannel context");
char *test_machine_account = talloc_asprintf(NULL, "%s$", TEST_MACHINE_NAME);
- join_ctx = torture_create_testuser(test_machine_account, lp_workgroup(),
- acct_flags, &machine_password);
+ join_ctx = torture_join_domain(TEST_MACHINE_NAME,
+ acct_flags, &machine_password);
if (!join_ctx) {
printf("Failed to join domain with acct_flags=0x%x\n", acct_flags);
talloc_free(test_ctx);
Modified: branches/SAMBA_4_0/source/torture/rpc/testjoin.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/testjoin.c 2005-09-28 02:37:03 UTC (rev 10563)
+++ branches/SAMBA_4_0/source/torture/rpc/testjoin.c 2005-09-28 02:58:53 UTC (rev 10564)
@@ -134,7 +134,7 @@
DCERPC_SAMR_UUID,
DCERPC_SAMR_VERSION);
if (!NT_STATUS_IS_OK(status)) {
- goto failed;
+ return NULL;
}
c.in.system_name = NULL;
@@ -148,7 +148,7 @@
errstr = dcerpc_errstr(join, join->p->last_fault_code);
}
printf("samr_Connect failed - %s\n", errstr);
- goto failed;
+ return NULL;
}
printf("Opening domain %s\n", domain);
@@ -284,6 +284,10 @@
struct libnet_context *libnet_ctx;
struct libnet_JoinDomain *libnet_r;
struct test_join *tj;
+ struct samr_SetUserInfo s;
+ union samr_UserInfo u;
+ struct lsa_String comment;
+ struct lsa_String full_name;
tj = talloc(NULL, struct test_join);
if (!tj) return NULL;
@@ -325,6 +329,30 @@
tj->dom_sid = dom_sid_string(tj, libnet_r->out.domain_sid);
*machine_password = libnet_r->out.join_password;
+ ZERO_STRUCT(u);
+ s.in.user_handle = &tj->user_handle;
+ s.in.info = &u;
+ s.in.level = 21;
+
+ u.info21.fields_present = SAMR_FIELD_DESCRIPTION | SAMR_FIELD_COMMENT | SAMR_FIELD_FULL_NAME;
+ comment.string = talloc_asprintf(tj,
+ "Tortured by Samba4: %s",
+ timestring(tj, time(NULL)));
+ u.info21.comment = comment;
+ full_name.string = talloc_asprintf(tj,
+ "Torture account for Samba4: %s",
+ timestring(tj, time(NULL)));
+ u.info21.full_name = full_name;
+
+ u.info21.description.string = talloc_asprintf(tj,
+ "Samba4 torture account created by host %s: %s",
+ lp_netbios_name(), timestring(tj, time(NULL)));
+
+ status = dcerpc_samr_SetUserInfo(tj->p, tj, &s);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SetUserInfo (non-critical) failed - %s\n", nt_errstr(status));
+ }
+
DEBUG(0, ("%s joined domain %s (%s).\n",
libnet_r->in.netbios_name,
libnet_r->out.domain_name,
More information about the samba-cvs
mailing list