r14170: Paranioa fix for sesssetup.
[Samba/nascimento.git] / source3 / rpc_server / srv_samr.c
blob015ed6c5ea9b10d41d5998799b8563b856f801f4
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997,
7 * Copyright (C) Marc Jacobsen 1999,
8 * Copyright (C) Jean François Micouleau 1998-2001,
9 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002-2003.
11 * Split into interface and implementation modules by,
13 * Copyright (C) Jeremy Allison 2001.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 * This is the interface to the SAMR code.
34 #include "includes.h"
36 #undef DBGC_CLASS
37 #define DBGC_CLASS DBGC_RPC_SRV
39 /*******************************************************************
40 api_samr_close_hnd
41 ********************************************************************/
43 static BOOL api_samr_close_hnd(pipes_struct *p)
45 SAMR_Q_CLOSE_HND q_u;
46 SAMR_R_CLOSE_HND r_u;
47 prs_struct *data = &p->in_data.data;
48 prs_struct *rdata = &p->out_data.rdata;
50 ZERO_STRUCT(q_u);
51 ZERO_STRUCT(r_u);
53 if(!samr_io_q_close_hnd("", &q_u, data, 0)) {
54 DEBUG(0,("api_samr_close_hnd: unable to unmarshall SAMR_Q_CLOSE_HND.\n"));
55 return False;
58 r_u.status = _samr_close_hnd(p, &q_u, &r_u);
60 /* store the response in the SMB stream */
61 if(!samr_io_r_close_hnd("", &r_u, rdata, 0)) {
62 DEBUG(0,("api_samr_close_hnd: unable to marshall SAMR_R_CLOSE_HND.\n"));
63 return False;
66 return True;
69 /*******************************************************************
70 api_samr_open_domain
71 ********************************************************************/
73 static BOOL api_samr_open_domain(pipes_struct *p)
75 SAMR_Q_OPEN_DOMAIN q_u;
76 SAMR_R_OPEN_DOMAIN r_u;
78 prs_struct *data = &p->in_data.data;
79 prs_struct *rdata = &p->out_data.rdata;
81 ZERO_STRUCT(q_u);
82 ZERO_STRUCT(r_u);
84 if(!samr_io_q_open_domain("", &q_u, data, 0)) {
85 DEBUG(0,("api_samr_open_domain: unable to unmarshall SAMR_Q_OPEN_DOMAIN.\n"));
86 return False;
89 r_u.status = _samr_open_domain(p, &q_u, &r_u);
91 /* store the response in the SMB stream */
92 if(!samr_io_r_open_domain("", &r_u, rdata, 0)) {
93 DEBUG(0,("api_samr_open_domain: unable to marshall SAMR_R_OPEN_DOMAIN.\n"));
94 return False;
97 return True;
100 /*******************************************************************
101 api_samr_get_usrdom_pwinfo
102 ********************************************************************/
104 static BOOL api_samr_get_usrdom_pwinfo(pipes_struct *p)
106 SAMR_Q_GET_USRDOM_PWINFO q_u;
107 SAMR_R_GET_USRDOM_PWINFO r_u;
109 prs_struct *data = &p->in_data.data;
110 prs_struct *rdata = &p->out_data.rdata;
112 ZERO_STRUCT(q_u);
113 ZERO_STRUCT(r_u);
115 if(!samr_io_q_get_usrdom_pwinfo("", &q_u, data, 0)) {
116 DEBUG(0,("api_samr_get_usrdom_pwinfo: unable to unmarshall SAMR_Q_GET_USRDOM_PWINFO.\n"));
117 return False;
120 r_u.status = _samr_get_usrdom_pwinfo(p, &q_u, &r_u);
122 if(!samr_io_r_get_usrdom_pwinfo("", &r_u, rdata, 0)) {
123 DEBUG(0,("api_samr_get_usrdom_pwinfo: unable to marshall SAMR_R_GET_USRDOM_PWINFO.\n"));
124 return False;
127 return True;
130 /*******************************************************************
131 api_samr_set_sec_obj
132 ********************************************************************/
134 static BOOL api_samr_set_sec_obj(pipes_struct *p)
136 SAMR_Q_SET_SEC_OBJ q_u;
137 SAMR_R_SET_SEC_OBJ r_u;
139 prs_struct *data = &p->in_data.data;
140 prs_struct *rdata = &p->out_data.rdata;
142 ZERO_STRUCT(q_u);
143 ZERO_STRUCT(r_u);
145 if(!samr_io_q_set_sec_obj("", &q_u, data, 0)) {
146 DEBUG(0,("api_samr_set_sec_obj: unable to unmarshall SAMR_Q_SET_SEC_OBJ.\n"));
147 return False;
150 r_u.status = _samr_set_sec_obj(p, &q_u, &r_u);
152 if(!samr_io_r_set_sec_obj("", &r_u, rdata, 0)) {
153 DEBUG(0,("api_samr_set_sec_obj: unable to marshall SAMR_R_SET_SEC_OBJ.\n"));
154 return False;
157 return True;
160 /*******************************************************************
161 api_samr_query_sec_obj
162 ********************************************************************/
164 static BOOL api_samr_query_sec_obj(pipes_struct *p)
166 SAMR_Q_QUERY_SEC_OBJ q_u;
167 SAMR_R_QUERY_SEC_OBJ r_u;
169 prs_struct *data = &p->in_data.data;
170 prs_struct *rdata = &p->out_data.rdata;
172 ZERO_STRUCT(q_u);
173 ZERO_STRUCT(r_u);
175 if(!samr_io_q_query_sec_obj("", &q_u, data, 0)) {
176 DEBUG(0,("api_samr_query_sec_obj: unable to unmarshall SAMR_Q_QUERY_SEC_OBJ.\n"));
177 return False;
180 r_u.status = _samr_query_sec_obj(p, &q_u, &r_u);
182 if(!samr_io_r_query_sec_obj("", &r_u, rdata, 0)) {
183 DEBUG(0,("api_samr_query_sec_obj: unable to marshall SAMR_R_QUERY_SEC_OBJ.\n"));
184 return False;
187 return True;
190 /*******************************************************************
191 api_samr_enum_dom_users
192 ********************************************************************/
194 static BOOL api_samr_enum_dom_users(pipes_struct *p)
196 SAMR_Q_ENUM_DOM_USERS q_u;
197 SAMR_R_ENUM_DOM_USERS r_u;
198 prs_struct *data = &p->in_data.data;
199 prs_struct *rdata = &p->out_data.rdata;
201 ZERO_STRUCT(q_u);
202 ZERO_STRUCT(r_u);
204 /* grab the samr open */
205 if(!samr_io_q_enum_dom_users("", &q_u, data, 0)) {
206 DEBUG(0,("api_samr_enum_dom_users: unable to unmarshall SAMR_Q_ENUM_DOM_USERS.\n"));
207 return False;
210 r_u.status = _samr_enum_dom_users(p, &q_u, &r_u);
212 /* store the response in the SMB stream */
213 if(!samr_io_r_enum_dom_users("", &r_u, rdata, 0)) {
214 DEBUG(0,("api_samr_enum_dom_users: unable to marshall SAMR_R_ENUM_DOM_USERS.\n"));
215 return False;
218 return True;
221 /*******************************************************************
222 api_samr_enum_dom_groups
223 ********************************************************************/
225 static BOOL api_samr_enum_dom_groups(pipes_struct *p)
227 SAMR_Q_ENUM_DOM_GROUPS q_u;
228 SAMR_R_ENUM_DOM_GROUPS r_u;
229 prs_struct *data = &p->in_data.data;
230 prs_struct *rdata = &p->out_data.rdata;
232 ZERO_STRUCT(q_u);
233 ZERO_STRUCT(r_u);
235 /* grab the samr open */
236 if(!samr_io_q_enum_dom_groups("", &q_u, data, 0)) {
237 DEBUG(0,("api_samr_enum_dom_groups: unable to unmarshall SAMR_Q_ENUM_DOM_GROUPS.\n"));
238 return False;
241 r_u.status = _samr_enum_dom_groups(p, &q_u, &r_u);
243 /* store the response in the SMB stream */
244 if(!samr_io_r_enum_dom_groups("", &r_u, rdata, 0)) {
245 DEBUG(0,("api_samr_enum_dom_groups: unable to marshall SAMR_R_ENUM_DOM_GROUPS.\n"));
246 return False;
249 return True;
252 /*******************************************************************
253 api_samr_enum_dom_aliases
254 ********************************************************************/
256 static BOOL api_samr_enum_dom_aliases(pipes_struct *p)
258 SAMR_Q_ENUM_DOM_ALIASES q_u;
259 SAMR_R_ENUM_DOM_ALIASES r_u;
260 prs_struct *data = &p->in_data.data;
261 prs_struct *rdata = &p->out_data.rdata;
263 ZERO_STRUCT(q_u);
264 ZERO_STRUCT(r_u);
266 /* grab the samr open */
267 if(!samr_io_q_enum_dom_aliases("", &q_u, data, 0)) {
268 DEBUG(0,("api_samr_enum_dom_aliases: unable to unmarshall SAMR_Q_ENUM_DOM_ALIASES.\n"));
269 return False;
272 r_u.status = _samr_enum_dom_aliases(p, &q_u, &r_u);
274 /* store the response in the SMB stream */
275 if(!samr_io_r_enum_dom_aliases("", &r_u, rdata, 0)) {
276 DEBUG(0,("api_samr_enum_dom_aliases: unable to marshall SAMR_R_ENUM_DOM_ALIASES.\n"));
277 return False;
280 return True;
283 /*******************************************************************
284 api_samr_query_dispinfo
285 ********************************************************************/
287 static BOOL api_samr_query_dispinfo(pipes_struct *p)
289 SAMR_Q_QUERY_DISPINFO q_u;
290 SAMR_R_QUERY_DISPINFO r_u;
291 prs_struct *data = &p->in_data.data;
292 prs_struct *rdata = &p->out_data.rdata;
294 ZERO_STRUCT(q_u);
295 ZERO_STRUCT(r_u);
297 if(!samr_io_q_query_dispinfo("", &q_u, data, 0)) {
298 DEBUG(0,("api_samr_query_dispinfo: unable to unmarshall SAMR_Q_QUERY_DISPINFO.\n"));
299 return False;
302 r_u.status = _samr_query_dispinfo(p, &q_u, &r_u);
304 /* store the response in the SMB stream */
305 if(!samr_io_r_query_dispinfo("", &r_u, rdata, 0)) {
306 DEBUG(0,("api_samr_query_dispinfo: unable to marshall SAMR_R_QUERY_DISPINFO.\n"));
307 return False;
310 return True;
313 /*******************************************************************
314 api_samr_query_aliasinfo
315 ********************************************************************/
317 static BOOL api_samr_query_aliasinfo(pipes_struct *p)
319 SAMR_Q_QUERY_ALIASINFO q_u;
320 SAMR_R_QUERY_ALIASINFO r_u;
321 prs_struct *data = &p->in_data.data;
322 prs_struct *rdata = &p->out_data.rdata;
324 ZERO_STRUCT(q_u);
325 ZERO_STRUCT(r_u);
327 /* grab the samr open */
328 if(!samr_io_q_query_aliasinfo("", &q_u, data, 0)) {
329 DEBUG(0,("api_samr_query_aliasinfo: unable to unmarshall SAMR_Q_QUERY_ALIASINFO.\n"));
330 return False;
333 r_u.status = _samr_query_aliasinfo(p, &q_u, &r_u);
335 /* store the response in the SMB stream */
336 if(!samr_io_r_query_aliasinfo("", &r_u, rdata, 0)) {
337 DEBUG(0,("api_samr_query_aliasinfo: unable to marshall SAMR_R_QUERY_ALIASINFO.\n"));
338 return False;
341 return True;
344 /*******************************************************************
345 api_samr_lookup_names
346 ********************************************************************/
348 static BOOL api_samr_lookup_names(pipes_struct *p)
350 SAMR_Q_LOOKUP_NAMES q_u;
351 SAMR_R_LOOKUP_NAMES r_u;
352 prs_struct *data = &p->in_data.data;
353 prs_struct *rdata = &p->out_data.rdata;
355 ZERO_STRUCT(q_u);
356 ZERO_STRUCT(r_u);
358 /* grab the samr lookup names */
359 if(!samr_io_q_lookup_names("", &q_u, data, 0)) {
360 DEBUG(0,("api_samr_lookup_names: unable to unmarshall SAMR_Q_LOOKUP_NAMES.\n"));
361 return False;
364 r_u.status = _samr_lookup_names(p, &q_u, &r_u);
366 /* store the response in the SMB stream */
367 if(!samr_io_r_lookup_names("", &r_u, rdata, 0)) {
368 DEBUG(0,("api_samr_lookup_names: unable to marshall SAMR_R_LOOKUP_NAMES.\n"));
369 return False;
372 return True;
375 /*******************************************************************
376 api_samr_chgpasswd_user
377 ********************************************************************/
379 static BOOL api_samr_chgpasswd_user(pipes_struct *p)
381 SAMR_Q_CHGPASSWD_USER q_u;
382 SAMR_R_CHGPASSWD_USER r_u;
383 prs_struct *data = &p->in_data.data;
384 prs_struct *rdata = &p->out_data.rdata;
386 ZERO_STRUCT(q_u);
387 ZERO_STRUCT(r_u);
389 /* change password request */
390 if (!samr_io_q_chgpasswd_user("", &q_u, data, 0)) {
391 DEBUG(0,("api_samr_chgpasswd_user: Failed to unmarshall SAMR_Q_CHGPASSWD_USER.\n"));
392 return False;
395 r_u.status = _samr_chgpasswd_user(p, &q_u, &r_u);
397 /* store the response in the SMB stream */
398 if(!samr_io_r_chgpasswd_user("", &r_u, rdata, 0)) {
399 DEBUG(0,("api_samr_chgpasswd_user: Failed to marshall SAMR_R_CHGPASSWD_USER.\n" ));
400 return False;
403 return True;
406 /*******************************************************************
407 api_samr_lookup_rids
408 ********************************************************************/
410 static BOOL api_samr_lookup_rids(pipes_struct *p)
412 SAMR_Q_LOOKUP_RIDS q_u;
413 SAMR_R_LOOKUP_RIDS r_u;
414 prs_struct *data = &p->in_data.data;
415 prs_struct *rdata = &p->out_data.rdata;
417 ZERO_STRUCT(q_u);
418 ZERO_STRUCT(r_u);
420 /* grab the samr lookup names */
421 if(!samr_io_q_lookup_rids("", &q_u, data, 0)) {
422 DEBUG(0,("api_samr_lookup_rids: unable to unmarshall SAMR_Q_LOOKUP_RIDS.\n"));
423 return False;
426 r_u.status = _samr_lookup_rids(p, &q_u, &r_u);
428 /* store the response in the SMB stream */
429 if(!samr_io_r_lookup_rids("", &r_u, rdata, 0)) {
430 DEBUG(0,("api_samr_lookup_rids: unable to marshall SAMR_R_LOOKUP_RIDS.\n"));
431 return False;
434 return True;
437 /*******************************************************************
438 api_samr_open_user
439 ********************************************************************/
441 static BOOL api_samr_open_user(pipes_struct *p)
443 SAMR_Q_OPEN_USER q_u;
444 SAMR_R_OPEN_USER r_u;
445 prs_struct *data = &p->in_data.data;
446 prs_struct *rdata = &p->out_data.rdata;
448 ZERO_STRUCT(q_u);
449 ZERO_STRUCT(r_u);
451 if(!samr_io_q_open_user("", &q_u, data, 0)) {
452 DEBUG(0,("api_samr_open_user: unable to unmarshall SAMR_Q_OPEN_USER.\n"));
453 return False;
456 r_u.status = _samr_open_user(p, &q_u, &r_u);
458 /* store the response in the SMB stream */
459 if(!samr_io_r_open_user("", &r_u, rdata, 0)) {
460 DEBUG(0,("api_samr_open_user: unable to marshall SAMR_R_OPEN_USER.\n"));
461 return False;
464 return True;
467 /*******************************************************************
468 api_samr_query_userinfo
469 ********************************************************************/
471 static BOOL api_samr_query_userinfo(pipes_struct *p)
473 SAMR_Q_QUERY_USERINFO q_u;
474 SAMR_R_QUERY_USERINFO r_u;
475 prs_struct *data = &p->in_data.data;
476 prs_struct *rdata = &p->out_data.rdata;
478 ZERO_STRUCT(q_u);
479 ZERO_STRUCT(r_u);
481 if(!samr_io_q_query_userinfo("", &q_u, data, 0)){
482 DEBUG(0,("api_samr_query_userinfo: unable to unmarshall SAMR_Q_QUERY_USERINFO.\n"));
483 return False;
486 r_u.status = _samr_query_userinfo(p, &q_u, &r_u);
488 /* store the response in the SMB stream */
489 if(!samr_io_r_query_userinfo("", &r_u, rdata, 0)) {
490 DEBUG(0,("api_samr_query_userinfo: unable to marshall SAMR_R_QUERY_USERINFO.\n"));
491 return False;
494 return True;
497 /*******************************************************************
498 api_samr_query_usergroups
499 ********************************************************************/
501 static BOOL api_samr_query_usergroups(pipes_struct *p)
503 SAMR_Q_QUERY_USERGROUPS q_u;
504 SAMR_R_QUERY_USERGROUPS r_u;
505 prs_struct *data = &p->in_data.data;
506 prs_struct *rdata = &p->out_data.rdata;
508 ZERO_STRUCT(q_u);
509 ZERO_STRUCT(r_u);
511 if(!samr_io_q_query_usergroups("", &q_u, data, 0)) {
512 DEBUG(0,("api_samr_query_usergroups: unable to unmarshall SAMR_Q_QUERY_USERGROUPS.\n"));
513 return False;
516 r_u.status = _samr_query_usergroups(p, &q_u, &r_u);
518 /* store the response in the SMB stream */
519 if(!samr_io_r_query_usergroups("", &r_u, rdata, 0)) {
520 DEBUG(0,("api_samr_query_usergroups: unable to marshall SAMR_R_QUERY_USERGROUPS.\n"));
521 return False;
524 return True;
527 /*******************************************************************
528 api_samr_query_dom_info
529 ********************************************************************/
531 static BOOL api_samr_query_dom_info(pipes_struct *p)
533 SAMR_Q_QUERY_DOMAIN_INFO q_u;
534 SAMR_R_QUERY_DOMAIN_INFO r_u;
535 prs_struct *data = &p->in_data.data;
536 prs_struct *rdata = &p->out_data.rdata;
538 ZERO_STRUCT(q_u);
539 ZERO_STRUCT(r_u);
541 if(!samr_io_q_query_dom_info("", &q_u, data, 0)) {
542 DEBUG(0,("api_samr_query_dom_info: unable to unmarshall SAMR_Q_QUERY_DOMAIN_INFO.\n"));
543 return False;
546 r_u.status = _samr_query_dom_info(p, &q_u, &r_u);
548 /* store the response in the SMB stream */
549 if(!samr_io_r_query_dom_info("", &r_u, rdata, 0)) {
550 DEBUG(0,("api_samr_query_dom_info: unable to marshall SAMR_R_QUERY_DOMAIN_INFO.\n"));
551 return False;
554 return True;
557 /*******************************************************************
558 api_samr_create_user
559 ********************************************************************/
561 static BOOL api_samr_create_user(pipes_struct *p)
563 prs_struct *data = &p->in_data.data;
564 prs_struct *rdata = &p->out_data.rdata;
566 SAMR_Q_CREATE_USER q_u;
567 SAMR_R_CREATE_USER r_u;
569 ZERO_STRUCT(q_u);
570 ZERO_STRUCT(r_u);
572 /* grab the samr create user */
573 if (!samr_io_q_create_user("", &q_u, data, 0)) {
574 DEBUG(0,("api_samr_create_user: Unable to unmarshall SAMR_Q_CREATE_USER.\n"));
575 return False;
578 r_u.status=_samr_create_user(p, &q_u, &r_u);
580 /* store the response in the SMB stream */
581 if(!samr_io_r_create_user("", &r_u, rdata, 0)) {
582 DEBUG(0,("api_samr_create_user: Unable to marshall SAMR_R_CREATE_USER.\n"));
583 return False;
586 return True;
589 /*******************************************************************
590 api_samr_connect_anon
591 ********************************************************************/
593 static BOOL api_samr_connect_anon(pipes_struct *p)
595 SAMR_Q_CONNECT_ANON q_u;
596 SAMR_R_CONNECT_ANON r_u;
597 prs_struct *data = &p->in_data.data;
598 prs_struct *rdata = &p->out_data.rdata;
600 ZERO_STRUCT(q_u);
601 ZERO_STRUCT(r_u);
603 /* grab the samr open policy */
604 if(!samr_io_q_connect_anon("", &q_u, data, 0)) {
605 DEBUG(0,("api_samr_connect_anon: unable to unmarshall SAMR_Q_CONNECT_ANON.\n"));
606 return False;
609 r_u.status = _samr_connect_anon(p, &q_u, &r_u);
611 /* store the response in the SMB stream */
612 if(!samr_io_r_connect_anon("", &r_u, rdata, 0)) {
613 DEBUG(0,("api_samr_connect_anon: unable to marshall SAMR_R_CONNECT_ANON.\n"));
614 return False;
617 return True;
620 /*******************************************************************
621 api_samr_connect
622 ********************************************************************/
624 static BOOL api_samr_connect(pipes_struct *p)
626 SAMR_Q_CONNECT q_u;
627 SAMR_R_CONNECT r_u;
628 prs_struct *data = &p->in_data.data;
629 prs_struct *rdata = &p->out_data.rdata;
631 ZERO_STRUCT(q_u);
632 ZERO_STRUCT(r_u);
634 /* grab the samr open policy */
635 if(!samr_io_q_connect("", &q_u, data, 0)) {
636 DEBUG(0,("api_samr_connect: unable to unmarshall SAMR_Q_CONNECT.\n"));
637 return False;
640 r_u.status = _samr_connect(p, &q_u, &r_u);
642 /* store the response in the SMB stream */
643 if(!samr_io_r_connect("", &r_u, rdata, 0)) {
644 DEBUG(0,("api_samr_connect: unable to marshall SAMR_R_CONNECT.\n"));
645 return False;
648 return True;
651 /*******************************************************************
652 api_samr_connect4
653 ********************************************************************/
655 static BOOL api_samr_connect4(pipes_struct *p)
657 SAMR_Q_CONNECT4 q_u;
658 SAMR_R_CONNECT4 r_u;
659 prs_struct *data = &p->in_data.data;
660 prs_struct *rdata = &p->out_data.rdata;
662 ZERO_STRUCT(q_u);
663 ZERO_STRUCT(r_u);
665 /* grab the samr open policy */
666 if(!samr_io_q_connect4("", &q_u, data, 0)) {
667 DEBUG(0,("api_samr_connect4: unable to unmarshall SAMR_Q_CONNECT4.\n"));
668 return False;
671 r_u.status = _samr_connect4(p, &q_u, &r_u);
673 /* store the response in the SMB stream */
674 if(!samr_io_r_connect4("", &r_u, rdata, 0)) {
675 DEBUG(0,("api_samr_connect4: unable to marshall SAMR_R_CONNECT4.\n"));
676 return False;
679 return True;
682 /*******************************************************************
683 api_samr_chgpasswd_user3
684 ********************************************************************/
686 static BOOL api_samr_chgpasswd_user3(pipes_struct *p)
688 SAMR_Q_CHGPASSWD_USER3 q_u;
689 SAMR_R_CHGPASSWD_USER3 r_u;
690 prs_struct *data = &p->in_data.data;
691 prs_struct *rdata = &p->out_data.rdata;
693 ZERO_STRUCT(q_u);
694 ZERO_STRUCT(r_u);
696 /* change password request */
697 if (!samr_io_q_chgpasswd_user3("", &q_u, data, 0)) {
698 DEBUG(0,("api_samr_chgpasswd_user3: Failed to unmarshall SAMR_Q_CHGPASSWD_USER3.\n"));
699 return False;
702 r_u.status = _samr_chgpasswd_user3(p, &q_u, &r_u);
704 /* store the response in the SMB stream */
705 if(!samr_io_r_chgpasswd_user3("", &r_u, rdata, 0)) {
706 DEBUG(0,("api_samr_chgpasswd_user3: Failed to marshall SAMR_R_CHGPASSWD_USER3.\n" ));
707 return False;
710 return True;
713 /*******************************************************************
714 api_samr_connect5
715 ********************************************************************/
717 static BOOL api_samr_connect5(pipes_struct *p)
719 SAMR_Q_CONNECT5 q_u;
720 SAMR_R_CONNECT5 r_u;
721 prs_struct *data = &p->in_data.data;
722 prs_struct *rdata = &p->out_data.rdata;
724 ZERO_STRUCT(q_u);
725 ZERO_STRUCT(r_u);
727 /* grab the samr open policy */
728 if(!samr_io_q_connect5("", &q_u, data, 0)) {
729 DEBUG(0,("api_samr_connect5: unable to unmarshall SAMR_Q_CONNECT5.\n"));
730 return False;
733 r_u.status = _samr_connect5(p, &q_u, &r_u);
735 /* store the response in the SMB stream */
736 if(!samr_io_r_connect5("", &r_u, rdata, 0)) {
737 DEBUG(0,("api_samr_connect5: unable to marshall SAMR_R_CONNECT5.\n"));
738 return False;
741 return True;
744 /**********************************************************************
745 api_samr_lookup_domain
746 **********************************************************************/
748 static BOOL api_samr_lookup_domain(pipes_struct *p)
750 SAMR_Q_LOOKUP_DOMAIN q_u;
751 SAMR_R_LOOKUP_DOMAIN r_u;
752 prs_struct *data = &p->in_data.data;
753 prs_struct *rdata = &p->out_data.rdata;
755 ZERO_STRUCT(q_u);
756 ZERO_STRUCT(r_u);
758 if(!samr_io_q_lookup_domain("", &q_u, data, 0)) {
759 DEBUG(0,("api_samr_lookup_domain: Unable to unmarshall SAMR_Q_LOOKUP_DOMAIN.\n"));
760 return False;
763 r_u.status = _samr_lookup_domain(p, &q_u, &r_u);
765 if(!samr_io_r_lookup_domain("", &r_u, rdata, 0)){
766 DEBUG(0,("api_samr_lookup_domain: Unable to marshall SAMR_R_LOOKUP_DOMAIN.\n"));
767 return False;
770 return True;
773 /**********************************************************************
774 api_samr_enum_domains
775 **********************************************************************/
777 static BOOL api_samr_enum_domains(pipes_struct *p)
779 SAMR_Q_ENUM_DOMAINS q_u;
780 SAMR_R_ENUM_DOMAINS r_u;
781 prs_struct *data = &p->in_data.data;
782 prs_struct *rdata = &p->out_data.rdata;
784 ZERO_STRUCT(q_u);
785 ZERO_STRUCT(r_u);
787 if(!samr_io_q_enum_domains("", &q_u, data, 0)) {
788 DEBUG(0,("api_samr_enum_domains: Unable to unmarshall SAMR_Q_ENUM_DOMAINS.\n"));
789 return False;
792 r_u.status = _samr_enum_domains(p, &q_u, &r_u);
794 if(!samr_io_r_enum_domains("", &r_u, rdata, 0)) {
795 DEBUG(0,("api_samr_enum_domains: Unable to marshall SAMR_R_ENUM_DOMAINS.\n"));
796 return False;
799 return True;
802 /*******************************************************************
803 api_samr_open_alias
804 ********************************************************************/
806 static BOOL api_samr_open_alias(pipes_struct *p)
808 SAMR_Q_OPEN_ALIAS q_u;
809 SAMR_R_OPEN_ALIAS r_u;
810 prs_struct *data = &p->in_data.data;
811 prs_struct *rdata = &p->out_data.rdata;
813 ZERO_STRUCT(q_u);
814 ZERO_STRUCT(r_u);
816 /* grab the samr open policy */
817 if(!samr_io_q_open_alias("", &q_u, data, 0)) {
818 DEBUG(0,("api_samr_open_alias: Unable to unmarshall SAMR_Q_OPEN_ALIAS.\n"));
819 return False;
822 r_u.status=_samr_open_alias(p, &q_u, &r_u);
824 /* store the response in the SMB stream */
825 if(!samr_io_r_open_alias("", &r_u, rdata, 0)) {
826 DEBUG(0,("api_samr_open_alias: Unable to marshall SAMR_R_OPEN_ALIAS.\n"));
827 return False;
830 return True;
833 /*******************************************************************
834 api_samr_set_userinfo
835 ********************************************************************/
837 static BOOL api_samr_set_userinfo(pipes_struct *p)
839 SAMR_Q_SET_USERINFO q_u;
840 SAMR_R_SET_USERINFO r_u;
841 prs_struct *data = &p->in_data.data;
842 prs_struct *rdata = &p->out_data.rdata;
844 ZERO_STRUCT(q_u);
845 ZERO_STRUCT(r_u);
847 if (!samr_io_q_set_userinfo("", &q_u, data, 0)) {
848 DEBUG(0,("api_samr_set_userinfo: Unable to unmarshall SAMR_Q_SET_USERINFO.\n"));
849 /* Fix for W2K SP2 */
850 /* what is that status-code ? - gd */
851 if (q_u.switch_value == 0x1a) {
852 setup_fault_pdu(p, NT_STATUS(0x1c000006));
853 return True;
855 return False;
858 r_u.status = _samr_set_userinfo(p, &q_u, &r_u);
860 if(!samr_io_r_set_userinfo("", &r_u, rdata, 0)) {
861 DEBUG(0,("api_samr_set_userinfo: Unable to marshall SAMR_R_SET_USERINFO.\n"));
862 return False;
865 return True;
868 /*******************************************************************
869 api_samr_set_userinfo2
870 ********************************************************************/
872 static BOOL api_samr_set_userinfo2(pipes_struct *p)
874 SAMR_Q_SET_USERINFO2 q_u;
875 SAMR_R_SET_USERINFO2 r_u;
877 prs_struct *data = &p->in_data.data;
878 prs_struct *rdata = &p->out_data.rdata;
880 ZERO_STRUCT(q_u);
881 ZERO_STRUCT(r_u);
883 if (!samr_io_q_set_userinfo2("", &q_u, data, 0)) {
884 DEBUG(0,("api_samr_set_userinfo2: Unable to unmarshall SAMR_Q_SET_USERINFO2.\n"));
885 return False;
888 r_u.status = _samr_set_userinfo2(p, &q_u, &r_u);
890 if(!samr_io_r_set_userinfo2("", &r_u, rdata, 0)) {
891 DEBUG(0,("api_samr_set_userinfo2: Unable to marshall SAMR_R_SET_USERINFO2.\n"));
892 return False;
895 return True;
898 /*******************************************************************
899 api_samr_query_useraliases
900 ********************************************************************/
902 static BOOL api_samr_query_useraliases(pipes_struct *p)
904 SAMR_Q_QUERY_USERALIASES q_u;
905 SAMR_R_QUERY_USERALIASES r_u;
907 prs_struct *data = &p->in_data.data;
908 prs_struct *rdata = &p->out_data.rdata;
910 ZERO_STRUCT(q_u);
911 ZERO_STRUCT(r_u);
913 if (!samr_io_q_query_useraliases("", &q_u, data, 0)) {
914 DEBUG(0,("api_samr_query_useraliases: Unable to unmarshall SAMR_Q_QUERY_USERALIASES.\n"));
915 return False;
918 r_u.status = _samr_query_useraliases(p, &q_u, &r_u);
920 if (! samr_io_r_query_useraliases("", &r_u, rdata, 0)) {
921 DEBUG(0,("api_samr_query_useraliases: Unable to nmarshall SAMR_R_QUERY_USERALIASES.\n"));
922 return False;
925 return True;
928 /*******************************************************************
929 api_samr_query_aliasmem
930 ********************************************************************/
932 static BOOL api_samr_query_aliasmem(pipes_struct *p)
934 SAMR_Q_QUERY_ALIASMEM q_u;
935 SAMR_R_QUERY_ALIASMEM r_u;
937 prs_struct *data = &p->in_data.data;
938 prs_struct *rdata = &p->out_data.rdata;
940 ZERO_STRUCT(q_u);
941 ZERO_STRUCT(r_u);
943 if (!samr_io_q_query_aliasmem("", &q_u, data, 0)) {
944 DEBUG(0,("api_samr_query_aliasmem: unable to unmarshall SAMR_Q_QUERY_ALIASMEM.\n"));
945 return False;
948 r_u.status = _samr_query_aliasmem(p, &q_u, &r_u);
950 if (!samr_io_r_query_aliasmem("", &r_u, rdata, 0)) {
951 DEBUG(0,("api_samr_query_aliasmem: unable to marshall SAMR_R_QUERY_ALIASMEM.\n"));
952 return False;
955 return True;
958 /*******************************************************************
959 api_samr_query_groupmem
960 ********************************************************************/
962 static BOOL api_samr_query_groupmem(pipes_struct *p)
964 SAMR_Q_QUERY_GROUPMEM q_u;
965 SAMR_R_QUERY_GROUPMEM r_u;
967 prs_struct *data = &p->in_data.data;
968 prs_struct *rdata = &p->out_data.rdata;
970 ZERO_STRUCT(q_u);
971 ZERO_STRUCT(r_u);
973 if (!samr_io_q_query_groupmem("", &q_u, data, 0)) {
974 DEBUG(0,("api_samr_query_groupmem: unable to unmarshall SAMR_Q_QUERY_GROUPMEM.\n"));
975 return False;
978 r_u.status = _samr_query_groupmem(p, &q_u, &r_u);
980 if (!samr_io_r_query_groupmem("", &r_u, rdata, 0)) {
981 DEBUG(0,("api_samr_query_groupmem: unable to marshall SAMR_R_QUERY_GROUPMEM.\n"));
982 return False;
985 return True;
988 /*******************************************************************
989 api_samr_add_aliasmem
990 ********************************************************************/
992 static BOOL api_samr_add_aliasmem(pipes_struct *p)
994 SAMR_Q_ADD_ALIASMEM q_u;
995 SAMR_R_ADD_ALIASMEM r_u;
997 prs_struct *data = &p->in_data.data;
998 prs_struct *rdata = &p->out_data.rdata;
1000 ZERO_STRUCT(q_u);
1001 ZERO_STRUCT(r_u);
1003 if (!samr_io_q_add_aliasmem("", &q_u, data, 0)) {
1004 DEBUG(0,("api_samr_add_aliasmem: unable to unmarshall SAMR_Q_ADD_ALIASMEM.\n"));
1005 return False;
1008 r_u.status = _samr_add_aliasmem(p, &q_u, &r_u);
1010 if (!samr_io_r_add_aliasmem("", &r_u, rdata, 0)) {
1011 DEBUG(0,("api_samr_add_aliasmem: unable to marshall SAMR_R_ADD_ALIASMEM.\n"));
1012 return False;
1015 return True;
1018 /*******************************************************************
1019 api_samr_del_aliasmem
1020 ********************************************************************/
1022 static BOOL api_samr_del_aliasmem(pipes_struct *p)
1024 SAMR_Q_DEL_ALIASMEM q_u;
1025 SAMR_R_DEL_ALIASMEM r_u;
1027 prs_struct *data = &p->in_data.data;
1028 prs_struct *rdata = &p->out_data.rdata;
1030 ZERO_STRUCT(q_u);
1031 ZERO_STRUCT(r_u);
1033 if (!samr_io_q_del_aliasmem("", &q_u, data, 0)) {
1034 DEBUG(0,("api_samr_del_aliasmem: unable to unmarshall SAMR_Q_DEL_ALIASMEM.\n"));
1035 return False;
1038 r_u.status = _samr_del_aliasmem(p, &q_u, &r_u);
1040 if (!samr_io_r_del_aliasmem("", &r_u, rdata, 0)) {
1041 DEBUG(0,("api_samr_del_aliasmem: unable to marshall SAMR_R_DEL_ALIASMEM.\n"));
1042 return False;
1045 return True;
1048 /*******************************************************************
1049 api_samr_add_groupmem
1050 ********************************************************************/
1052 static BOOL api_samr_add_groupmem(pipes_struct *p)
1054 SAMR_Q_ADD_GROUPMEM q_u;
1055 SAMR_R_ADD_GROUPMEM r_u;
1057 prs_struct *data = &p->in_data.data;
1058 prs_struct *rdata = &p->out_data.rdata;
1060 ZERO_STRUCT(q_u);
1061 ZERO_STRUCT(r_u);
1063 if (!samr_io_q_add_groupmem("", &q_u, data, 0)) {
1064 DEBUG(0,("api_samr_add_groupmem: unable to unmarshall SAMR_Q_ADD_GROUPMEM.\n"));
1065 return False;
1068 r_u.status = _samr_add_groupmem(p, &q_u, &r_u);
1070 if (!samr_io_r_add_groupmem("", &r_u, rdata, 0)) {
1071 DEBUG(0,("api_samr_add_groupmem: unable to marshall SAMR_R_ADD_GROUPMEM.\n"));
1072 return False;
1075 return True;
1078 /*******************************************************************
1079 api_samr_del_groupmem
1080 ********************************************************************/
1082 static BOOL api_samr_del_groupmem(pipes_struct *p)
1084 SAMR_Q_DEL_GROUPMEM q_u;
1085 SAMR_R_DEL_GROUPMEM r_u;
1087 prs_struct *data = &p->in_data.data;
1088 prs_struct *rdata = &p->out_data.rdata;
1090 ZERO_STRUCT(q_u);
1091 ZERO_STRUCT(r_u);
1093 if (!samr_io_q_del_groupmem("", &q_u, data, 0)) {
1094 DEBUG(0,("api_samr_del_groupmem: unable to unmarshall SAMR_Q_DEL_GROUPMEM.\n"));
1095 return False;
1098 r_u.status = _samr_del_groupmem(p, &q_u, &r_u);
1100 if (!samr_io_r_del_groupmem("", &r_u, rdata, 0)) {
1101 DEBUG(0,("api_samr_del_groupmem: unable to marshall SAMR_R_DEL_GROUPMEM.\n"));
1102 return False;
1105 return True;
1108 /*******************************************************************
1109 api_samr_delete_dom_user
1110 ********************************************************************/
1112 static BOOL api_samr_delete_dom_user(pipes_struct *p)
1114 SAMR_Q_DELETE_DOM_USER q_u;
1115 SAMR_R_DELETE_DOM_USER r_u;
1117 prs_struct *data = &p->in_data.data;
1118 prs_struct *rdata = &p->out_data.rdata;
1120 ZERO_STRUCT(q_u);
1121 ZERO_STRUCT(r_u);
1123 if (!samr_io_q_delete_dom_user("", &q_u, data, 0)) {
1124 DEBUG(0,("api_samr_delete_dom_user: unable to unmarshall SAMR_Q_DELETE_DOM_USER.\n"));
1125 return False;
1128 r_u.status = _samr_delete_dom_user(p, &q_u, &r_u);
1130 if (!samr_io_r_delete_dom_user("", &r_u, rdata, 0)) {
1131 DEBUG(0,("api_samr_delete_dom_user: unable to marshall SAMR_R_DELETE_DOM_USER.\n"));
1132 return False;
1135 return True;
1138 /*******************************************************************
1139 api_samr_delete_dom_group
1140 ********************************************************************/
1142 static BOOL api_samr_delete_dom_group(pipes_struct *p)
1144 SAMR_Q_DELETE_DOM_GROUP q_u;
1145 SAMR_R_DELETE_DOM_GROUP r_u;
1147 prs_struct *data = &p->in_data.data;
1148 prs_struct *rdata = &p->out_data.rdata;
1150 ZERO_STRUCT(q_u);
1151 ZERO_STRUCT(r_u);
1153 if (!samr_io_q_delete_dom_group("", &q_u, data, 0)) {
1154 DEBUG(0,("api_samr_delete_dom_group: unable to unmarshall SAMR_Q_DELETE_DOM_GROUP.\n"));
1155 return False;
1158 r_u.status = _samr_delete_dom_group(p, &q_u, &r_u);
1160 if (!samr_io_r_delete_dom_group("", &r_u, rdata, 0)) {
1161 DEBUG(0,("api_samr_delete_dom_group: unable to marshall SAMR_R_DELETE_DOM_GROUP.\n"));
1162 return False;
1165 return True;
1168 /*******************************************************************
1169 api_samr_delete_dom_alias
1170 ********************************************************************/
1172 static BOOL api_samr_delete_dom_alias(pipes_struct *p)
1174 SAMR_Q_DELETE_DOM_ALIAS q_u;
1175 SAMR_R_DELETE_DOM_ALIAS r_u;
1177 prs_struct *data = &p->in_data.data;
1178 prs_struct *rdata = &p->out_data.rdata;
1180 ZERO_STRUCT(q_u);
1181 ZERO_STRUCT(r_u);
1183 if (!samr_io_q_delete_dom_alias("", &q_u, data, 0)) {
1184 DEBUG(0,("api_samr_delete_dom_alias: unable to unmarshall SAMR_Q_DELETE_DOM_ALIAS.\n"));
1185 return False;
1188 r_u.status = _samr_delete_dom_alias(p, &q_u, &r_u);
1190 if (!samr_io_r_delete_dom_alias("", &r_u, rdata, 0)) {
1191 DEBUG(0,("api_samr_delete_dom_alias: unable to marshall SAMR_R_DELETE_DOM_ALIAS.\n"));
1192 return False;
1195 return True;
1198 /*******************************************************************
1199 api_samr_create_dom_group
1200 ********************************************************************/
1202 static BOOL api_samr_create_dom_group(pipes_struct *p)
1204 SAMR_Q_CREATE_DOM_GROUP q_u;
1205 SAMR_R_CREATE_DOM_GROUP r_u;
1207 prs_struct *data = &p->in_data.data;
1208 prs_struct *rdata = &p->out_data.rdata;
1210 ZERO_STRUCT(q_u);
1211 ZERO_STRUCT(r_u);
1213 if (!samr_io_q_create_dom_group("", &q_u, data, 0)) {
1214 DEBUG(0,("api_samr_create_dom_group: unable to unmarshall SAMR_Q_CREATE_DOM_GROUP.\n"));
1215 return False;
1218 r_u.status = _samr_create_dom_group(p, &q_u, &r_u);
1220 if (!samr_io_r_create_dom_group("", &r_u, rdata, 0)) {
1221 DEBUG(0,("api_samr_create_dom_group: unable to marshall SAMR_R_CREATE_DOM_GROUP.\n"));
1222 return False;
1225 return True;
1228 /*******************************************************************
1229 api_samr_create_dom_alias
1230 ********************************************************************/
1232 static BOOL api_samr_create_dom_alias(pipes_struct *p)
1234 SAMR_Q_CREATE_DOM_ALIAS q_u;
1235 SAMR_R_CREATE_DOM_ALIAS r_u;
1237 prs_struct *data = &p->in_data.data;
1238 prs_struct *rdata = &p->out_data.rdata;
1240 ZERO_STRUCT(q_u);
1241 ZERO_STRUCT(r_u);
1243 if (!samr_io_q_create_dom_alias("", &q_u, data, 0)) {
1244 DEBUG(0,("api_samr_create_dom_alias: unable to unmarshall SAMR_Q_CREATE_DOM_ALIAS.\n"));
1245 return False;
1248 r_u.status = _samr_create_dom_alias(p, &q_u, &r_u);
1250 if (!samr_io_r_create_dom_alias("", &r_u, rdata, 0)) {
1251 DEBUG(0,("api_samr_create_dom_alias: unable to marshall SAMR_R_CREATE_DOM_ALIAS.\n"));
1252 return False;
1255 return True;
1258 /*******************************************************************
1259 api_samr_query_groupinfo
1260 ********************************************************************/
1262 static BOOL api_samr_query_groupinfo(pipes_struct *p)
1264 SAMR_Q_QUERY_GROUPINFO q_u;
1265 SAMR_R_QUERY_GROUPINFO r_u;
1267 prs_struct *data = &p->in_data.data;
1268 prs_struct *rdata = &p->out_data.rdata;
1270 ZERO_STRUCT(q_u);
1271 ZERO_STRUCT(r_u);
1273 if (!samr_io_q_query_groupinfo("", &q_u, data, 0)) {
1274 DEBUG(0,("api_samr_query_groupinfo: unable to unmarshall SAMR_Q_QUERY_GROUPINFO.\n"));
1275 return False;
1278 r_u.status = _samr_query_groupinfo(p, &q_u, &r_u);
1280 if (!samr_io_r_query_groupinfo("", &r_u, rdata, 0)) {
1281 DEBUG(0,("api_samr_query_groupinfo: unable to marshall SAMR_R_QUERY_GROUPINFO.\n"));
1282 return False;
1285 return True;
1288 /*******************************************************************
1289 api_samr_set_groupinfo
1290 ********************************************************************/
1292 static BOOL api_samr_set_groupinfo(pipes_struct *p)
1294 SAMR_Q_SET_GROUPINFO q_u;
1295 SAMR_R_SET_GROUPINFO r_u;
1297 prs_struct *data = &p->in_data.data;
1298 prs_struct *rdata = &p->out_data.rdata;
1300 ZERO_STRUCT(q_u);
1301 ZERO_STRUCT(r_u);
1303 if (!samr_io_q_set_groupinfo("", &q_u, data, 0)) {
1304 DEBUG(0,("api_samr_set_groupinfo: unable to unmarshall SAMR_Q_SET_GROUPINFO.\n"));
1305 return False;
1308 r_u.status = _samr_set_groupinfo(p, &q_u, &r_u);
1310 if (!samr_io_r_set_groupinfo("", &r_u, rdata, 0)) {
1311 DEBUG(0,("api_samr_set_groupinfo: unable to marshall SAMR_R_SET_GROUPINFO.\n"));
1312 return False;
1315 return True;
1318 /*******************************************************************
1319 api_samr_set_aliasinfo
1320 ********************************************************************/
1322 static BOOL api_samr_set_aliasinfo(pipes_struct *p)
1324 SAMR_Q_SET_ALIASINFO q_u;
1325 SAMR_R_SET_ALIASINFO r_u;
1327 prs_struct *data = &p->in_data.data;
1328 prs_struct *rdata = &p->out_data.rdata;
1330 ZERO_STRUCT(q_u);
1331 ZERO_STRUCT(r_u);
1333 if (!samr_io_q_set_aliasinfo("", &q_u, data, 0)) {
1334 DEBUG(0,("api_samr_set_aliasinfo: unable to unmarshall SAMR_Q_SET_ALIASINFO.\n"));
1335 return False;
1338 r_u.status = _samr_set_aliasinfo(p, &q_u, &r_u);
1340 if (!samr_io_r_set_aliasinfo("", &r_u, rdata, 0)) {
1341 DEBUG(0,("api_samr_set_aliasinfo: unable to marshall SAMR_R_SET_ALIASINFO.\n"));
1342 return False;
1345 return True;
1348 /*******************************************************************
1349 api_samr_get_dom_pwinfo
1350 ********************************************************************/
1352 static BOOL api_samr_get_dom_pwinfo(pipes_struct *p)
1354 SAMR_Q_GET_DOM_PWINFO q_u;
1355 SAMR_R_GET_DOM_PWINFO r_u;
1357 prs_struct *data = &p->in_data.data;
1358 prs_struct *rdata = &p->out_data.rdata;
1360 ZERO_STRUCT(q_u);
1361 ZERO_STRUCT(r_u);
1363 if (!samr_io_q_get_dom_pwinfo("", &q_u, data, 0)) {
1364 DEBUG(0,("api_samr_get_dom_pwinfo: unable to unmarshall SAMR_Q_GET_DOM_PWINFO.\n"));
1365 return False;
1368 r_u.status = _samr_get_dom_pwinfo(p, &q_u, &r_u);
1370 if (!samr_io_r_get_dom_pwinfo("", &r_u, rdata, 0)) {
1371 DEBUG(0,("api_samr_get_dom_pwinfo: unable to marshall SAMR_R_GET_DOM_PWINFO.\n"));
1372 return False;
1375 return True;
1378 /*******************************************************************
1379 api_samr_open_group
1380 ********************************************************************/
1382 static BOOL api_samr_open_group(pipes_struct *p)
1384 SAMR_Q_OPEN_GROUP q_u;
1385 SAMR_R_OPEN_GROUP r_u;
1387 prs_struct *data = &p->in_data.data;
1388 prs_struct *rdata = &p->out_data.rdata;
1390 ZERO_STRUCT(q_u);
1391 ZERO_STRUCT(r_u);
1393 if (!samr_io_q_open_group("", &q_u, data, 0)) {
1394 DEBUG(0,("api_samr_open_group: unable to unmarshall SAMR_Q_OPEN_GROUP.\n"));
1395 return False;
1398 r_u.status = _samr_open_group(p, &q_u, &r_u);
1400 if (!samr_io_r_open_group("", &r_u, rdata, 0)) {
1401 DEBUG(0,("api_samr_open_group: unable to marshall SAMR_R_OPEN_GROUP.\n"));
1402 return False;
1405 return True;
1408 /*******************************************************************
1409 api_samr_remove_sid_foreign_domain
1410 ********************************************************************/
1412 static BOOL api_samr_remove_sid_foreign_domain(pipes_struct *p)
1414 SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN q_u;
1415 SAMR_R_REMOVE_SID_FOREIGN_DOMAIN r_u;
1417 prs_struct *data = &p->in_data.data;
1418 prs_struct *rdata = &p->out_data.rdata;
1420 ZERO_STRUCT(q_u);
1421 ZERO_STRUCT(r_u);
1423 if (!samr_io_q_remove_sid_foreign_domain("", &q_u, data, 0)) {
1424 DEBUG(0,("api_samr_remove_sid_foreign_domain: unable to unmarshall SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN.\n"));
1425 return False;
1428 r_u.status = _samr_remove_sid_foreign_domain(p, &q_u, &r_u);
1430 if (!samr_io_r_remove_sid_foreign_domain("", &r_u, rdata, 0)) {
1431 DEBUG(0,("api_samr_remove_sid_foreign_domain: unable to marshall SAMR_R_REMOVE_SID_FOREIGN_DOMAIN.\n"));
1432 return False;
1435 return True;
1438 /*******************************************************************
1439 api_samr_query_dom_info2
1440 ********************************************************************/
1442 static BOOL api_samr_query_domain_info2(pipes_struct *p)
1444 SAMR_Q_QUERY_DOMAIN_INFO2 q_u;
1445 SAMR_R_QUERY_DOMAIN_INFO2 r_u;
1446 prs_struct *data = &p->in_data.data;
1447 prs_struct *rdata = &p->out_data.rdata;
1449 ZERO_STRUCT(q_u);
1450 ZERO_STRUCT(r_u);
1452 /* grab the samr unknown 8 command */
1453 if(!samr_io_q_query_domain_info2("", &q_u, data, 0)) {
1454 DEBUG(0,("api_samr_query_domain_info2: unable to unmarshall SAMR_Q_QUERY_DOMAIN_INFO2.\n"));
1455 return False;
1458 r_u.status = _samr_query_domain_info2(p, &q_u, &r_u);
1460 /* store the response in the SMB stream */
1461 if(!samr_io_r_samr_query_domain_info2("", &r_u, rdata, 0)) {
1462 DEBUG(0,("api_samr_query_domain_info2: unable to marshall SAMR_R_QUERY_DOMAIN_INFO2.\n"));
1463 return False;
1466 return True;
1469 /*******************************************************************
1470 api_samr_set_dom_info
1471 ********************************************************************/
1473 static BOOL api_samr_set_dom_info(pipes_struct *p)
1475 SAMR_Q_SET_DOMAIN_INFO q_u;
1476 SAMR_R_SET_DOMAIN_INFO r_u;
1477 prs_struct *data = &p->in_data.data;
1478 prs_struct *rdata = &p->out_data.rdata;
1480 ZERO_STRUCT(q_u);
1481 ZERO_STRUCT(r_u);
1483 if(!samr_io_q_set_domain_info("", &q_u, data, 0)) {
1484 DEBUG(0,("api_samr_set_dom_info: unable to unmarshall SAMR_Q_SET_DOMAIN_INFO.\n"));
1485 return False;
1488 r_u.status = _samr_set_dom_info(p, &q_u, &r_u);
1490 /* store the response in the SMB stream */
1491 if(!samr_io_r_set_domain_info("", &r_u, rdata, 0)) {
1492 DEBUG(0,("api_samr_set_dom_info: unable to marshall SAMR_R_SET_DOMAIN_INFO.\n"));
1493 return False;
1496 return True;
1499 /*******************************************************************
1500 array of \PIPE\samr operations
1501 ********************************************************************/
1503 static struct api_struct api_samr_cmds [] =
1505 {"SAMR_CLOSE_HND" , SAMR_CLOSE_HND , api_samr_close_hnd },
1506 {"SAMR_CONNECT" , SAMR_CONNECT , api_samr_connect },
1507 {"SAMR_CONNECT_ANON" , SAMR_CONNECT_ANON , api_samr_connect_anon },
1508 {"SAMR_ENUM_DOMAINS" , SAMR_ENUM_DOMAINS , api_samr_enum_domains },
1509 {"SAMR_ENUM_DOM_USERS" , SAMR_ENUM_DOM_USERS , api_samr_enum_dom_users },
1511 {"SAMR_ENUM_DOM_GROUPS" , SAMR_ENUM_DOM_GROUPS , api_samr_enum_dom_groups },
1512 {"SAMR_ENUM_DOM_ALIASES" , SAMR_ENUM_DOM_ALIASES , api_samr_enum_dom_aliases },
1513 {"SAMR_QUERY_USERALIASES" , SAMR_QUERY_USERALIASES, api_samr_query_useraliases},
1514 {"SAMR_QUERY_ALIASMEM" , SAMR_QUERY_ALIASMEM , api_samr_query_aliasmem },
1515 {"SAMR_QUERY_GROUPMEM" , SAMR_QUERY_GROUPMEM , api_samr_query_groupmem },
1516 {"SAMR_ADD_ALIASMEM" , SAMR_ADD_ALIASMEM , api_samr_add_aliasmem },
1517 {"SAMR_DEL_ALIASMEM" , SAMR_DEL_ALIASMEM , api_samr_del_aliasmem },
1518 {"SAMR_ADD_GROUPMEM" , SAMR_ADD_GROUPMEM , api_samr_add_groupmem },
1519 {"SAMR_DEL_GROUPMEM" , SAMR_DEL_GROUPMEM , api_samr_del_groupmem },
1521 {"SAMR_DELETE_DOM_USER" , SAMR_DELETE_DOM_USER , api_samr_delete_dom_user },
1522 {"SAMR_DELETE_DOM_GROUP" , SAMR_DELETE_DOM_GROUP , api_samr_delete_dom_group },
1523 {"SAMR_DELETE_DOM_ALIAS" , SAMR_DELETE_DOM_ALIAS , api_samr_delete_dom_alias },
1524 {"SAMR_CREATE_DOM_GROUP" , SAMR_CREATE_DOM_GROUP , api_samr_create_dom_group },
1525 {"SAMR_CREATE_DOM_ALIAS" , SAMR_CREATE_DOM_ALIAS , api_samr_create_dom_alias },
1526 {"SAMR_LOOKUP_NAMES" , SAMR_LOOKUP_NAMES , api_samr_lookup_names },
1527 {"SAMR_OPEN_USER" , SAMR_OPEN_USER , api_samr_open_user },
1528 {"SAMR_QUERY_USERINFO" , SAMR_QUERY_USERINFO , api_samr_query_userinfo },
1529 {"SAMR_SET_USERINFO" , SAMR_SET_USERINFO , api_samr_set_userinfo },
1530 {"SAMR_SET_USERINFO2" , SAMR_SET_USERINFO2 , api_samr_set_userinfo2 },
1532 {"SAMR_QUERY_DOMAIN_INFO" , SAMR_QUERY_DOMAIN_INFO, api_samr_query_dom_info },
1533 {"SAMR_QUERY_USERGROUPS" , SAMR_QUERY_USERGROUPS , api_samr_query_usergroups },
1534 {"SAMR_QUERY_DISPINFO" , SAMR_QUERY_DISPINFO , api_samr_query_dispinfo },
1535 {"SAMR_QUERY_DISPINFO3" , SAMR_QUERY_DISPINFO3 , api_samr_query_dispinfo },
1536 {"SAMR_QUERY_DISPINFO4" , SAMR_QUERY_DISPINFO4 , api_samr_query_dispinfo },
1538 {"SAMR_QUERY_ALIASINFO" , SAMR_QUERY_ALIASINFO , api_samr_query_aliasinfo },
1539 {"SAMR_QUERY_GROUPINFO" , SAMR_QUERY_GROUPINFO , api_samr_query_groupinfo },
1540 {"SAMR_SET_GROUPINFO" , SAMR_SET_GROUPINFO , api_samr_set_groupinfo },
1541 {"SAMR_SET_ALIASINFO" , SAMR_SET_ALIASINFO , api_samr_set_aliasinfo },
1542 {"SAMR_CREATE_USER" , SAMR_CREATE_USER , api_samr_create_user },
1543 {"SAMR_LOOKUP_RIDS" , SAMR_LOOKUP_RIDS , api_samr_lookup_rids },
1544 {"SAMR_GET_DOM_PWINFO" , SAMR_GET_DOM_PWINFO , api_samr_get_dom_pwinfo },
1545 {"SAMR_CHGPASSWD_USER" , SAMR_CHGPASSWD_USER , api_samr_chgpasswd_user },
1546 {"SAMR_OPEN_ALIAS" , SAMR_OPEN_ALIAS , api_samr_open_alias },
1547 {"SAMR_OPEN_GROUP" , SAMR_OPEN_GROUP , api_samr_open_group },
1548 {"SAMR_OPEN_DOMAIN" , SAMR_OPEN_DOMAIN , api_samr_open_domain },
1549 {"SAMR_REMOVE_SID_FOREIGN_DOMAIN" , SAMR_REMOVE_SID_FOREIGN_DOMAIN , api_samr_remove_sid_foreign_domain },
1550 {"SAMR_LOOKUP_DOMAIN" , SAMR_LOOKUP_DOMAIN , api_samr_lookup_domain },
1552 {"SAMR_QUERY_SEC_OBJECT" , SAMR_QUERY_SEC_OBJECT , api_samr_query_sec_obj },
1553 {"SAMR_SET_SEC_OBJECT" , SAMR_SET_SEC_OBJECT , api_samr_set_sec_obj },
1554 {"SAMR_GET_USRDOM_PWINFO" , SAMR_GET_USRDOM_PWINFO, api_samr_get_usrdom_pwinfo},
1555 {"SAMR_QUERY_DOMAIN_INFO2", SAMR_QUERY_DOMAIN_INFO2, api_samr_query_domain_info2},
1556 {"SAMR_SET_DOMAIN_INFO" , SAMR_SET_DOMAIN_INFO , api_samr_set_dom_info },
1557 {"SAMR_CONNECT4" , SAMR_CONNECT4 , api_samr_connect4 },
1558 {"SAMR_CHGPASSWD_USER3" , SAMR_CHGPASSWD_USER3 , api_samr_chgpasswd_user3 },
1559 {"SAMR_CONNECT5" , SAMR_CONNECT5 , api_samr_connect5 }
1562 void samr_get_pipe_fns( struct api_struct **fns, int *n_fns )
1564 *fns = api_samr_cmds;
1565 *n_fns = sizeof(api_samr_cmds) / sizeof(struct api_struct);
1569 NTSTATUS rpc_samr_init(void)
1571 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "lsass", api_samr_cmds,
1572 sizeof(api_samr_cmds) / sizeof(struct api_struct));