From fcc7bdf874b82d20d81aa00ede870f53c7910b18 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 11 Sep 2006 16:54:54 +0000 Subject: r18392: add sidtouid and sidtogid tests to RPC-UNIXINFO metze (This used to be commit f1708fd9434ee2a9ae25e9d912f0c350d8e1a256) --- source4/torture/rpc/unixinfo.c | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/source4/torture/rpc/unixinfo.c b/source4/torture/rpc/unixinfo.c index ea34c55ada3..4bf27b916bc 100644 --- a/source4/torture/rpc/unixinfo.c +++ b/source4/torture/rpc/unixinfo.c @@ -23,8 +23,31 @@ #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 */ -- cgit