r18392: add sidtouid and sidtogid tests to RPC-UNIXINFO
authorStefan Metzmacher <metze@samba.org>
Mon, 11 Sep 2006 16:54:54 +0000 (16:54 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:18:23 +0000 (14:18 -0500)
metze
(This used to be commit f1708fd9434ee2a9ae25e9d912f0c350d8e1a256)

source4/torture/rpc/unixinfo.c

index ea34c55ada3077b49f8a8405dffdf8054f4931e6..4bf27b916bcbd5775f15ba438b071e1a16fbf988 100644 (file)
 #include "torture/torture.h"
 #include "torture/rpc/rpc.h"
 #include "librpc/gen_ndr/ndr_unixinfo_c.h"
+#include "libcli/security/security.h"
 
 
+/*
+  test the SidToUid interface
+*/
+static BOOL test_sidtouid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+       NTSTATUS status;
+       struct unixinfo_SidToUid r;
+       struct dom_sid *sid;
+       
+       sid = dom_sid_parse_talloc(mem_ctx, "S-1-5-32-1234-5432");
+       r.in.sid = *sid;
+
+       status = dcerpc_unixinfo_SidToUid(p, mem_ctx, &r);
+       if (NT_STATUS_EQUAL(NT_STATUS_NONE_MAPPED, status)) {
+       } else if (!NT_STATUS_IS_OK(status)) {
+               printf("UidToSid failed == %s\n", nt_errstr(status));
+               return False;
+       }
+
+       return True;
+}
+
 /*
   test the UidToSid interface
 */
@@ -67,6 +90,28 @@ static BOOL test_getpwuid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
        return NT_STATUS_IS_OK(result);
 }
 
+/*
+  test the SidToGid interface
+*/
+static BOOL test_sidtogid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+       NTSTATUS status;
+       struct unixinfo_SidToGid r;
+       struct dom_sid *sid;
+       
+       sid = dom_sid_parse_talloc(mem_ctx, "S-1-5-32-1234-5432");
+       r.in.sid = *sid;
+
+       status = dcerpc_unixinfo_SidToGid(p, mem_ctx, &r);
+       if (NT_STATUS_EQUAL(NT_STATUS_NONE_MAPPED, status)) {
+       } else if (!NT_STATUS_IS_OK(status)) {
+               printf("SidToGid failed == %s\n", nt_errstr(status));
+               return False;
+       }
+
+       return True;
+}
+
 /*
   test the GidToSid interface
 */