summaryrefslogtreecommitdiff
path: root/source3/librpc/gen_ndr/cli_unixinfo.c
blob: c8a6c926ef2480cfb732ed7b1f81705e452fbef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
 * Unix SMB/CIFS implementation.
 * client auto-generated by pidl. DO NOT MODIFY!
 */

#include "includes.h"
#include "librpc/gen_ndr/cli_unixinfo.h"

NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli,
				  TALLOC_CTX *mem_ctx,
				  struct dom_sid sid,
				  uint64_t *uid)
{
	struct unixinfo_SidToUid r;
	NTSTATUS status;

	/* In parameters */
	r.in.sid = sid;

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_IN_DEBUG(unixinfo_SidToUid, &r);
	}

	status = cli_do_rpc_ndr(cli,
				mem_ctx,
				PI_UNIXINFO,
				&ndr_table_unixinfo,
				NDR_UNIXINFO_SIDTOUID,
				&r);

	if (!NT_STATUS_IS_OK(status)) {
		return status;
	}

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_OUT_DEBUG(unixinfo_SidToUid, &r);
	}

	if (NT_STATUS_IS_ERR(status)) {
		return status;
	}

	/* Return variables */
	*uid = *r.out.uid;

	/* Return result */
	return r.out.result;
}

NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli,
				  TALLOC_CTX *mem_ctx,
				  uint64_t uid,
				  struct dom_sid *sid)
{
	struct unixinfo_UidToSid r;
	NTSTATUS status;

	/* In parameters */
	r.in.uid = uid;

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_IN_DEBUG(unixinfo_UidToSid, &r);
	}

	status = cli_do_rpc_ndr(cli,
				mem_ctx,
				PI_UNIXINFO,
				&ndr_table_unixinfo,
				NDR_UNIXINFO_UIDTOSID,
				&r);

	if (!NT_STATUS_IS_OK(status)) {
		return status;
	}

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_OUT_DEBUG(unixinfo_UidToSid, &r);
	}

	if (NT_STATUS_IS_ERR(status)) {
		return status;
	}

	/* Return variables */
	*sid = *r.out.sid;

	/* Return result */
	return r.out.result;
}

NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli,
				  TALLOC_CTX *mem_ctx,
				  struct dom_sid sid,
				  uint64_t *gid)
{
	struct unixinfo_SidToGid r;
	NTSTATUS status;

	/* In parameters */
	r.in.sid = sid;

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_IN_DEBUG(unixinfo_SidToGid, &r);
	}

	status = cli_do_rpc_ndr(cli,
				mem_ctx,
				PI_UNIXINFO,
				&ndr_table_unixinfo,
				NDR_UNIXINFO_SIDTOGID,
				&r);

	if (!NT_STATUS_IS_OK(status)) {
		return status;
	}

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_OUT_DEBUG(unixinfo_SidToGid, &r);
	}

	if (NT_STATUS_IS_ERR(status)) {
		return status;
	}

	/* Return variables */
	*gid = *r.out.gid;

	/* Return result */
	return r.out.result;
}

NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli,
				  TALLOC_CTX *mem_ctx,
				  uint64_t gid,
				  struct dom_sid *sid)
{
	struct unixinfo_GidToSid r;
	NTSTATUS status;

	/* In parameters */
	r.in.gid = gid;

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_IN_DEBUG(unixinfo_GidToSid, &r);
	}

	status = cli_do_rpc_ndr(cli,
				mem_ctx,
				PI_UNIXINFO,
				&ndr_table_unixinfo,
				NDR_UNIXINFO_GIDTOSID,
				&r);

	if (!NT_STATUS_IS_OK(status)) {
		return status;
	}

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_OUT_DEBUG(unixinfo_GidToSid, &r);
	}

	if (NT_STATUS_IS_ERR(status)) {
		return status;
	}

	/* Return variables */
	*sid = *r.out.sid;

	/* Return result */
	return r.out.result;
}

NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli,
				  TALLOC_CTX *mem_ctx,
				  uint32_t *count,
				  uint64_t *uids,
				  struct unixinfo_GetPWUidInfo *infos)
{
	struct unixinfo_GetPWUid r;
	NTSTATUS status;

	/* In parameters */
	r.in.count = count;
	r.in.uids = uids;

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_IN_DEBUG(unixinfo_GetPWUid, &r);
	}

	status = cli_do_rpc_ndr(cli,
				mem_ctx,
				PI_UNIXINFO,
				&ndr_table_unixinfo,
				NDR_UNIXINFO_GETPWUID,
				&r);

	if (!NT_STATUS_IS_OK(status)) {
		return status;
	}

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_OUT_DEBUG(unixinfo_GetPWUid, &r);
	}

	if (NT_STATUS_IS_ERR(status)) {
		return status;
	}

	/* Return variables */
	*count = *r.out.count;
	memcpy(infos, r.out.infos, *r.in.count);

	/* Return result */
	return r.out.result;
}