svn commit: samba r4195 - in branches/SAMBA_4_0/source: librpc/idl rpc_server/lsa torture/rpc

tridge at samba.org tridge at samba.org
Tue Dec 14 05:32:51 GMT 2004


Author: tridge
Date: 2004-12-14 05:32:51 +0000 (Tue, 14 Dec 2004)
New Revision: 4195

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

Log:
added IDL, test suite and server side code for lsa_LookupPrivValue




Modified:
   branches/SAMBA_4_0/source/librpc/idl/lsa.idl
   branches/SAMBA_4_0/source/rpc_server/lsa/dcesrv_lsa.c
   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-12-14 05:20:38 UTC (rev 4194)
+++ branches/SAMBA_4_0/source/librpc/idl/lsa.idl	2004-12-14 05:32:51 UTC (rev 4195)
@@ -36,9 +36,13 @@
 	} lsa_String;
 
 	typedef struct {
+		uint32 low;
+		uint32 high;
+	} lsa_LUID;
+	
+	typedef struct {
 		lsa_String name;
-		uint32 luid_low;
-		uint32 luid_high;
+		lsa_LUID luid;
 	} lsa_PrivEntry;
 
 	typedef struct {
@@ -359,11 +363,6 @@
 	/* Function:    0x12                    */
 
 	typedef struct {
-		uint32 low;
-		uint32 high;
-	} lsa_LUID;
-	
-	typedef struct {
 		lsa_LUID luid;
 		uint32 attribute;
 	} lsa_LUIDAttribute;
@@ -540,7 +539,11 @@
 		);
 
 	/* Function:     0x1f */
-	NTSTATUS lsa_LookupPrivValue();
+	NTSTATUS lsa_LookupPrivValue(
+		[in,ref]     policy_handle *handle,
+		[in,ref]     lsa_String *name,
+		[out,ref]    lsa_LUID *luid
+		);
 
 
 	/* Function:      0x20 */

Modified: branches/SAMBA_4_0/source/rpc_server/lsa/dcesrv_lsa.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/lsa/dcesrv_lsa.c	2004-12-14 05:20:38 UTC (rev 4194)
+++ branches/SAMBA_4_0/source/rpc_server/lsa/dcesrv_lsa.c	2004-12-14 05:32:51 UTC (rev 4195)
@@ -122,8 +122,8 @@
 			return NT_STATUS_NO_MEMORY;
 		}
 		e = &r->out.privs->privs[r->out.privs->count];
-		e->luid_low = i;
-		e->luid_high = 0;
+		e->luid.low = i;
+		e->luid.high = 0;
 		e->name.string = privname;
 		r->out.privs->count++;
 		i++;
@@ -821,18 +821,36 @@
 /* 
   lsa_LookupPrivValue
 */
-static NTSTATUS lsa_LookupPrivValue(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-		       struct lsa_LookupPrivValue *r)
+static NTSTATUS lsa_LookupPrivValue(struct dcesrv_call_state *dce_call, 
+				    TALLOC_CTX *mem_ctx,
+				    struct lsa_LookupPrivValue *r)
 {
-	DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+	struct dcesrv_handle *h;
+	struct lsa_policy_state *state;
+	int id;
+
+	DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_POLICY);
+
+	state = h->data;
+
+	id = sec_privilege_id(r->in.name->string);
+	if (id == -1) {
+		return NT_STATUS_NO_SUCH_PRIVILEGE;
+	}
+
+	r->out.luid->low = id;
+	r->out.luid->high = 0;
+
+	return NT_STATUS_OK;	
 }
 
 
 /* 
   lsa_LookupPrivName 
 */
-static NTSTATUS lsa_LookupPrivName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-		       struct lsa_LookupPrivName *r)
+static NTSTATUS lsa_LookupPrivName(struct dcesrv_call_state *dce_call, 
+				   TALLOC_CTX *mem_ctx,
+				   struct lsa_LookupPrivName *r)
 {
 	DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 }

Modified: branches/SAMBA_4_0/source/torture/rpc/lsa.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/lsa.c	2004-12-14 05:20:38 UTC (rev 4194)
+++ branches/SAMBA_4_0/source/torture/rpc/lsa.c	2004-12-14 05:32:51 UTC (rev 4195)
@@ -283,7 +283,7 @@
 	names.count = 0;
 	names.names = NULL;
 
-	sids.num_sids = 1000;
+	sids.num_sids = 100;
 
 	sids.sids = talloc_array_p(mem_ctx, struct lsa_SidPtr, sids.num_sids);
 
@@ -317,6 +317,26 @@
 	return True;
 }
 
+static BOOL test_LookupPrivValue(struct dcerpc_pipe *p, 
+				 TALLOC_CTX *mem_ctx, 
+				 struct policy_handle *handle,
+				 struct lsa_String *name)
+{
+	NTSTATUS status;
+	struct lsa_LookupPrivValue r;
+
+	r.in.handle = handle;
+	r.in.name = name;
+
+	status = dcerpc_lsa_LookupPrivValue(p, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("\nLookupPrivValue failed - %s\n", nt_errstr(status));
+		return False;
+	}
+
+	return True;
+}
+
 static BOOL test_LookupPrivName(struct dcerpc_pipe *p, 
 				TALLOC_CTX *mem_ctx, 
 				struct policy_handle *handle,
@@ -805,7 +825,7 @@
 
 	r.in.handle = handle;
 	r.in.resume_handle = &resume_handle;
-	r.in.max_count = 1000;
+	r.in.max_count = 100;
 	r.out.resume_handle = &resume_handle;
 	r.out.privs = &privs1;
 
@@ -818,6 +838,7 @@
 
 	for (i = 0; i< privs1.count; i++) {
 		test_LookupPrivDisplayName(p, mem_ctx, handle, &privs1.privs[i].name);
+		test_LookupPrivValue(p, mem_ctx, handle, &privs1.privs[i].name);
 		if (!test_EnumAccountsWithUserRight(p, mem_ctx, handle, &privs1.privs[i].name)) {
 			ret = False;
 		}
@@ -842,7 +863,7 @@
 
 	r.in.handle = handle;
 	r.in.resume_handle = &resume_handle;
-	r.in.num_entries = 1000;
+	r.in.num_entries = 100;
 	r.out.domains = &domains;
 	r.out.resume_handle = &resume_handle;
 



More information about the samba-cvs mailing list