summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-11-22 11:59:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:04 -0500
commitb6b61cec790e19862a600b023327d72dd33b3cb4 (patch)
tree93b1cad84ea4092692da82841d8218aa3fc16928 /source4/torture
parentca751e2638ca0fbb03b54e1aaa4ed1316e903947 (diff)
downloadsamba-b6b61cec790e19862a600b023327d72dd33b3cb4.tar.gz
samba-b6b61cec790e19862a600b023327d72dd33b3cb4.tar.bz2
samba-b6b61cec790e19862a600b023327d72dd33b3cb4.zip
r3907: * Rename lsa_Name to lsa_String
* Add new IDL to LSA, to query information about trusted domains (for cross-check with SamSync). Andrew Bartlett (This used to be commit 174c0778421b5154ff2ba809688ea6ef38a1478b)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/lsa.c41
-rw-r--r--source4/torture/rpc/samsync.c22
2 files changed, 48 insertions, 15 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 703df40654..a0b4e816bb 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -22,9 +22,9 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_lsa.h"
-static void init_lsa_Name(struct lsa_Name *name, const char *s)
+static void init_lsa_String(struct lsa_String *name, const char *s)
{
- name->name = s;
+ name->string = s;
}
static BOOL test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
@@ -108,7 +108,7 @@ static BOOL test_LookupNames(struct dcerpc_pipe *p,
{
struct lsa_LookupNames r;
struct lsa_TransSidArray sids;
- struct lsa_Name *names;
+ struct lsa_String *names;
uint32_t count = 0;
NTSTATUS status;
int i;
@@ -120,7 +120,7 @@ static BOOL test_LookupNames(struct dcerpc_pipe *p,
names = talloc(mem_ctx, tnames->count * sizeof(names[0]));
for (i=0;i<tnames->count;i++) {
- init_lsa_Name(&names[i], tnames->names[i].name.name);
+ init_lsa_String(&names[i], tnames->names[i].name.string);
}
r.in.handle = handle;
@@ -350,7 +350,7 @@ static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p,
domsid = dom_sid_parse_talloc(mem_ctx, "S-1-5-21-97398-379795-12345");
trustinfo.sid = domsid;
- init_lsa_Name(&trustinfo.name, "torturedomain");
+ init_lsa_String(&trustinfo.name, "torturedomain");
r.in.handle = handle;
r.in.info = &trustinfo;
@@ -396,7 +396,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p,
asprintf(&secname, "torturesecret-%u", (uint_t)random());
- init_lsa_Name(&r.in.name, secname);
+ init_lsa_String(&r.in.name, secname);
r.in.handle = handle;
r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
@@ -640,7 +640,7 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p,
static BOOL test_LookupPrivDisplayName(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
- struct lsa_Name *priv_name)
+ struct lsa_String *priv_name)
{
struct lsa_LookupPrivDisplayName r;
NTSTATUS status;
@@ -648,7 +648,7 @@ static BOOL test_LookupPrivDisplayName(struct dcerpc_pipe *p,
terminals */
uint16 language_id = (random() % 4) + 0x409;
- printf("testing LookupPrivDisplayName(%s)\n", priv_name->name);
+ printf("testing LookupPrivDisplayName(%s)\n", priv_name->string);
r.in.handle = handle;
r.in.name = priv_name;
@@ -662,7 +662,7 @@ static BOOL test_LookupPrivDisplayName(struct dcerpc_pipe *p,
return False;
}
printf("%s -> \"%s\" (language 0x%x/0x%x)\n",
- priv_name->name, r.out.disp_name->name,
+ priv_name->string, r.out.disp_name->string,
*r.in.language_id, *r.out.language_id);
return True;
@@ -671,7 +671,7 @@ static BOOL test_LookupPrivDisplayName(struct dcerpc_pipe *p,
static BOOL test_EnumAccountsWithUserRight(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
- struct lsa_Name *priv_name)
+ struct lsa_String *priv_name)
{
struct lsa_EnumAccountsWithUserRight r;
struct lsa_SidArray sids;
@@ -679,7 +679,7 @@ static BOOL test_EnumAccountsWithUserRight(struct dcerpc_pipe *p,
ZERO_STRUCT(sids);
- printf("testing EnumAccountsWithUserRight(%s)\n", priv_name->name);
+ printf("testing EnumAccountsWithUserRight(%s)\n", priv_name->string);
r.in.handle = handle;
r.in.name = priv_name;
@@ -746,7 +746,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p,
NTSTATUS status;
uint32_t resume_handle = 0;
struct lsa_DomainList domains;
- int i;
+ int i,j;
BOOL ret = True;
printf("\nTesting EnumTrustDom\n");
@@ -777,6 +777,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p,
struct policy_handle trust_handle;
struct policy_handle handle2;
struct lsa_Close c;
+ int levels [] = {1, 3, 6};
trust.in.handle = handle;
trust.in.sid = domains.domains[i].sid;
@@ -793,6 +794,20 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p,
c.in.handle = &trust_handle;
c.out.handle = &handle2;
+ for (j=1; j < ARRAY_SIZE(levels); j++) {
+ struct lsa_QueryInfoTrustedDomain q;
+ union lsa_TrustedDomainInfo info;
+ q.in.trustdom_handle = &trust_handle;
+ q.in.level = levels[j];
+ q.out.info = &info;
+ status = dcerpc_lsa_QueryInfoTrustedDomain(p, mem_ctx, &q);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("QueryInfoTrustedDomain level %d failed - %s\n",
+ j, nt_errstr(status));
+ ret = False;
+ }
+ }
+
status = dcerpc_lsa_Close(p, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
printf("Close of trusted doman failed - %s\n", nt_errstr(status));
@@ -813,7 +828,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p,
c.in.handle = &trust_handle;
c.out.handle = &handle2;
-
+
status = dcerpc_lsa_Close(p, mem_ctx, &c);
if (!NT_STATUS_IS_OK(status)) {
printf("Close of trusted doman failed - %s\n", nt_errstr(status));
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 59508bf1fe..20d63a351a 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -706,7 +706,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam
o.in.handle = samsync_state->lsa_handle;
o.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
- o.in.name.name = name;
+ o.in.name.string = name;
o.out.sec_handle = &sec_handle;
status = dcerpc_lsa_OpenSecret(samsync_state->p_lsa, mem_ctx, &o);
@@ -781,6 +781,10 @@ static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st
struct samsync_trusted_domain *new = talloc_p(samsync_state, struct samsync_trusted_domain);
struct lsa_OpenTrustedDomain t;
struct policy_handle trustdom_handle;
+ struct lsa_QueryInfoTrustedDomain q;
+ union lsa_TrustedDomainInfo info[4];
+ int levels [] = {1, 3};
+ int i;
new->name = talloc_reference(new, trusted_domain->domain_name.string);
new->sid = talloc_reference(new, dom_sid);
@@ -795,7 +799,21 @@ static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st
printf("OpenTrustedDomain failed - %s\n", nt_errstr(status));
return False;
}
+
+ for (i=0; i< ARRAY_SIZE(levels); i++) {
+ q.in.trustdom_handle = &trustdom_handle;
+ q.in.level = levels[i];
+ q.out.info = &info[levels[i]];
+ status = dcerpc_lsa_QueryInfoTrustedDomain(samsync_state->p_lsa, mem_ctx, &q);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("QueryInfoTrustedDomain level %d failed - %s\n",
+ levels[i], nt_errstr(status));
+ return False;
+ }
+ }
+ TEST_STRING_EQUAL(info[1].info1.domain_name, trusted_domain->domain_name);
+ TEST_INT_EQUAL(info[3].info3.flags, trusted_domain->flags);
TEST_SEC_DESC_EQUAL(trusted_domain->sdbuf, lsa, &trustdom_handle);
DLIST_ADD(samsync_state->trusted_domains, new);
@@ -868,7 +886,7 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa
return False;
}
for (j=0;j<account->privilege_entries; j++) {
- if (strcmp(r.out.name->name, account->privilege_name[j].string) == 0) {
+ if (strcmp(r.out.name->string, account->privilege_name[j].string) == 0) {
found_priv_in_lsa[j] = True;
break;
}