2 * Unix SMB/CIFS implementation.
4 * RPC Pipe client / server routines
6 * Copyright (C) Volker Lendecke 2005
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #define DBGC_CLASS DBGC_RPC_PARSE
28 void init_q_unixinfo_sid_to_uid(UNIXINFO_Q_SID_TO_UID *q_d, const DOM_SID *sid)
30 sid_copy(&q_d->sid, sid);
33 BOOL unixinfo_io_q_unixinfo_sid_to_uid(const char *desc, UNIXINFO_Q_SID_TO_UID *q_d,
34 prs_struct *ps, int depth)
36 return smb_io_dom_sid(desc, &q_d->sid, ps, depth);
39 BOOL unixinfo_io_r_unixinfo_sid_to_uid(const char *desc, UNIXINFO_R_SID_TO_UID *r_d,
40 prs_struct *ps, int depth)
42 if (!prs_uint64(desc, ps, depth, &r_d->uid))
45 if (!prs_ntstatus(desc, ps, depth, &r_d->status))
51 void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, UINT64_S uid)
56 BOOL unixinfo_io_q_unixinfo_uid_to_sid(const char *desc, UNIXINFO_Q_UID_TO_SID *q_d,
57 prs_struct *ps, int depth)
59 return prs_uint64(desc, ps, depth, &q_d->uid);
62 void init_r_unixinfo_uid_to_sid(UNIXINFO_R_UID_TO_SID *r_d, DOM_SID *sid)
69 sid_copy(&r_d->sid, sid);
72 BOOL unixinfo_io_r_unixinfo_uid_to_sid(const char *desc, UNIXINFO_R_UID_TO_SID *r_d,
73 prs_struct *ps, int depth)
75 if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr))
78 if (r_d->sidptr != 0) {
79 if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth))
83 if (!prs_ntstatus(desc, ps, depth, &r_d->status))
89 void init_q_unixinfo_sid_to_gid(UNIXINFO_Q_SID_TO_GID *q_d, const DOM_SID *sid)
91 sid_copy(&q_d->sid, sid);
94 BOOL unixinfo_io_q_unixinfo_sid_to_gid(const char *desc, UNIXINFO_Q_SID_TO_GID *q_d,
95 prs_struct *ps, int depth)
97 return smb_io_dom_sid(desc, &q_d->sid, ps, depth);
100 void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, UINT64_S gid)
103 r_d->status = NT_STATUS_OK;
106 BOOL unixinfo_io_r_unixinfo_sid_to_gid(const char *desc, UNIXINFO_R_SID_TO_GID *r_d,
107 prs_struct *ps, int depth)
109 if (!prs_uint64(desc, ps, depth, &r_d->gid))
112 if (!prs_ntstatus(desc, ps, depth, &r_d->status))
118 void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, UINT64_S gid)
123 BOOL unixinfo_io_q_unixinfo_gid_to_sid(const char *desc, UNIXINFO_Q_GID_TO_SID *q_d,
124 prs_struct *ps, int depth)
126 return prs_uint64(desc, ps, depth, &q_d->gid);
129 void init_r_unixinfo_gid_to_sid(UNIXINFO_R_GID_TO_SID *r_d, DOM_SID *sid)
136 sid_copy(&r_d->sid, sid);
139 BOOL unixinfo_io_r_unixinfo_gid_to_sid(const char *desc, UNIXINFO_R_GID_TO_SID *r_d,
140 prs_struct *ps, int depth)
142 if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr))
145 if (r_d->sidptr != 0) {
146 if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth))
150 if (!prs_ntstatus(desc, ps, depth, &r_d->status))
156 void init_q_unixinfo_getpwuid(UNIXINFO_Q_GETPWUID *r_d, int count,
163 BOOL unixinfo_io_q_unixinfo_getpwuid(const char *desc,
164 UNIXINFO_Q_GETPWUID *q_d,
165 prs_struct *ps, int depth)
170 if (!prs_uint32("count", ps, depth, &q_d->count))
173 arraysize = q_d->count;
175 if (!prs_uint32("arraysize", ps, depth, &arraysize))
178 if (arraysize != q_d->count) {
179 DEBUG(10, ("count!=arraysize\n"));
183 if (q_d->count > 1023) {
184 DEBUG(10, ("Range exceeded\n"));
188 if (UNMARSHALLING(ps)) {
189 q_d->uid = PRS_ALLOC_MEM(ps, UINT64_S, q_d->count);
190 if (q_d->uid == NULL) {
195 for (i=0; i<q_d->count; i++) {
196 if (!prs_uint64(desc, ps, depth+1, &q_d->uid[i]))
203 void init_r_unixinfo_getpwuid(UNIXINFO_R_GETPWUID *r_d, uint32 count,
204 struct unixinfo_getpwuid *info)
210 BOOL unixinfo_io_r_unixinfo_getpwuid(const char *desc,
211 UNIXINFO_R_GETPWUID *r_d,
212 prs_struct *ps, int depth)
217 if (!prs_uint32("count", ps, depth, &r_d->count))
220 arraysize = r_d->count;
222 if (!prs_uint32("arraysize", ps, depth, &arraysize))
225 if (arraysize != r_d->count) {
226 DEBUG(10, ("count!=arraysize\n"));
230 if (r_d->count > 1023) {
231 DEBUG(10, ("Range exceeded\n"));
235 if (UNMARSHALLING(ps)) {
236 r_d->info = PRS_ALLOC_MEM(ps, struct unixinfo_getpwuid,
238 if (r_d->info == NULL) {
243 for (i=0; i<r_d->count; i++) {
247 if (!prs_ntstatus("status", ps, depth+1, &r_d->info[i].status))
250 if (!prs_string_alloc("homedir", ps, depth+1,
251 &r_d->info[i].homedir))
254 if (!prs_string_alloc("shell", ps, depth+1,
255 &r_d->info[i].shell))
262 if (!prs_ntstatus(desc, ps, depth, &r_d->status))