2 * Unix SMB/Netbios implementation.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-1997,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
7 * Copyright (C) Paul Ashton 1997.
8 * Copyright (C) Jeremy Allison 2001.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 /* This is the interface to the lsa server code. */
29 extern int DEBUGLEVEL
;
31 /***************************************************************************
33 ***************************************************************************/
35 static BOOL
api_lsa_open_policy2(pipes_struct
*p
)
39 prs_struct
*data
= &p
->in_data
.data
;
40 prs_struct
*rdata
= &p
->out_data
.rdata
;
45 /* grab the server, object attributes and desired access flag...*/
46 if(!lsa_io_q_open_pol2("", &q_u
, data
, 0)) {
47 DEBUG(0,("api_lsa_open_policy2: unable to unmarshall LSA_Q_OPEN_POL2.\n"));
51 r_u
.status
= _lsa_open_policy2(p
, &q_u
, &r_u
);
53 /* store the response in the SMB stream */
54 if(!lsa_io_r_open_pol2("", &r_u
, rdata
, 0)) {
55 DEBUG(0,("api_lsa_open_policy2: unable to marshall LSA_R_OPEN_POL2.\n"));
62 /***************************************************************************
64 ***************************************************************************/
66 static BOOL
api_lsa_open_policy(pipes_struct
*p
)
70 prs_struct
*data
= &p
->in_data
.data
;
71 prs_struct
*rdata
= &p
->out_data
.rdata
;
76 /* grab the server, object attributes and desired access flag...*/
77 if(!lsa_io_q_open_pol("", &q_u
, data
, 0)) {
78 DEBUG(0,("api_lsa_open_policy: unable to unmarshall LSA_Q_OPEN_POL.\n"));
82 r_u
.status
= _lsa_open_policy(p
, &q_u
, &r_u
);
84 /* store the response in the SMB stream */
85 if(!lsa_io_r_open_pol("", &r_u
, rdata
, 0)) {
86 DEBUG(0,("api_lsa_open_policy: unable to marshall LSA_R_OPEN_POL.\n"));
93 /***************************************************************************
94 api_lsa_enum_trust_dom
95 ***************************************************************************/
97 static BOOL
api_lsa_enum_trust_dom(pipes_struct
*p
)
99 LSA_Q_ENUM_TRUST_DOM q_u
;
100 LSA_R_ENUM_TRUST_DOM r_u
;
101 prs_struct
*data
= &p
->in_data
.data
;
102 prs_struct
*rdata
= &p
->out_data
.rdata
;
107 /* grab the enum trust domain context etc. */
108 if(!lsa_io_q_enum_trust_dom("", &q_u
, data
, 0))
111 r_u
.status
= _lsa_enum_trust_dom(p
, &q_u
, &r_u
);
113 if(!lsa_io_r_enum_trust_dom("", &r_u
, rdata
, 0))
119 /***************************************************************************
121 ***************************************************************************/
123 static BOOL
api_lsa_query_info(pipes_struct
*p
)
125 LSA_Q_QUERY_INFO q_u
;
126 LSA_R_QUERY_INFO r_u
;
127 prs_struct
*data
= &p
->in_data
.data
;
128 prs_struct
*rdata
= &p
->out_data
.rdata
;
133 /* grab the info class and policy handle */
134 if(!lsa_io_q_query("", &q_u
, data
, 0)) {
135 DEBUG(0,("api_lsa_query_info: failed to unmarshall LSA_Q_QUERY_INFO.\n"));
139 r_u
.status
= _lsa_query_info(p
, &q_u
, &r_u
);
141 /* store the response in the SMB stream */
142 if(!lsa_io_r_query("", &r_u
, rdata
, 0)) {
143 DEBUG(0,("api_lsa_query_info: failed to marshall LSA_R_QUERY_INFO.\n"));
150 /***************************************************************************
152 ***************************************************************************/
154 static BOOL
api_lsa_lookup_sids(pipes_struct
*p
)
156 LSA_Q_LOOKUP_SIDS q_u
;
157 LSA_R_LOOKUP_SIDS r_u
;
158 prs_struct
*data
= &p
->in_data
.data
;
159 prs_struct
*rdata
= &p
->out_data
.rdata
;
164 /* grab the info class and policy handle */
165 if(!lsa_io_q_lookup_sids("", &q_u
, data
, 0)) {
166 DEBUG(0,("api_lsa_lookup_sids: failed to unmarshall LSA_Q_LOOKUP_SIDS.\n"));
170 r_u
.status
= _lsa_lookup_sids(p
, &q_u
, &r_u
);
172 if(!lsa_io_r_lookup_sids("", &r_u
, rdata
, 0)) {
173 DEBUG(0,("api_lsa_lookup_sids: Failed to marshall LSA_R_LOOKUP_SIDS.\n"));
180 /***************************************************************************
182 ***************************************************************************/
184 static BOOL
api_lsa_lookup_names(pipes_struct
*p
)
186 LSA_Q_LOOKUP_NAMES q_u
;
187 LSA_R_LOOKUP_NAMES r_u
;
188 prs_struct
*data
= &p
->in_data
.data
;
189 prs_struct
*rdata
= &p
->out_data
.rdata
;
194 /* grab the info class and policy handle */
195 if(!lsa_io_q_lookup_names("", &q_u
, data
, 0)) {
196 DEBUG(0,("api_lsa_lookup_names: failed to unmarshall LSA_Q_LOOKUP_NAMES.\n"));
200 r_u
.status
= _lsa_lookup_names(p
, &q_u
, &r_u
);
202 /* store the response in the SMB stream */
203 if(!lsa_io_r_lookup_names("", &r_u
, rdata
, 0)) {
204 DEBUG(0,("api_lsa_lookup_names: Failed to marshall LSA_R_LOOKUP_NAMES.\n"));
211 /***************************************************************************
213 ***************************************************************************/
215 static BOOL
api_lsa_close(pipes_struct
*p
)
219 prs_struct
*data
= &p
->in_data
.data
;
220 prs_struct
*rdata
= &p
->out_data
.rdata
;
225 if (!lsa_io_q_close("", &q_u
, data
, 0)) {
226 DEBUG(0,("api_lsa_close: lsa_io_q_close failed.\n"));
230 r_u
.status
= _lsa_close(p
, &q_u
, &r_u
);
232 /* store the response in the SMB stream */
233 if (!lsa_io_r_close("", &r_u
, rdata
, 0)) {
234 DEBUG(0,("api_lsa_close: lsa_io_r_close failed.\n"));
241 /***************************************************************************
243 ***************************************************************************/
245 static BOOL
api_lsa_open_secret(pipes_struct
*p
)
247 LSA_Q_OPEN_SECRET q_u
;
248 LSA_R_OPEN_SECRET r_u
;
249 prs_struct
*data
= &p
->in_data
.data
;
250 prs_struct
*rdata
= &p
->out_data
.rdata
;
255 if(!lsa_io_q_open_secret("", &q_u
, data
, 0)) {
256 DEBUG(0,("api_lsa_open_secret: failed to unmarshall LSA_Q_OPEN_SECRET.\n"));
260 r_u
.status
= _lsa_open_secret(p
, &q_u
, &r_u
);
262 /* store the response in the SMB stream */
263 if(!lsa_io_r_open_secret("", &r_u
, rdata
, 0)) {
264 DEBUG(0,("api_lsa_open_secret: Failed to marshall LSA_R_OPEN_SECRET.\n"));
271 /***************************************************************************
273 ***************************************************************************/
275 static struct api_struct api_lsa_cmds
[] =
277 { "LSA_OPENPOLICY2" , LSA_OPENPOLICY2
, api_lsa_open_policy2
},
278 { "LSA_OPENPOLICY" , LSA_OPENPOLICY
, api_lsa_open_policy
},
279 { "LSA_QUERYINFOPOLICY" , LSA_QUERYINFOPOLICY
, api_lsa_query_info
},
280 { "LSA_ENUMTRUSTDOM" , LSA_ENUMTRUSTDOM
, api_lsa_enum_trust_dom
},
281 { "LSA_CLOSE" , LSA_CLOSE
, api_lsa_close
},
282 { "LSA_OPENSECRET" , LSA_OPENSECRET
, api_lsa_open_secret
},
283 { "LSA_LOOKUPSIDS" , LSA_LOOKUPSIDS
, api_lsa_lookup_sids
},
284 { "LSA_LOOKUPNAMES" , LSA_LOOKUPNAMES
, api_lsa_lookup_names
},
288 /***************************************************************************
290 ***************************************************************************/
291 BOOL
api_ntlsa_rpc(pipes_struct
*p
)
293 return api_rpcTNP(p
, "api_ntlsa_rpc", api_lsa_cmds
);