summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-09-28 02:58:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:05 -0500
commitf54b3650d6e561213abdeffb56ee45b84ef4d068 (patch)
treece8cae76ff66bdd61be6b880e170dfe6075880af
parent9d9e7d8563537bf61f75c093ae7b50e7749aaba9 (diff)
downloadsamba-f54b3650d6e561213abdeffb56ee45b84ef4d068.tar.gz
samba-f54b3650d6e561213abdeffb56ee45b84ef4d068.tar.bz2
samba-f54b3650d6e561213abdeffb56ee45b84ef4d068.zip
r10564: 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 (This used to be commit 7afe14becbcfa8742740431884f9de92b72ed3e1)
-rw-r--r--source4/torture/rpc/schannel.c4
-rw-r--r--source4/torture/rpc/testjoin.c32
2 files changed, 32 insertions, 4 deletions
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index c10405354e..90f5fb0361 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -159,8 +159,8 @@ static BOOL test_schannel(TALLOC_CTX *mem_ctx,
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);
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index 86cff44084..7c62353f53 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -134,7 +134,7 @@ struct test_join *torture_create_testuser(const char *username,
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 @@ struct test_join *torture_create_testuser(const char *username,
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 test_join *torture_join_domain(const char *machine_name,
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 @@ struct test_join *torture_join_domain(const char *machine_name,
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,