diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-05-19 15:45:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:16:56 -0500 |
commit | 283991e1fff8b74af693aeb634143b10b5e939c8 (patch) | |
tree | 1bee3b1a9a56fd1c6fadaa37da5173fb09c70d31 /source4/torture | |
parent | 45511bd09b62266904c547398037fd41fbb8871e (diff) | |
download | samba-283991e1fff8b74af693aeb634143b10b5e939c8.tar.gz samba-283991e1fff8b74af693aeb634143b10b5e939c8.tar.bz2 samba-283991e1fff8b74af693aeb634143b10b5e939c8.zip |
r6907: Unixinfo for samba4, not activated by default.
Volker
(This used to be commit 81ddffde369c5b5e91bc130510f43c6841a789c4)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/config.mk | 3 | ||||
-rw-r--r-- | source4/torture/rpc/unixinfo.c | 91 | ||||
-rw-r--r-- | source4/torture/torture.c | 1 |
3 files changed, 94 insertions, 1 deletions
diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 71f500bba4..2749318080 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -77,6 +77,7 @@ ADD_OBJ_FILES = \ torture/rpc/dfs.o \ torture/rpc/drsuapi.o \ torture/rpc/spoolss.o \ + torture/rpc/unixinfo.o \ torture/rpc/samr.o \ torture/rpc/wkssvc.o \ torture/rpc/srvsvc.o \ @@ -104,7 +105,7 @@ ADD_OBJ_FILES = \ torture/rpc/alter_context.o \ torture/rpc/bench.o REQUIRED_SUBSYSTEMS = \ - NDR_ALL RPC_NDR_SAMR RPC_NDR_WINREG RPC_NDR_INITSHUTDOWN \ + NDR_ALL RPC_NDR_UNIXINFO RPC_NDR_SAMR RPC_NDR_WINREG RPC_NDR_INITSHUTDOWN \ RPC_NDR_OXIDRESOLVER RPC_NDR_EVENTLOG RPC_NDR_ECHO RPC_NDR_SVCCTL \ RPC_NDR_MGMT RPC_NDR_NETLOGON RPC_NDR_ATSVC RPC_NDR_DRSUAPI \ RPC_NDR_LSA RPC_NDR_EPMAPPER RPC_NDR_DFS RPC_NDR_SPOOLSS \ diff --git a/source4/torture/rpc/unixinfo.c b/source4/torture/rpc/unixinfo.c new file mode 100644 index 0000000000..caa268b0c8 --- /dev/null +++ b/source4/torture/rpc/unixinfo.c @@ -0,0 +1,91 @@ +/* + Unix SMB/CIFS implementation. + test suite for unixinfo rpc operations + + Copyright (C) Volker Lendecke 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "lib/events/events.h" +#include "librpc/gen_ndr/ndr_unixinfo.h" + + +/* + test the UidToSid interface +*/ +static BOOL test_uidtosid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct unixinfo_UidToSid r; + + r.in.uid = 1000; + + status = dcerpc_unixinfo_UidToSid(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("UidToSid failed == %s\n", nt_errstr(status)); + return False; + } + + return True; +} + +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; + struct unixinfo_GetPWUid r; + NTSTATUS result; + + for (i=0; i<num_uids; i++) { + uids[i] = i; + } + + r.in.count = num_uids; + r.in.uids = uids; + + result = dcerpc_unixinfo_GetPWUid(p, mem_ctx, &r); + + return NT_STATUS_IS_OK(result); +} + +BOOL torture_rpc_unixinfo(void) +{ + NTSTATUS status; + struct dcerpc_pipe *p; + TALLOC_CTX *mem_ctx; + BOOL ret = True; + + mem_ctx = talloc_init("torture_rpc_unixinfo"); + + status = torture_rpc_connection(mem_ctx, &p, + DCERPC_UNIXINFO_NAME, + DCERPC_UNIXINFO_UUID, + DCERPC_UNIXINFO_VERSION); + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + ret &= test_uidtosid(p, mem_ctx); + ret &= test_getpwuid(p, mem_ctx); + + printf("\n"); + + talloc_free(mem_ctx); + + return ret; +} diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 8f49a125c5..f5e52c5358 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -2260,6 +2260,7 @@ static struct { {"RPC-DFS", torture_rpc_dfs, 0}, {"RPC-SPOOLSS", torture_rpc_spoolss, 0}, {"RPC-SAMR", torture_rpc_samr, 0}, + {"RPC-UNIXINFO", torture_rpc_unixinfo, 0}, {"RPC-NETLOGON", torture_rpc_netlogon, 0}, {"RPC-SAMLOGON", torture_rpc_samlogon, 0}, {"RPC-SAMSYNC", torture_rpc_samsync, 0}, |