2 Unix SMB/CIFS implementation.
3 test suite for unixinfo rpc operations
5 Copyright (C) Volker Lendecke 2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "lib/events/events.h"
24 #include "librpc/gen_ndr/ndr_unixinfo.h"
28 test the UidToSid interface
30 static BOOL test_uidtosid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
33 struct unixinfo_UidToSid r;
37 status = dcerpc_unixinfo_UidToSid(p, mem_ctx, &r);
38 if (!NT_STATUS_IS_OK(status)) {
39 printf("UidToSid failed == %s\n", nt_errstr(status));
46 static BOOL test_getpwuid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
49 const int num_uids = sizeof(uids)/sizeof(uids[0]);
51 struct unixinfo_GetPWUid r;
54 for (i=0; i<num_uids; i++) {
58 r.in.count = num_uids;
61 result = dcerpc_unixinfo_GetPWUid(p, mem_ctx, &r);
63 return NT_STATUS_IS_OK(result);
66 BOOL torture_rpc_unixinfo(void)
69 struct dcerpc_pipe *p;
73 mem_ctx = talloc_init("torture_rpc_unixinfo");
75 status = torture_rpc_connection(mem_ctx, &p,
78 DCERPC_UNIXINFO_VERSION);
79 if (!NT_STATUS_IS_OK(status)) {
83 ret &= test_uidtosid(p, mem_ctx);
84 ret &= test_getpwuid(p, mem_ctx);