svn commit: samba r3978 - in branches/SAMBA_4_0/source: librpc/idl torture/rpc

tridge at samba.org tridge at samba.org
Fri Nov 26 06:33:38 GMT 2004


Author: tridge
Date: 2004-11-26 06:33:38 +0000 (Fri, 26 Nov 2004)
New Revision: 3978

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3978

Log:
added IDL and test code for lsa_LookupSids2() and lsa_LookupNames2()

Modified:
   branches/SAMBA_4_0/source/librpc/idl/lsa.idl
   branches/SAMBA_4_0/source/torture/rpc/lsa.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/lsa.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/lsa.idl	2004-11-26 05:58:03 UTC (rev 3977)
+++ branches/SAMBA_4_0/source/librpc/idl/lsa.idl	2004-11-26 06:33:38 UTC (rev 3978)
@@ -652,6 +652,7 @@
 	/* Function 0x2f */
 	NTSTATUS lsa_SetInfoPolicy2();
 
+	/**********************/
 	/* Function 0x30 */
 	NTSTATUS lsa_QueryTrustedDomainInfoByName(
 		[in,ref]               policy_handle         *handle,
@@ -678,6 +679,7 @@
 	/* Function 0x36 */
 	NTSTATUS lsa_SetDomInfoPolicy();
 
+	/**********************/
 	/* Function 0x37 */
 	NTSTATUS lsa_OpenTrustedDomainByName(
 		[in,ref]     policy_handle *handle,
@@ -689,12 +691,59 @@
 	/* Function 0x38 */
 	NTSTATUS lsa_TestCall();
 
+	/**********************/
 	/* Function 0x39 */
-	NTSTATUS lsa_LookupSids2();
 
+	typedef struct {
+		uint16 sid_type;
+		lsa_String name;
+		uint32 sid_index;
+		uint32 unknown;
+	} lsa_TranslatedName2;
+
+	typedef struct {
+		[range(0,1000)] uint32 count;
+		[size_is(count)] lsa_TranslatedName2 *names;
+	} lsa_TransNameArray2;
+
+	NTSTATUS lsa_LookupSids2(
+		[in,ref]     policy_handle *handle,
+		[in,ref]     lsa_SidArray *sids,
+		[out]        lsa_RefDomainList *domains,
+		[in,out,ref] lsa_TransNameArray2 *names,
+		[in]         uint16 level,
+		[in,out,ref] uint32 *count,
+		[in]         uint32 unknown1,
+		[in]         uint32 unknown2
+		);
+
+	/**********************/
 	/* Function 0x3a */
-	NTSTATUS lsa_LookupNames2();
 
+	typedef struct {
+		uint16 sid_type;
+		uint32 rid;
+		uint32 sid_index;
+		uint32 unknown;
+	} lsa_TranslatedSid2;
+
+	typedef struct {
+		[range(0,1000)] uint32 count;
+		[size_is(count)] lsa_TranslatedSid2 *sids;
+	} lsa_TransSidArray2;
+
+	NTSTATUS lsa_LookupNames2 (
+		[in,ref]     policy_handle *handle,
+		[in,range(0,1000)] uint32 num_names,
+		[in,ref,size_is(num_names)]  lsa_String *names,
+		[out]        lsa_RefDomainList *domains,
+		[in,out,ref] lsa_TransSidArray2 *sids,
+		[in]         uint16 level,
+		[in,out,ref] uint32 *count,
+		[in]         uint32 unknown1,
+		[in]         uint32 unknown2
+		);
+
 	/* Function 0x3b */
 	NTSTATUS lsa_CreateTrustedDomainEx2();
 }

Modified: branches/SAMBA_4_0/source/torture/rpc/lsa.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/lsa.c	2004-11-26 05:58:03 UTC (rev 3977)
+++ branches/SAMBA_4_0/source/torture/rpc/lsa.c	2004-11-26 06:33:38 UTC (rev 3978)
@@ -143,7 +143,51 @@
 	return True;
 }
 
+static BOOL test_LookupNames2(struct dcerpc_pipe *p, 
+			      TALLOC_CTX *mem_ctx, 
+			      struct policy_handle *handle,
+			      struct lsa_TransNameArray2 *tnames)
+{
+	struct lsa_LookupNames2 r;
+	struct lsa_TransSidArray2 sids;
+	struct lsa_String *names;
+	uint32_t count = 0;
+	NTSTATUS status;
+	int i;
 
+	printf("\nTesting LookupNames2 with %d names\n", tnames->count);
+
+	sids.count = 0;
+	sids.sids = NULL;
+
+	names = talloc(mem_ctx, tnames->count * sizeof(names[0]));
+	for (i=0;i<tnames->count;i++) {
+		init_lsa_String(&names[i], tnames->names[i].name.string);
+	}
+
+	r.in.handle = handle;
+	r.in.num_names = tnames->count;
+	r.in.names = names;
+	r.in.sids = &sids;
+	r.in.level = 1;
+	r.in.count = &count;
+	r.in.unknown1 = 0;
+	r.in.unknown2 = 0;
+	r.out.count = &count;
+	r.out.sids = &sids;
+
+	status = dcerpc_lsa_LookupNames2(p, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
+		printf("LookupNames2 failed - %s\n", nt_errstr(status));
+		return False;
+	}
+
+	printf("\n");
+
+	return True;
+}
+
+
 static BOOL test_LookupSids(struct dcerpc_pipe *p, 
 			    TALLOC_CTX *mem_ctx, 
 			    struct policy_handle *handle,
@@ -182,6 +226,47 @@
 	return True;
 }
 
+
+static BOOL test_LookupSids2(struct dcerpc_pipe *p, 
+			    TALLOC_CTX *mem_ctx, 
+			    struct policy_handle *handle,
+			    struct lsa_SidArray *sids)
+{
+	struct lsa_LookupSids2 r;
+	struct lsa_TransNameArray2 names;
+	uint32_t count = sids->num_sids;
+	NTSTATUS status;
+
+	printf("\nTesting LookupSids2\n");
+
+	names.count = 0;
+	names.names = NULL;
+
+	r.in.handle = handle;
+	r.in.sids = sids;
+	r.in.names = &names;
+	r.in.level = 1;
+	r.in.count = &count;
+	r.in.unknown1 = 0;
+	r.in.unknown2 = 0;
+	r.out.count = &count;
+	r.out.names = &names;
+
+	status = dcerpc_lsa_LookupSids2(p, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
+		printf("LookupSids2 failed - %s\n", nt_errstr(status));
+		return False;
+	}
+
+	printf("\n");
+
+	if (!test_LookupNames2(p, mem_ctx, handle, &names)) {
+		return False;
+	}
+
+	return True;
+}
+
 static BOOL test_many_LookupSids(struct dcerpc_pipe *p, 
 				 TALLOC_CTX *mem_ctx, 
 				 struct policy_handle *handle)
@@ -607,6 +692,10 @@
 		return False;
 	}
 
+	if (!test_LookupSids2(p, mem_ctx, handle, &sids1)) {
+		return False;
+	}
+
 	printf("testing all accounts\n");
 	for (i=0;i<sids1.num_sids;i++) {
 		test_OpenAccount(p, mem_ctx, handle, sids1.sids[i].sid);



More information about the samba-cvs mailing list