summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-10-21 01:20:53 +0200
committerGünther Deschner <gd@samba.org>2008-10-27 19:33:22 +0100
commit6a2dabe1a7faae47dce359b77d886a9489b66fcb (patch)
tree5da6140b3215b205d78fa0e47b7ce38ae1ab4449 /source4/torture
parent6131c0d8888c8bc1923794b9b93c1cb44bb071e3 (diff)
downloadsamba-6a2dabe1a7faae47dce359b77d886a9489b66fcb.tar.gz
samba-6a2dabe1a7faae47dce359b77d886a9489b66fcb.tar.bz2
samba-6a2dabe1a7faae47dce359b77d886a9489b66fcb.zip
s4-lsa: merge lsa_GetUserName from s3 lsa idl.
Guenther
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/lsa.c23
-rw-r--r--source4/torture/rpc/object_uuid.c8
-rw-r--r--source4/torture/rpc/samba3rpc.c13
-rw-r--r--source4/torture/rpc/schannel.c21
4 files changed, 43 insertions, 22 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 8ac337c740..d299176285 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -2446,14 +2446,27 @@ static bool test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
struct lsa_GetUserName r;
NTSTATUS status;
bool ret = true;
- struct lsa_StringPointer authority_name_p;
+ struct lsa_String *authority_name_p = NULL;
+ struct lsa_String *account_name_p = NULL;
printf("\nTesting GetUserName\n");
- r.in.system_name = "\\";
- r.in.account_name = NULL;
- r.in.authority_name = &authority_name_p;
- authority_name_p.string = NULL;
+ r.in.system_name = "\\";
+ r.in.account_name = &account_name_p;
+ r.in.authority_name = NULL;
+ r.out.account_name = &account_name_p;
+
+ status = dcerpc_lsa_GetUserName(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("GetUserName failed - %s\n", nt_errstr(status));
+ ret = false;
+ }
+
+ account_name_p = NULL;
+ r.in.account_name = &account_name_p;
+ r.in.authority_name = &authority_name_p;
+ r.out.account_name = &account_name_p;
status = dcerpc_lsa_GetUserName(p, mem_ctx, &r);
diff --git a/source4/torture/rpc/object_uuid.c b/source4/torture/rpc/object_uuid.c
index 5a77bd1c29..69905169af 100644
--- a/source4/torture/rpc/object_uuid.c
+++ b/source4/torture/rpc/object_uuid.c
@@ -39,7 +39,8 @@ static bool test_random_uuid(struct torture_context *torture)
struct GUID uuid;
struct dssetup_DsRoleGetPrimaryDomainInformation r1;
struct lsa_GetUserName r2;
- struct lsa_StringPointer authority_name_p;
+ struct lsa_String *authority_name_p = NULL;
+ struct lsa_String *account_name_p = NULL;
torture_comment(torture, "RPC-OBJECTUUID-RANDOM\n");
@@ -63,9 +64,10 @@ static bool test_random_uuid(struct torture_context *torture)
uuid = GUID_random();
r2.in.system_name = "\\";
- r2.in.account_name = NULL;
+ r2.in.account_name = &account_name_p;
r2.in.authority_name = &authority_name_p;
- authority_name_p.string = NULL;
+ r2.out.account_name = &account_name_p;
+ r2.out.authority_name = &authority_name_p;
req = dcerpc_ndr_request_send(p2, &uuid,
&ndr_table_lsarpc,
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 85714ace13..25cbb6727d 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -1583,7 +1583,8 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *lsa;
struct lsa_GetUserName r;
NTSTATUS status;
- struct lsa_StringPointer authority_name_p;
+ struct lsa_String *authority_name_p = NULL;
+ struct lsa_String *account_name_p = NULL;
struct dom_sid *result;
status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\lsarpc",
@@ -1595,12 +1596,14 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx,
}
r.in.system_name = "\\";
- r.in.account_name = NULL;
- authority_name_p.string = NULL;
+ r.in.account_name = &account_name_p;
r.in.authority_name = &authority_name_p;
+ r.out.account_name = &account_name_p;
status = dcerpc_lsa_GetUserName(lsa, mem_ctx, &r);
+ authority_name_p = *r.out.authority_name;
+
if (!NT_STATUS_IS_OK(status)) {
printf("(%s) GetUserName failed - %s\n",
__location__, nt_errstr(status));
@@ -1608,8 +1611,8 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx,
return NULL;
}
- result = name2sid(mem_ctx, lsa, r.out.account_name->string,
- r.out.authority_name->string->string);
+ result = name2sid(mem_ctx, lsa, account_name_p->string,
+ authority_name_p->string);
talloc_free(lsa);
return result;
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 15d40a2e17..a8aa046280 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -182,18 +182,21 @@ static bool test_lsa_ops(struct torture_context *tctx, struct dcerpc_pipe *p)
struct lsa_GetUserName r;
NTSTATUS status;
bool ret = true;
- struct lsa_StringPointer authority_name_p;
+ struct lsa_String *account_name_p = NULL;
+ struct lsa_String *authority_name_p = NULL;
printf("\nTesting GetUserName\n");
r.in.system_name = "\\";
- r.in.account_name = NULL;
+ r.in.account_name = &account_name_p;
r.in.authority_name = &authority_name_p;
- authority_name_p.string = NULL;
+ r.out.account_name = &account_name_p;
/* do several ops to test credential chaining and various operations */
status = dcerpc_lsa_GetUserName(p, tctx, &r);
-
+
+ authority_name_p = *r.out.authority_name;
+
if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) {
printf("not considering %s to be an error\n", nt_errstr(status));
} else if (!NT_STATUS_IS_OK(status)) {
@@ -204,18 +207,18 @@ static bool test_lsa_ops(struct torture_context *tctx, struct dcerpc_pipe *p)
return false;
}
- if (strcmp(r.out.account_name->string, "ANONYMOUS LOGON") != 0) {
+ if (strcmp(account_name_p->string, "ANONYMOUS LOGON") != 0) {
printf("GetUserName returned wrong user: %s, expected %s\n",
- r.out.account_name->string, "ANONYMOUS LOGON");
+ account_name_p->string, "ANONYMOUS LOGON");
return false;
}
- if (!r.out.authority_name || !r.out.authority_name->string) {
+ if (!authority_name_p || !authority_name_p->string) {
return false;
}
- if (strcmp(r.out.authority_name->string->string, "NT AUTHORITY") != 0) {
+ if (strcmp(authority_name_p->string, "NT AUTHORITY") != 0) {
printf("GetUserName returned wrong user: %s, expected %s\n",
- r.out.authority_name->string->string, "NT AUTHORITY");
+ authority_name_p->string, "NT AUTHORITY");
return false;
}
}