svn commit: samba r15507 - in branches/SAMBA_4_0/source: rpc_server/unixinfo torture/rpc

metze at samba.org metze at samba.org
Sun May 7 21:56:27 GMT 2006


Author: metze
Date: 2006-05-07 21:56:26 +0000 (Sun, 07 May 2006)
New Revision: 15507

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

Log:
if we change the idl, we need to change the calling code too:-)

is it possible to run the RPC-UNIXINFO test in samba4's make test?

metze
Modified:
   branches/SAMBA_4_0/source/rpc_server/unixinfo/dcesrv_unixinfo.c
   branches/SAMBA_4_0/source/torture/rpc/unixinfo.c


Changeset:
Modified: branches/SAMBA_4_0/source/rpc_server/unixinfo/dcesrv_unixinfo.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/unixinfo/dcesrv_unixinfo.c	2006-05-07 21:48:01 UTC (rev 15506)
+++ branches/SAMBA_4_0/source/rpc_server/unixinfo/dcesrv_unixinfo.c	2006-05-07 21:56:26 UTC (rev 15507)
@@ -34,6 +34,7 @@
 				  TALLOC_CTX *mem_ctx,
 				  struct unixinfo_SidToUid *r)
 {
+	NTSTATUS status;
 	struct sidmap_context *sidmap;
 	uid_t uid;
 
@@ -43,13 +44,11 @@
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	r->out.result = sidmap_sid_to_unixuid(sidmap, &r->in.sid, &uid);
+	status = sidmap_sid_to_unixuid(sidmap, &r->in.sid, &uid);
+	NT_STATUS_NOT_OK_RETURN(status);
 
-	if (NT_STATUS_IS_OK(r->out.result)) {
-		r->out.uid = uid;
-	}
-
-	return r->out.result;
+	*r->out.uid = uid;
+	return NT_STATUS_OK;
 }
 
 static NTSTATUS unixinfo_UidToSid(struct dcesrv_call_state *dce_call,
@@ -72,15 +71,14 @@
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
-	r->out.sid = NULL;
-	r->out.result = sidmap_uid_to_sid(sidmap, mem_ctx, uid, &r->out.sid);
-	return r->out.result;
+	return sidmap_uid_to_sid(sidmap, mem_ctx, uid, &r->out.sid);
 }
 
 static NTSTATUS unixinfo_SidToGid(struct dcesrv_call_state *dce_call,
 				  TALLOC_CTX *mem_ctx,
 				  struct unixinfo_SidToGid *r)
 {
+	NTSTATUS status;
 	struct sidmap_context *sidmap;
 	gid_t gid;
 
@@ -90,13 +88,11 @@
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	r->out.result = sidmap_sid_to_unixgid(sidmap, &r->in.sid, &gid);
+	status = sidmap_sid_to_unixgid(sidmap, &r->in.sid, &gid);
+	NT_STATUS_NOT_OK_RETURN(status);
 
-	if (NT_STATUS_IS_OK(r->out.result)) {
-		r->out.gid = gid;
-	}
-
-	return r->out.result;
+	*r->out.gid = gid;
+	return NT_STATUS_OK;
 }
 
 static NTSTATUS unixinfo_GidToSid(struct dcesrv_call_state *dce_call,
@@ -119,9 +115,7 @@
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
-	r->out.sid = NULL;
-	r->out.result = sidmap_gid_to_sid(sidmap, mem_ctx, gid, &r->out.sid);
-	return r->out.result;
+	return sidmap_gid_to_sid(sidmap, mem_ctx, gid, &r->out.sid);
 }
 
 static NTSTATUS unixinfo_GetPWUid(struct dcesrv_call_state *dce_call,
@@ -130,17 +124,14 @@
 {
 	int i;
 
+	*r->out.count = 0;
+
 	r->out.infos = talloc_zero_array(mem_ctx, struct unixinfo_GetPWUidInfo,
-					 r->in.count);
-	if (r->out.infos == NULL) {
-		DEBUG(0, ("talloc failed\n"));
-		return NT_STATUS_NO_MEMORY;
-	}
+					 *r->in.count);
+	NT_STATUS_HAVE_NO_MEMORY(r->out.infos);
+	*r->out.count = *r->in.count;
 
-	r->out.result = NT_STATUS_OK;
-	r->out.count = r->in.count;
-
-	for (i=0; i<r->in.count; i++) {
+	for (i=0; i < *r->in.count; i++) {
 		uid_t uid;
 		struct passwd *pwd;
 

Modified: branches/SAMBA_4_0/source/torture/rpc/unixinfo.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/unixinfo.c	2006-05-07 21:48:01 UTC (rev 15506)
+++ branches/SAMBA_4_0/source/torture/rpc/unixinfo.c	2006-05-07 21:56:26 UTC (rev 15507)
@@ -47,8 +47,8 @@
 static BOOL test_getpwuid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {
 	uint64_t uids[512];
-	const int num_uids = sizeof(uids)/sizeof(uids[0]);
-	int i;
+	uint32_t num_uids = ARRAY_SIZE(uids);
+	uint32_t i;
 	struct unixinfo_GetPWUid r;
 	NTSTATUS result;
 
@@ -56,7 +56,7 @@
 		uids[i] = i;
 	}
 	
-	r.in.count = num_uids;
+	r.in.count = &num_uids;
 	r.in.uids = uids;
 
 	result = dcerpc_unixinfo_GetPWUid(p, mem_ctx, &r);



More information about the samba-cvs mailing list