Patch 2 of 3 from Debian Samba packagers:
[Samba.git] / source / rpc_server / srv_samr.c
bloba1deac083df45bd17fc9a1c44204a0f8b6ab700a
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 3 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, see <http://www.gnu.org/licenses/>.
30 * This is the interface to the SAMR code.
33 #include "includes.h"
35 #undef DBGC_CLASS
36 #define DBGC_CLASS DBGC_RPC_SRV
38 /*******************************************************************
39 api_samr_close_hnd
40 ********************************************************************/
42 static bool api_samr_close_hnd(pipes_struct *p)
44 SAMR_Q_CLOSE_HND q_u;
45 SAMR_R_CLOSE_HND r_u;
46 prs_struct *data = &p->in_data.data;
47 prs_struct *rdata = &p->out_data.rdata;
49 ZERO_STRUCT(q_u);
50 ZERO_STRUCT(r_u);
52 if(!samr_io_q_close_hnd("", &q_u, data, 0)) {
53 DEBUG(0,("api_samr_close_hnd: unable to unmarshall SAMR_Q_CLOSE_HND.\n"));
54 return False;
57 r_u.status = _samr_close_hnd(p, &q_u, &r_u);
59 /* store the response in the SMB stream */
60 if(!samr_io_r_close_hnd("", &r_u, rdata, 0)) {
61 DEBUG(0,("api_samr_close_hnd: unable to marshall SAMR_R_CLOSE_HND.\n"));
62 return False;
65 return True;
68 /*******************************************************************
69 api_samr_open_domain
70 ********************************************************************/
72 static bool api_samr_open_domain(pipes_struct *p)
74 SAMR_Q_OPEN_DOMAIN q_u;
75 SAMR_R_OPEN_DOMAIN r_u;
77 prs_struct *data = &p->in_data.data;
78 prs_struct *rdata = &p->out_data.rdata;
80 ZERO_STRUCT(q_u);
81 ZERO_STRUCT(r_u);
83 if(!samr_io_q_open_domain("", &q_u, data, 0)) {
84 DEBUG(0,("api_samr_open_domain: unable to unmarshall SAMR_Q_OPEN_DOMAIN.\n"));
85 return False;
88 r_u.status = _samr_open_domain(p, &q_u, &r_u);
90 /* store the response in the SMB stream */
91 if(!samr_io_r_open_domain("", &r_u, rdata, 0)) {
92 DEBUG(0,("api_samr_open_domain: unable to marshall SAMR_R_OPEN_DOMAIN.\n"));
93 return False;
96 return True;
99 /*******************************************************************
100 api_samr_get_usrdom_pwinfo
101 ********************************************************************/
103 static bool api_samr_get_usrdom_pwinfo(pipes_struct *p)
105 SAMR_Q_GET_USRDOM_PWINFO q_u;
106 SAMR_R_GET_USRDOM_PWINFO r_u;
108 prs_struct *data = &p->in_data.data;
109 prs_struct *rdata = &p->out_data.rdata;
111 ZERO_STRUCT(q_u);
112 ZERO_STRUCT(r_u);
114 if(!samr_io_q_get_usrdom_pwinfo("", &q_u, data, 0)) {
115 DEBUG(0,("api_samr_get_usrdom_pwinfo: unable to unmarshall SAMR_Q_GET_USRDOM_PWINFO.\n"));
116 return False;
119 r_u.status = _samr_get_usrdom_pwinfo(p, &q_u, &r_u);
121 if(!samr_io_r_get_usrdom_pwinfo("", &r_u, rdata, 0)) {
122 DEBUG(0,("api_samr_get_usrdom_pwinfo: unable to marshall SAMR_R_GET_USRDOM_PWINFO.\n"));
123 return False;
126 return True;
129 /*******************************************************************
130 api_samr_set_sec_obj
131 ********************************************************************/
133 static bool api_samr_set_sec_obj(pipes_struct *p)
135 SAMR_Q_SET_SEC_OBJ q_u;
136 SAMR_R_SET_SEC_OBJ r_u;
138 prs_struct *data = &p->in_data.data;
139 prs_struct *rdata = &p->out_data.rdata;
141 ZERO_STRUCT(q_u);
142 ZERO_STRUCT(r_u);
144 if(!samr_io_q_set_sec_obj("", &q_u, data, 0)) {
145 DEBUG(0,("api_samr_set_sec_obj: unable to unmarshall SAMR_Q_SET_SEC_OBJ.\n"));
146 return False;
149 r_u.status = _samr_set_sec_obj(p, &q_u, &r_u);
151 if(!samr_io_r_set_sec_obj("", &r_u, rdata, 0)) {
152 DEBUG(0,("api_samr_set_sec_obj: unable to marshall SAMR_R_SET_SEC_OBJ.\n"));
153 return False;
156 return True;
159 /*******************************************************************
160 api_samr_query_sec_obj
161 ********************************************************************/
163 static bool api_samr_query_sec_obj(pipes_struct *p)
165 SAMR_Q_QUERY_SEC_OBJ q_u;
166 SAMR_R_QUERY_SEC_OBJ r_u;
168 prs_struct *data = &p->in_data.data;
169 prs_struct *rdata = &p->out_data.rdata;
171 ZERO_STRUCT(q_u);
172 ZERO_STRUCT(r_u);
174 if(!samr_io_q_query_sec_obj("", &q_u, data, 0)) {
175 DEBUG(0,("api_samr_query_sec_obj: unable to unmarshall SAMR_Q_QUERY_SEC_OBJ.\n"));
176 return False;
179 r_u.status = _samr_query_sec_obj(p, &q_u, &r_u);
181 if(!samr_io_r_query_sec_obj("", &r_u, rdata, 0)) {
182 DEBUG(0,("api_samr_query_sec_obj: unable to marshall SAMR_R_QUERY_SEC_OBJ.\n"));
183 return False;
186 return True;
189 /*******************************************************************
190 api_samr_enum_dom_users
191 ********************************************************************/
193 static bool api_samr_enum_dom_users(pipes_struct *p)
195 SAMR_Q_ENUM_DOM_USERS q_u;
196 SAMR_R_ENUM_DOM_USERS r_u;
197 prs_struct *data = &p->in_data.data;
198 prs_struct *rdata = &p->out_data.rdata;
200 ZERO_STRUCT(q_u);
201 ZERO_STRUCT(r_u);
203 /* grab the samr open */
204 if(!samr_io_q_enum_dom_users("", &q_u, data, 0)) {
205 DEBUG(0,("api_samr_enum_dom_users: unable to unmarshall SAMR_Q_ENUM_DOM_USERS.\n"));
206 return False;
209 r_u.status = _samr_enum_dom_users(p, &q_u, &r_u);
211 /* store the response in the SMB stream */
212 if(!samr_io_r_enum_dom_users("", &r_u, rdata, 0)) {
213 DEBUG(0,("api_samr_enum_dom_users: unable to marshall SAMR_R_ENUM_DOM_USERS.\n"));
214 return False;
217 return True;
220 /*******************************************************************
221 api_samr_enum_dom_groups
222 ********************************************************************/
224 static bool api_samr_enum_dom_groups(pipes_struct *p)
226 SAMR_Q_ENUM_DOM_GROUPS q_u;
227 SAMR_R_ENUM_DOM_GROUPS r_u;
228 prs_struct *data = &p->in_data.data;
229 prs_struct *rdata = &p->out_data.rdata;
231 ZERO_STRUCT(q_u);
232 ZERO_STRUCT(r_u);
234 /* grab the samr open */
235 if(!samr_io_q_enum_dom_groups("", &q_u, data, 0)) {
236 DEBUG(0,("api_samr_enum_dom_groups: unable to unmarshall SAMR_Q_ENUM_DOM_GROUPS.\n"));
237 return False;
240 r_u.status = _samr_enum_dom_groups(p, &q_u, &r_u);
242 /* store the response in the SMB stream */
243 if(!samr_io_r_enum_dom_groups("", &r_u, rdata, 0)) {
244 DEBUG(0,("api_samr_enum_dom_groups: unable to marshall SAMR_R_ENUM_DOM_GROUPS.\n"));
245 return False;
248 return True;
251 /*******************************************************************
252 api_samr_enum_dom_aliases
253 ********************************************************************/
255 static bool api_samr_enum_dom_aliases(pipes_struct *p)
257 SAMR_Q_ENUM_DOM_ALIASES q_u;
258 SAMR_R_ENUM_DOM_ALIASES r_u;
259 prs_struct *data = &p->in_data.data;
260 prs_struct *rdata = &p->out_data.rdata;
262 ZERO_STRUCT(q_u);
263 ZERO_STRUCT(r_u);
265 /* grab the samr open */
266 if(!samr_io_q_enum_dom_aliases("", &q_u, data, 0)) {
267 DEBUG(0,("api_samr_enum_dom_aliases: unable to unmarshall SAMR_Q_ENUM_DOM_ALIASES.\n"));
268 return False;
271 r_u.status = _samr_enum_dom_aliases(p, &q_u, &r_u);
273 /* store the response in the SMB stream */
274 if(!samr_io_r_enum_dom_aliases("", &r_u, rdata, 0)) {
275 DEBUG(0,("api_samr_enum_dom_aliases: unable to marshall SAMR_R_ENUM_DOM_ALIASES.\n"));
276 return False;
279 return True;
282 /*******************************************************************
283 api_samr_query_dispinfo
284 ********************************************************************/
286 static bool api_samr_query_dispinfo(pipes_struct *p)
288 SAMR_Q_QUERY_DISPINFO q_u;
289 SAMR_R_QUERY_DISPINFO r_u;
290 prs_struct *data = &p->in_data.data;
291 prs_struct *rdata = &p->out_data.rdata;
293 ZERO_STRUCT(q_u);
294 ZERO_STRUCT(r_u);
296 if(!samr_io_q_query_dispinfo("", &q_u, data, 0)) {
297 DEBUG(0,("api_samr_query_dispinfo: unable to unmarshall SAMR_Q_QUERY_DISPINFO.\n"));
298 return False;
301 r_u.status = _samr_query_dispinfo(p, &q_u, &r_u);
303 /* store the response in the SMB stream */
304 if(!samr_io_r_query_dispinfo("", &r_u, rdata, 0)) {
305 DEBUG(0,("api_samr_query_dispinfo: unable to marshall SAMR_R_QUERY_DISPINFO.\n"));
306 return False;
309 return True;
312 /*******************************************************************
313 api_samr_query_aliasinfo
314 ********************************************************************/
316 static bool api_samr_query_aliasinfo(pipes_struct *p)
318 SAMR_Q_QUERY_ALIASINFO q_u;
319 SAMR_R_QUERY_ALIASINFO r_u;
320 prs_struct *data = &p->in_data.data;
321 prs_struct *rdata = &p->out_data.rdata;
323 ZERO_STRUCT(q_u);
324 ZERO_STRUCT(r_u);
326 /* grab the samr open */
327 if(!samr_io_q_query_aliasinfo("", &q_u, data, 0)) {
328 DEBUG(0,("api_samr_query_aliasinfo: unable to unmarshall SAMR_Q_QUERY_ALIASINFO.\n"));
329 return False;
332 r_u.status = _samr_query_aliasinfo(p, &q_u, &r_u);
334 /* store the response in the SMB stream */
335 if(!samr_io_r_query_aliasinfo("", &r_u, rdata, 0)) {
336 DEBUG(0,("api_samr_query_aliasinfo: unable to marshall SAMR_R_QUERY_ALIASINFO.\n"));
337 return False;
340 return True;
343 /*******************************************************************
344 api_samr_lookup_names
345 ********************************************************************/
347 static bool api_samr_lookup_names(pipes_struct *p)
349 SAMR_Q_LOOKUP_NAMES q_u;
350 SAMR_R_LOOKUP_NAMES r_u;
351 prs_struct *data = &p->in_data.data;
352 prs_struct *rdata = &p->out_data.rdata;
354 ZERO_STRUCT(q_u);
355 ZERO_STRUCT(r_u);
357 /* grab the samr lookup names */
358 if(!samr_io_q_lookup_names("", &q_u, data, 0)) {
359 DEBUG(0,("api_samr_lookup_names: unable to unmarshall SAMR_Q_LOOKUP_NAMES.\n"));
360 return False;
363 r_u.status = _samr_lookup_names(p, &q_u, &r_u);
365 /* store the response in the SMB stream */
366 if(!samr_io_r_lookup_names("", &r_u, rdata, 0)) {
367 DEBUG(0,("api_samr_lookup_names: unable to marshall SAMR_R_LOOKUP_NAMES.\n"));
368 return False;
371 return True;
374 /*******************************************************************
375 api_samr_chgpasswd_user
376 ********************************************************************/
378 static bool api_samr_chgpasswd_user(pipes_struct *p)
380 SAMR_Q_CHGPASSWD_USER q_u;
381 SAMR_R_CHGPASSWD_USER r_u;
382 prs_struct *data = &p->in_data.data;
383 prs_struct *rdata = &p->out_data.rdata;
385 ZERO_STRUCT(q_u);
386 ZERO_STRUCT(r_u);
388 /* change password request */
389 if (!samr_io_q_chgpasswd_user("", &q_u, data, 0)) {
390 DEBUG(0,("api_samr_chgpasswd_user: Failed to unmarshall SAMR_Q_CHGPASSWD_USER.\n"));
391 return False;
394 r_u.status = _samr_chgpasswd_user(p, &q_u, &r_u);
396 /* store the response in the SMB stream */
397 if(!samr_io_r_chgpasswd_user("", &r_u, rdata, 0)) {
398 DEBUG(0,("api_samr_chgpasswd_user: Failed to marshall SAMR_R_CHGPASSWD_USER.\n" ));
399 return False;
402 return True;
405 /*******************************************************************
406 api_samr_lookup_rids
407 ********************************************************************/
409 static bool api_samr_lookup_rids(pipes_struct *p)
411 SAMR_Q_LOOKUP_RIDS q_u;
412 SAMR_R_LOOKUP_RIDS r_u;
413 prs_struct *data = &p->in_data.data;
414 prs_struct *rdata = &p->out_data.rdata;
416 ZERO_STRUCT(q_u);
417 ZERO_STRUCT(r_u);
419 /* grab the samr lookup names */
420 if(!samr_io_q_lookup_rids("", &q_u, data, 0)) {
421 DEBUG(0,("api_samr_lookup_rids: unable to unmarshall SAMR_Q_LOOKUP_RIDS.\n"));
422 return False;
425 r_u.status = _samr_lookup_rids(p, &q_u, &r_u);
427 /* store the response in the SMB stream */
428 if(!samr_io_r_lookup_rids("", &r_u, rdata, 0)) {
429 DEBUG(0,("api_samr_lookup_rids: unable to marshall SAMR_R_LOOKUP_RIDS.\n"));
430 return False;
433 return True;
436 /*******************************************************************
437 api_samr_open_user
438 ********************************************************************/
440 static bool api_samr_open_user(pipes_struct *p)
442 SAMR_Q_OPEN_USER q_u;
443 SAMR_R_OPEN_USER r_u;
444 prs_struct *data = &p->in_data.data;
445 prs_struct *rdata = &p->out_data.rdata;
447 ZERO_STRUCT(q_u);
448 ZERO_STRUCT(r_u);
450 if(!samr_io_q_open_user("", &q_u, data, 0)) {
451 DEBUG(0,("api_samr_open_user: unable to unmarshall SAMR_Q_OPEN_USER.\n"));
452 return False;
455 r_u.status = _samr_open_user(p, &q_u, &r_u);
457 /* store the response in the SMB stream */
458 if(!samr_io_r_open_user("", &r_u, rdata, 0)) {
459 DEBUG(0,("api_samr_open_user: unable to marshall SAMR_R_OPEN_USER.\n"));
460 return False;
463 return True;
466 /*******************************************************************
467 api_samr_query_userinfo
468 ********************************************************************/
470 static bool api_samr_query_userinfo(pipes_struct *p)
472 SAMR_Q_QUERY_USERINFO q_u;
473 SAMR_R_QUERY_USERINFO r_u;
474 prs_struct *data = &p->in_data.data;
475 prs_struct *rdata = &p->out_data.rdata;
477 ZERO_STRUCT(q_u);
478 ZERO_STRUCT(r_u);
480 if(!samr_io_q_query_userinfo("", &q_u, data, 0)){
481 DEBUG(0,("api_samr_query_userinfo: unable to unmarshall SAMR_Q_QUERY_USERINFO.\n"));
482 return False;
485 r_u.status = _samr_query_userinfo(p, &q_u, &r_u);
487 /* store the response in the SMB stream */
488 if(!samr_io_r_query_userinfo("", &r_u, rdata, 0)) {
489 DEBUG(0,("api_samr_query_userinfo: unable to marshall SAMR_R_QUERY_USERINFO.\n"));
490 return False;
493 return True;
496 /*******************************************************************
497 api_samr_query_usergroups
498 ********************************************************************/
500 static bool api_samr_query_usergroups(pipes_struct *p)
502 SAMR_Q_QUERY_USERGROUPS q_u;
503 SAMR_R_QUERY_USERGROUPS r_u;
504 prs_struct *data = &p->in_data.data;
505 prs_struct *rdata = &p->out_data.rdata;
507 ZERO_STRUCT(q_u);
508 ZERO_STRUCT(r_u);
510 if(!samr_io_q_query_usergroups("", &q_u, data, 0)) {
511 DEBUG(0,("api_samr_query_usergroups: unable to unmarshall SAMR_Q_QUERY_USERGROUPS.\n"));
512 return False;
515 r_u.status = _samr_query_usergroups(p, &q_u, &r_u);
517 /* store the response in the SMB stream */
518 if(!samr_io_r_query_usergroups("", &r_u, rdata, 0)) {
519 DEBUG(0,("api_samr_query_usergroups: unable to marshall SAMR_R_QUERY_USERGROUPS.\n"));
520 return False;
523 return True;
526 /*******************************************************************
527 api_samr_query_domain_info
528 ********************************************************************/
530 static bool api_samr_query_domain_info(pipes_struct *p)
532 SAMR_Q_QUERY_DOMAIN_INFO q_u;
533 SAMR_R_QUERY_DOMAIN_INFO r_u;
534 prs_struct *data = &p->in_data.data;
535 prs_struct *rdata = &p->out_data.rdata;
537 ZERO_STRUCT(q_u);
538 ZERO_STRUCT(r_u);
540 if(!samr_io_q_query_domain_info("", &q_u, data, 0)) {
541 DEBUG(0,("api_samr_query_domain_info: unable to unmarshall SAMR_Q_QUERY_DOMAIN_INFO.\n"));
542 return False;
545 r_u.status = _samr_query_domain_info(p, &q_u, &r_u);
547 /* store the response in the SMB stream */
548 if(!samr_io_r_query_domain_info("", &r_u, rdata, 0)) {
549 DEBUG(0,("api_samr_query_domain_info: unable to marshall SAMR_R_QUERY_DOMAIN_INFO.\n"));
550 return False;
553 return True;
556 /*******************************************************************
557 api_samr_create_user
558 ********************************************************************/
560 static bool api_samr_create_user(pipes_struct *p)
562 prs_struct *data = &p->in_data.data;
563 prs_struct *rdata = &p->out_data.rdata;
565 SAMR_Q_CREATE_USER q_u;
566 SAMR_R_CREATE_USER r_u;
568 ZERO_STRUCT(q_u);
569 ZERO_STRUCT(r_u);
571 /* grab the samr create user */
572 if (!samr_io_q_create_user("", &q_u, data, 0)) {
573 DEBUG(0,("api_samr_create_user: Unable to unmarshall SAMR_Q_CREATE_USER.\n"));
574 return False;
577 r_u.status=_samr_create_user(p, &q_u, &r_u);
579 /* store the response in the SMB stream */
580 if(!samr_io_r_create_user("", &r_u, rdata, 0)) {
581 DEBUG(0,("api_samr_create_user: Unable to marshall SAMR_R_CREATE_USER.\n"));
582 return False;
585 return True;
588 /*******************************************************************
589 api_samr_connect_anon
590 ********************************************************************/
592 static bool api_samr_connect_anon(pipes_struct *p)
594 SAMR_Q_CONNECT_ANON q_u;
595 SAMR_R_CONNECT_ANON r_u;
596 prs_struct *data = &p->in_data.data;
597 prs_struct *rdata = &p->out_data.rdata;
599 ZERO_STRUCT(q_u);
600 ZERO_STRUCT(r_u);
602 /* grab the samr open policy */
603 if(!samr_io_q_connect_anon("", &q_u, data, 0)) {
604 DEBUG(0,("api_samr_connect_anon: unable to unmarshall SAMR_Q_CONNECT_ANON.\n"));
605 return False;
608 r_u.status = _samr_connect_anon(p, &q_u, &r_u);
610 /* store the response in the SMB stream */
611 if(!samr_io_r_connect_anon("", &r_u, rdata, 0)) {
612 DEBUG(0,("api_samr_connect_anon: unable to marshall SAMR_R_CONNECT_ANON.\n"));
613 return False;
616 return True;
619 /*******************************************************************
620 api_samr_connect
621 ********************************************************************/
623 static bool api_samr_connect(pipes_struct *p)
625 SAMR_Q_CONNECT q_u;
626 SAMR_R_CONNECT r_u;
627 prs_struct *data = &p->in_data.data;
628 prs_struct *rdata = &p->out_data.rdata;
630 ZERO_STRUCT(q_u);
631 ZERO_STRUCT(r_u);
633 /* grab the samr open policy */
634 if(!samr_io_q_connect("", &q_u, data, 0)) {
635 DEBUG(0,("api_samr_connect: unable to unmarshall SAMR_Q_CONNECT.\n"));
636 return False;
639 r_u.status = _samr_connect(p, &q_u, &r_u);
641 /* store the response in the SMB stream */
642 if(!samr_io_r_connect("", &r_u, rdata, 0)) {
643 DEBUG(0,("api_samr_connect: unable to marshall SAMR_R_CONNECT.\n"));
644 return False;
647 return True;
650 /*******************************************************************
651 api_samr_connect4
652 ********************************************************************/
654 static bool api_samr_connect4(pipes_struct *p)
656 SAMR_Q_CONNECT4 q_u;
657 SAMR_R_CONNECT4 r_u;
658 prs_struct *data = &p->in_data.data;
659 prs_struct *rdata = &p->out_data.rdata;
661 ZERO_STRUCT(q_u);
662 ZERO_STRUCT(r_u);
664 /* grab the samr open policy */
665 if(!samr_io_q_connect4("", &q_u, data, 0)) {
666 DEBUG(0,("api_samr_connect4: unable to unmarshall SAMR_Q_CONNECT4.\n"));
667 return False;
670 r_u.status = _samr_connect4(p, &q_u, &r_u);
672 /* store the response in the SMB stream */
673 if(!samr_io_r_connect4("", &r_u, rdata, 0)) {
674 DEBUG(0,("api_samr_connect4: unable to marshall SAMR_R_CONNECT4.\n"));
675 return False;
678 return True;
681 /*******************************************************************
682 api_samr_chgpasswd_user3
683 ********************************************************************/
685 static bool api_samr_chgpasswd_user3(pipes_struct *p)
687 SAMR_Q_CHGPASSWD_USER3 q_u;
688 SAMR_R_CHGPASSWD_USER3 r_u;
689 prs_struct *data = &p->in_data.data;
690 prs_struct *rdata = &p->out_data.rdata;
692 ZERO_STRUCT(q_u);
693 ZERO_STRUCT(r_u);
695 /* change password request */
696 if (!samr_io_q_chgpasswd_user3("", &q_u, data, 0)) {
697 DEBUG(0,("api_samr_chgpasswd_user3: Failed to unmarshall SAMR_Q_CHGPASSWD_USER3.\n"));
698 return False;
701 r_u.status = _samr_chgpasswd_user3(p, &q_u, &r_u);
703 /* store the response in the SMB stream */
704 if(!samr_io_r_chgpasswd_user3("", &r_u, rdata, 0)) {
705 DEBUG(0,("api_samr_chgpasswd_user3: Failed to marshall SAMR_R_CHGPASSWD_USER3.\n" ));
706 return False;
709 return True;
712 /*******************************************************************
713 api_samr_connect5
714 ********************************************************************/
716 static bool api_samr_connect5(pipes_struct *p)
718 SAMR_Q_CONNECT5 q_u;
719 SAMR_R_CONNECT5 r_u;
720 prs_struct *data = &p->in_data.data;
721 prs_struct *rdata = &p->out_data.rdata;
723 ZERO_STRUCT(q_u);
724 ZERO_STRUCT(r_u);
726 /* grab the samr open policy */
727 if(!samr_io_q_connect5("", &q_u, data, 0)) {
728 DEBUG(0,("api_samr_connect5: unable to unmarshall SAMR_Q_CONNECT5.\n"));
729 return False;
732 r_u.status = _samr_connect5(p, &q_u, &r_u);
734 /* store the response in the SMB stream */
735 if(!samr_io_r_connect5("", &r_u, rdata, 0)) {
736 DEBUG(0,("api_samr_connect5: unable to marshall SAMR_R_CONNECT5.\n"));
737 return False;
740 return True;
743 /**********************************************************************
744 api_samr_lookup_domain
745 **********************************************************************/
747 static bool api_samr_lookup_domain(pipes_struct *p)
749 SAMR_Q_LOOKUP_DOMAIN q_u;
750 SAMR_R_LOOKUP_DOMAIN r_u;
751 prs_struct *data = &p->in_data.data;
752 prs_struct *rdata = &p->out_data.rdata;
754 ZERO_STRUCT(q_u);
755 ZERO_STRUCT(r_u);
757 if(!samr_io_q_lookup_domain("", &q_u, data, 0)) {
758 DEBUG(0,("api_samr_lookup_domain: Unable to unmarshall SAMR_Q_LOOKUP_DOMAIN.\n"));
759 return False;
762 r_u.status = _samr_lookup_domain(p, &q_u, &r_u);
764 if(!samr_io_r_lookup_domain("", &r_u, rdata, 0)){
765 DEBUG(0,("api_samr_lookup_domain: Unable to marshall SAMR_R_LOOKUP_DOMAIN.\n"));
766 return False;
769 return True;
772 /**********************************************************************
773 api_samr_enum_domains
774 **********************************************************************/
776 static bool api_samr_enum_domains(pipes_struct *p)
778 SAMR_Q_ENUM_DOMAINS q_u;
779 SAMR_R_ENUM_DOMAINS r_u;
780 prs_struct *data = &p->in_data.data;
781 prs_struct *rdata = &p->out_data.rdata;
783 ZERO_STRUCT(q_u);
784 ZERO_STRUCT(r_u);
786 if(!samr_io_q_enum_domains("", &q_u, data, 0)) {
787 DEBUG(0,("api_samr_enum_domains: Unable to unmarshall SAMR_Q_ENUM_DOMAINS.\n"));
788 return False;
791 r_u.status = _samr_enum_domains(p, &q_u, &r_u);
793 if(!samr_io_r_enum_domains("", &r_u, rdata, 0)) {
794 DEBUG(0,("api_samr_enum_domains: Unable to marshall SAMR_R_ENUM_DOMAINS.\n"));
795 return False;
798 return True;
801 /*******************************************************************
802 api_samr_open_alias
803 ********************************************************************/
805 static bool api_samr_open_alias(pipes_struct *p)
807 SAMR_Q_OPEN_ALIAS q_u;
808 SAMR_R_OPEN_ALIAS r_u;
809 prs_struct *data = &p->in_data.data;
810 prs_struct *rdata = &p->out_data.rdata;
812 ZERO_STRUCT(q_u);
813 ZERO_STRUCT(r_u);
815 /* grab the samr open policy */
816 if(!samr_io_q_open_alias("", &q_u, data, 0)) {
817 DEBUG(0,("api_samr_open_alias: Unable to unmarshall SAMR_Q_OPEN_ALIAS.\n"));
818 return False;
821 r_u.status=_samr_open_alias(p, &q_u, &r_u);
823 /* store the response in the SMB stream */
824 if(!samr_io_r_open_alias("", &r_u, rdata, 0)) {
825 DEBUG(0,("api_samr_open_alias: Unable to marshall SAMR_R_OPEN_ALIAS.\n"));
826 return False;
829 return True;
832 /*******************************************************************
833 api_samr_set_userinfo
834 ********************************************************************/
836 static bool api_samr_set_userinfo(pipes_struct *p)
838 SAMR_Q_SET_USERINFO q_u;
839 SAMR_R_SET_USERINFO r_u;
840 prs_struct *data = &p->in_data.data;
841 prs_struct *rdata = &p->out_data.rdata;
843 ZERO_STRUCT(q_u);
844 ZERO_STRUCT(r_u);
846 if (!samr_io_q_set_userinfo("", &q_u, data, 0)) {
847 DEBUG(0,("api_samr_set_userinfo: Unable to unmarshall SAMR_Q_SET_USERINFO.\n"));
848 /* Fix for W2K SP2 */
849 /* what is that status-code ? - gd */
850 if (q_u.switch_value == 0x1a) {
851 setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_INVALID_TAG));
852 return True;
854 return False;
857 r_u.status = _samr_set_userinfo(p, &q_u, &r_u);
859 if(!samr_io_r_set_userinfo("", &r_u, rdata, 0)) {
860 DEBUG(0,("api_samr_set_userinfo: Unable to marshall SAMR_R_SET_USERINFO.\n"));
861 return False;
864 return True;
867 /*******************************************************************
868 api_samr_set_userinfo2
869 ********************************************************************/
871 static bool api_samr_set_userinfo2(pipes_struct *p)
873 SAMR_Q_SET_USERINFO2 q_u;
874 SAMR_R_SET_USERINFO2 r_u;
876 prs_struct *data = &p->in_data.data;
877 prs_struct *rdata = &p->out_data.rdata;
879 ZERO_STRUCT(q_u);
880 ZERO_STRUCT(r_u);
882 if (!samr_io_q_set_userinfo2("", &q_u, data, 0)) {
883 DEBUG(0,("api_samr_set_userinfo2: Unable to unmarshall SAMR_Q_SET_USERINFO2.\n"));
884 return False;
887 r_u.status = _samr_set_userinfo2(p, &q_u, &r_u);
889 if(!samr_io_r_set_userinfo2("", &r_u, rdata, 0)) {
890 DEBUG(0,("api_samr_set_userinfo2: Unable to marshall SAMR_R_SET_USERINFO2.\n"));
891 return False;
894 return True;
897 /*******************************************************************
898 api_samr_query_useraliases
899 ********************************************************************/
901 static bool api_samr_query_useraliases(pipes_struct *p)
903 SAMR_Q_QUERY_USERALIASES q_u;
904 SAMR_R_QUERY_USERALIASES r_u;
906 prs_struct *data = &p->in_data.data;
907 prs_struct *rdata = &p->out_data.rdata;
909 ZERO_STRUCT(q_u);
910 ZERO_STRUCT(r_u);
912 if (!samr_io_q_query_useraliases("", &q_u, data, 0)) {
913 DEBUG(0,("api_samr_query_useraliases: Unable to unmarshall SAMR_Q_QUERY_USERALIASES.\n"));
914 return False;
917 r_u.status = _samr_query_useraliases(p, &q_u, &r_u);
919 if (! samr_io_r_query_useraliases("", &r_u, rdata, 0)) {
920 DEBUG(0,("api_samr_query_useraliases: Unable to nmarshall SAMR_R_QUERY_USERALIASES.\n"));
921 return False;
924 return True;
927 /*******************************************************************
928 api_samr_query_aliasmem
929 ********************************************************************/
931 static bool api_samr_query_aliasmem(pipes_struct *p)
933 SAMR_Q_QUERY_ALIASMEM q_u;
934 SAMR_R_QUERY_ALIASMEM r_u;
936 prs_struct *data = &p->in_data.data;
937 prs_struct *rdata = &p->out_data.rdata;
939 ZERO_STRUCT(q_u);
940 ZERO_STRUCT(r_u);
942 if (!samr_io_q_query_aliasmem("", &q_u, data, 0)) {
943 DEBUG(0,("api_samr_query_aliasmem: unable to unmarshall SAMR_Q_QUERY_ALIASMEM.\n"));
944 return False;
947 r_u.status = _samr_query_aliasmem(p, &q_u, &r_u);
949 if (!samr_io_r_query_aliasmem("", &r_u, rdata, 0)) {
950 DEBUG(0,("api_samr_query_aliasmem: unable to marshall SAMR_R_QUERY_ALIASMEM.\n"));
951 return False;
954 return True;
957 /*******************************************************************
958 api_samr_query_groupmem
959 ********************************************************************/
961 static bool api_samr_query_groupmem(pipes_struct *p)
963 SAMR_Q_QUERY_GROUPMEM q_u;
964 SAMR_R_QUERY_GROUPMEM r_u;
966 prs_struct *data = &p->in_data.data;
967 prs_struct *rdata = &p->out_data.rdata;
969 ZERO_STRUCT(q_u);
970 ZERO_STRUCT(r_u);
972 if (!samr_io_q_query_groupmem("", &q_u, data, 0)) {
973 DEBUG(0,("api_samr_query_groupmem: unable to unmarshall SAMR_Q_QUERY_GROUPMEM.\n"));
974 return False;
977 r_u.status = _samr_query_groupmem(p, &q_u, &r_u);
979 if (!samr_io_r_query_groupmem("", &r_u, rdata, 0)) {
980 DEBUG(0,("api_samr_query_groupmem: unable to marshall SAMR_R_QUERY_GROUPMEM.\n"));
981 return False;
984 return True;
987 /*******************************************************************
988 api_samr_add_aliasmem
989 ********************************************************************/
991 static bool api_samr_add_aliasmem(pipes_struct *p)
993 SAMR_Q_ADD_ALIASMEM q_u;
994 SAMR_R_ADD_ALIASMEM r_u;
996 prs_struct *data = &p->in_data.data;
997 prs_struct *rdata = &p->out_data.rdata;
999 ZERO_STRUCT(q_u);
1000 ZERO_STRUCT(r_u);
1002 if (!samr_io_q_add_aliasmem("", &q_u, data, 0)) {
1003 DEBUG(0,("api_samr_add_aliasmem: unable to unmarshall SAMR_Q_ADD_ALIASMEM.\n"));
1004 return False;
1007 r_u.status = _samr_add_aliasmem(p, &q_u, &r_u);
1009 if (!samr_io_r_add_aliasmem("", &r_u, rdata, 0)) {
1010 DEBUG(0,("api_samr_add_aliasmem: unable to marshall SAMR_R_ADD_ALIASMEM.\n"));
1011 return False;
1014 return True;
1017 /*******************************************************************
1018 api_samr_del_aliasmem
1019 ********************************************************************/
1021 static bool api_samr_del_aliasmem(pipes_struct *p)
1023 SAMR_Q_DEL_ALIASMEM q_u;
1024 SAMR_R_DEL_ALIASMEM r_u;
1026 prs_struct *data = &p->in_data.data;
1027 prs_struct *rdata = &p->out_data.rdata;
1029 ZERO_STRUCT(q_u);
1030 ZERO_STRUCT(r_u);
1032 if (!samr_io_q_del_aliasmem("", &q_u, data, 0)) {
1033 DEBUG(0,("api_samr_del_aliasmem: unable to unmarshall SAMR_Q_DEL_ALIASMEM.\n"));
1034 return False;
1037 r_u.status = _samr_del_aliasmem(p, &q_u, &r_u);
1039 if (!samr_io_r_del_aliasmem("", &r_u, rdata, 0)) {
1040 DEBUG(0,("api_samr_del_aliasmem: unable to marshall SAMR_R_DEL_ALIASMEM.\n"));
1041 return False;
1044 return True;
1047 /*******************************************************************
1048 api_samr_add_groupmem
1049 ********************************************************************/
1051 static bool api_samr_add_groupmem(pipes_struct *p)
1053 SAMR_Q_ADD_GROUPMEM q_u;
1054 SAMR_R_ADD_GROUPMEM r_u;
1056 prs_struct *data = &p->in_data.data;
1057 prs_struct *rdata = &p->out_data.rdata;
1059 ZERO_STRUCT(q_u);
1060 ZERO_STRUCT(r_u);
1062 if (!samr_io_q_add_groupmem("", &q_u, data, 0)) {
1063 DEBUG(0,("api_samr_add_groupmem: unable to unmarshall SAMR_Q_ADD_GROUPMEM.\n"));
1064 return False;
1067 r_u.status = _samr_add_groupmem(p, &q_u, &r_u);
1069 if (!samr_io_r_add_groupmem("", &r_u, rdata, 0)) {
1070 DEBUG(0,("api_samr_add_groupmem: unable to marshall SAMR_R_ADD_GROUPMEM.\n"));
1071 return False;
1074 return True;
1077 /*******************************************************************
1078 api_samr_del_groupmem
1079 ********************************************************************/
1081 static bool api_samr_del_groupmem(pipes_struct *p)
1083 SAMR_Q_DEL_GROUPMEM q_u;
1084 SAMR_R_DEL_GROUPMEM r_u;
1086 prs_struct *data = &p->in_data.data;
1087 prs_struct *rdata = &p->out_data.rdata;
1089 ZERO_STRUCT(q_u);
1090 ZERO_STRUCT(r_u);
1092 if (!samr_io_q_del_groupmem("", &q_u, data, 0)) {
1093 DEBUG(0,("api_samr_del_groupmem: unable to unmarshall SAMR_Q_DEL_GROUPMEM.\n"));
1094 return False;
1097 r_u.status = _samr_del_groupmem(p, &q_u, &r_u);
1099 if (!samr_io_r_del_groupmem("", &r_u, rdata, 0)) {
1100 DEBUG(0,("api_samr_del_groupmem: unable to marshall SAMR_R_DEL_GROUPMEM.\n"));
1101 return False;
1104 return True;
1107 /*******************************************************************
1108 api_samr_delete_dom_user
1109 ********************************************************************/
1111 static bool api_samr_delete_dom_user(pipes_struct *p)
1113 SAMR_Q_DELETE_DOM_USER q_u;
1114 SAMR_R_DELETE_DOM_USER r_u;
1116 prs_struct *data = &p->in_data.data;
1117 prs_struct *rdata = &p->out_data.rdata;
1119 ZERO_STRUCT(q_u);
1120 ZERO_STRUCT(r_u);
1122 if (!samr_io_q_delete_dom_user("", &q_u, data, 0)) {
1123 DEBUG(0,("api_samr_delete_dom_user: unable to unmarshall SAMR_Q_DELETE_DOM_USER.\n"));
1124 return False;
1127 r_u.status = _samr_delete_dom_user(p, &q_u, &r_u);
1129 if (!samr_io_r_delete_dom_user("", &r_u, rdata, 0)) {
1130 DEBUG(0,("api_samr_delete_dom_user: unable to marshall SAMR_R_DELETE_DOM_USER.\n"));
1131 return False;
1134 return True;
1137 /*******************************************************************
1138 api_samr_delete_dom_group
1139 ********************************************************************/
1141 static bool api_samr_delete_dom_group(pipes_struct *p)
1143 SAMR_Q_DELETE_DOM_GROUP q_u;
1144 SAMR_R_DELETE_DOM_GROUP r_u;
1146 prs_struct *data = &p->in_data.data;
1147 prs_struct *rdata = &p->out_data.rdata;
1149 ZERO_STRUCT(q_u);
1150 ZERO_STRUCT(r_u);
1152 if (!samr_io_q_delete_dom_group("", &q_u, data, 0)) {
1153 DEBUG(0,("api_samr_delete_dom_group: unable to unmarshall SAMR_Q_DELETE_DOM_GROUP.\n"));
1154 return False;
1157 r_u.status = _samr_delete_dom_group(p, &q_u, &r_u);
1159 if (!samr_io_r_delete_dom_group("", &r_u, rdata, 0)) {
1160 DEBUG(0,("api_samr_delete_dom_group: unable to marshall SAMR_R_DELETE_DOM_GROUP.\n"));
1161 return False;
1164 return True;
1167 /*******************************************************************
1168 api_samr_delete_dom_alias
1169 ********************************************************************/
1171 static bool api_samr_delete_dom_alias(pipes_struct *p)
1173 SAMR_Q_DELETE_DOM_ALIAS q_u;
1174 SAMR_R_DELETE_DOM_ALIAS r_u;
1176 prs_struct *data = &p->in_data.data;
1177 prs_struct *rdata = &p->out_data.rdata;
1179 ZERO_STRUCT(q_u);
1180 ZERO_STRUCT(r_u);
1182 if (!samr_io_q_delete_dom_alias("", &q_u, data, 0)) {
1183 DEBUG(0,("api_samr_delete_dom_alias: unable to unmarshall SAMR_Q_DELETE_DOM_ALIAS.\n"));
1184 return False;
1187 r_u.status = _samr_delete_dom_alias(p, &q_u, &r_u);
1189 if (!samr_io_r_delete_dom_alias("", &r_u, rdata, 0)) {
1190 DEBUG(0,("api_samr_delete_dom_alias: unable to marshall SAMR_R_DELETE_DOM_ALIAS.\n"));
1191 return False;
1194 return True;
1197 /*******************************************************************
1198 api_samr_create_dom_group
1199 ********************************************************************/
1201 static bool api_samr_create_dom_group(pipes_struct *p)
1203 SAMR_Q_CREATE_DOM_GROUP q_u;
1204 SAMR_R_CREATE_DOM_GROUP r_u;
1206 prs_struct *data = &p->in_data.data;
1207 prs_struct *rdata = &p->out_data.rdata;
1209 ZERO_STRUCT(q_u);
1210 ZERO_STRUCT(r_u);
1212 if (!samr_io_q_create_dom_group("", &q_u, data, 0)) {
1213 DEBUG(0,("api_samr_create_dom_group: unable to unmarshall SAMR_Q_CREATE_DOM_GROUP.\n"));
1214 return False;
1217 r_u.status = _samr_create_dom_group(p, &q_u, &r_u);
1219 if (!samr_io_r_create_dom_group("", &r_u, rdata, 0)) {
1220 DEBUG(0,("api_samr_create_dom_group: unable to marshall SAMR_R_CREATE_DOM_GROUP.\n"));
1221 return False;
1224 return True;
1227 /*******************************************************************
1228 api_samr_create_dom_alias
1229 ********************************************************************/
1231 static bool api_samr_create_dom_alias(pipes_struct *p)
1233 SAMR_Q_CREATE_DOM_ALIAS q_u;
1234 SAMR_R_CREATE_DOM_ALIAS r_u;
1236 prs_struct *data = &p->in_data.data;
1237 prs_struct *rdata = &p->out_data.rdata;
1239 ZERO_STRUCT(q_u);
1240 ZERO_STRUCT(r_u);
1242 if (!samr_io_q_create_dom_alias("", &q_u, data, 0)) {
1243 DEBUG(0,("api_samr_create_dom_alias: unable to unmarshall SAMR_Q_CREATE_DOM_ALIAS.\n"));
1244 return False;
1247 r_u.status = _samr_create_dom_alias(p, &q_u, &r_u);
1249 if (!samr_io_r_create_dom_alias("", &r_u, rdata, 0)) {
1250 DEBUG(0,("api_samr_create_dom_alias: unable to marshall SAMR_R_CREATE_DOM_ALIAS.\n"));
1251 return False;
1254 return True;
1257 /*******************************************************************
1258 api_samr_query_groupinfo
1259 ********************************************************************/
1261 static bool api_samr_query_groupinfo(pipes_struct *p)
1263 SAMR_Q_QUERY_GROUPINFO q_u;
1264 SAMR_R_QUERY_GROUPINFO r_u;
1266 prs_struct *data = &p->in_data.data;
1267 prs_struct *rdata = &p->out_data.rdata;
1269 ZERO_STRUCT(q_u);
1270 ZERO_STRUCT(r_u);
1272 if (!samr_io_q_query_groupinfo("", &q_u, data, 0)) {
1273 DEBUG(0,("api_samr_query_groupinfo: unable to unmarshall SAMR_Q_QUERY_GROUPINFO.\n"));
1274 return False;
1277 r_u.status = _samr_query_groupinfo(p, &q_u, &r_u);
1279 if (!samr_io_r_query_groupinfo("", &r_u, rdata, 0)) {
1280 DEBUG(0,("api_samr_query_groupinfo: unable to marshall SAMR_R_QUERY_GROUPINFO.\n"));
1281 return False;
1284 return True;
1287 /*******************************************************************
1288 api_samr_set_groupinfo
1289 ********************************************************************/
1291 static bool api_samr_set_groupinfo(pipes_struct *p)
1293 SAMR_Q_SET_GROUPINFO q_u;
1294 SAMR_R_SET_GROUPINFO r_u;
1296 prs_struct *data = &p->in_data.data;
1297 prs_struct *rdata = &p->out_data.rdata;
1299 ZERO_STRUCT(q_u);
1300 ZERO_STRUCT(r_u);
1302 if (!samr_io_q_set_groupinfo("", &q_u, data, 0)) {
1303 DEBUG(0,("api_samr_set_groupinfo: unable to unmarshall SAMR_Q_SET_GROUPINFO.\n"));
1304 return False;
1307 r_u.status = _samr_set_groupinfo(p, &q_u, &r_u);
1309 if (!samr_io_r_set_groupinfo("", &r_u, rdata, 0)) {
1310 DEBUG(0,("api_samr_set_groupinfo: unable to marshall SAMR_R_SET_GROUPINFO.\n"));
1311 return False;
1314 return True;
1317 /*******************************************************************
1318 api_samr_set_aliasinfo
1319 ********************************************************************/
1321 static bool api_samr_set_aliasinfo(pipes_struct *p)
1323 SAMR_Q_SET_ALIASINFO q_u;
1324 SAMR_R_SET_ALIASINFO r_u;
1326 prs_struct *data = &p->in_data.data;
1327 prs_struct *rdata = &p->out_data.rdata;
1329 ZERO_STRUCT(q_u);
1330 ZERO_STRUCT(r_u);
1332 if (!samr_io_q_set_aliasinfo("", &q_u, data, 0)) {
1333 DEBUG(0,("api_samr_set_aliasinfo: unable to unmarshall SAMR_Q_SET_ALIASINFO.\n"));
1334 return False;
1337 r_u.status = _samr_set_aliasinfo(p, &q_u, &r_u);
1339 if (!samr_io_r_set_aliasinfo("", &r_u, rdata, 0)) {
1340 DEBUG(0,("api_samr_set_aliasinfo: unable to marshall SAMR_R_SET_ALIASINFO.\n"));
1341 return False;
1344 return True;
1347 /*******************************************************************
1348 api_samr_get_dom_pwinfo
1349 ********************************************************************/
1351 static bool api_samr_get_dom_pwinfo(pipes_struct *p)
1353 SAMR_Q_GET_DOM_PWINFO q_u;
1354 SAMR_R_GET_DOM_PWINFO r_u;
1356 prs_struct *data = &p->in_data.data;
1357 prs_struct *rdata = &p->out_data.rdata;
1359 ZERO_STRUCT(q_u);
1360 ZERO_STRUCT(r_u);
1362 if (!samr_io_q_get_dom_pwinfo("", &q_u, data, 0)) {
1363 DEBUG(0,("api_samr_get_dom_pwinfo: unable to unmarshall SAMR_Q_GET_DOM_PWINFO.\n"));
1364 return False;
1367 r_u.status = _samr_get_dom_pwinfo(p, &q_u, &r_u);
1369 if (!samr_io_r_get_dom_pwinfo("", &r_u, rdata, 0)) {
1370 DEBUG(0,("api_samr_get_dom_pwinfo: unable to marshall SAMR_R_GET_DOM_PWINFO.\n"));
1371 return False;
1374 return True;
1377 /*******************************************************************
1378 api_samr_open_group
1379 ********************************************************************/
1381 static bool api_samr_open_group(pipes_struct *p)
1383 SAMR_Q_OPEN_GROUP q_u;
1384 SAMR_R_OPEN_GROUP r_u;
1386 prs_struct *data = &p->in_data.data;
1387 prs_struct *rdata = &p->out_data.rdata;
1389 ZERO_STRUCT(q_u);
1390 ZERO_STRUCT(r_u);
1392 if (!samr_io_q_open_group("", &q_u, data, 0)) {
1393 DEBUG(0,("api_samr_open_group: unable to unmarshall SAMR_Q_OPEN_GROUP.\n"));
1394 return False;
1397 r_u.status = _samr_open_group(p, &q_u, &r_u);
1399 if (!samr_io_r_open_group("", &r_u, rdata, 0)) {
1400 DEBUG(0,("api_samr_open_group: unable to marshall SAMR_R_OPEN_GROUP.\n"));
1401 return False;
1404 return True;
1407 /*******************************************************************
1408 api_samr_remove_sid_foreign_domain
1409 ********************************************************************/
1411 static bool api_samr_remove_sid_foreign_domain(pipes_struct *p)
1413 SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN q_u;
1414 SAMR_R_REMOVE_SID_FOREIGN_DOMAIN r_u;
1416 prs_struct *data = &p->in_data.data;
1417 prs_struct *rdata = &p->out_data.rdata;
1419 ZERO_STRUCT(q_u);
1420 ZERO_STRUCT(r_u);
1422 if (!samr_io_q_remove_sid_foreign_domain("", &q_u, data, 0)) {
1423 DEBUG(0,("api_samr_remove_sid_foreign_domain: unable to unmarshall SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN.\n"));
1424 return False;
1427 r_u.status = _samr_remove_sid_foreign_domain(p, &q_u, &r_u);
1429 if (!samr_io_r_remove_sid_foreign_domain("", &r_u, rdata, 0)) {
1430 DEBUG(0,("api_samr_remove_sid_foreign_domain: unable to marshall SAMR_R_REMOVE_SID_FOREIGN_DOMAIN.\n"));
1431 return False;
1434 return True;
1437 /*******************************************************************
1438 api_samr_query_dom_info2
1439 ********************************************************************/
1441 static bool api_samr_query_domain_info2(pipes_struct *p)
1443 SAMR_Q_QUERY_DOMAIN_INFO2 q_u;
1444 SAMR_R_QUERY_DOMAIN_INFO2 r_u;
1445 prs_struct *data = &p->in_data.data;
1446 prs_struct *rdata = &p->out_data.rdata;
1448 ZERO_STRUCT(q_u);
1449 ZERO_STRUCT(r_u);
1451 if(!samr_io_q_query_domain_info2("", &q_u, data, 0)) {
1452 DEBUG(0,("api_samr_query_domain_info2: unable to unmarshall SAMR_Q_QUERY_DOMAIN_INFO2.\n"));
1453 return False;
1456 r_u.status = _samr_query_domain_info2(p, &q_u, &r_u);
1458 /* store the response in the SMB stream */
1459 if(!samr_io_r_query_domain_info2("", &r_u, rdata, 0)) {
1460 DEBUG(0,("api_samr_query_domain_info2: unable to marshall SAMR_R_QUERY_DOMAIN_INFO2.\n"));
1461 return False;
1464 return True;
1467 /*******************************************************************
1468 api_samr_set_dom_info
1469 ********************************************************************/
1471 static bool api_samr_set_dom_info(pipes_struct *p)
1473 SAMR_Q_SET_DOMAIN_INFO q_u;
1474 SAMR_R_SET_DOMAIN_INFO r_u;
1475 prs_struct *data = &p->in_data.data;
1476 prs_struct *rdata = &p->out_data.rdata;
1478 ZERO_STRUCT(q_u);
1479 ZERO_STRUCT(r_u);
1481 if(!samr_io_q_set_domain_info("", &q_u, data, 0)) {
1482 DEBUG(0,("api_samr_set_dom_info: unable to unmarshall SAMR_Q_SET_DOMAIN_INFO.\n"));
1483 return False;
1486 r_u.status = _samr_set_dom_info(p, &q_u, &r_u);
1488 /* store the response in the SMB stream */
1489 if(!samr_io_r_set_domain_info("", &r_u, rdata, 0)) {
1490 DEBUG(0,("api_samr_set_dom_info: unable to marshall SAMR_R_SET_DOMAIN_INFO.\n"));
1491 return False;
1494 return True;
1497 /*******************************************************************
1498 array of \PIPE\samr operations
1499 ********************************************************************/
1501 static struct api_struct api_samr_cmds [] =
1503 {"SAMR_CLOSE_HND" , SAMR_CLOSE_HND , api_samr_close_hnd },
1504 {"SAMR_CONNECT" , SAMR_CONNECT , api_samr_connect },
1505 {"SAMR_CONNECT_ANON" , SAMR_CONNECT_ANON , api_samr_connect_anon },
1506 {"SAMR_ENUM_DOMAINS" , SAMR_ENUM_DOMAINS , api_samr_enum_domains },
1507 {"SAMR_ENUM_DOM_USERS" , SAMR_ENUM_DOM_USERS , api_samr_enum_dom_users },
1509 {"SAMR_ENUM_DOM_GROUPS" , SAMR_ENUM_DOM_GROUPS , api_samr_enum_dom_groups },
1510 {"SAMR_ENUM_DOM_ALIASES" , SAMR_ENUM_DOM_ALIASES , api_samr_enum_dom_aliases },
1511 {"SAMR_QUERY_USERALIASES" , SAMR_QUERY_USERALIASES, api_samr_query_useraliases},
1512 {"SAMR_QUERY_ALIASMEM" , SAMR_QUERY_ALIASMEM , api_samr_query_aliasmem },
1513 {"SAMR_QUERY_GROUPMEM" , SAMR_QUERY_GROUPMEM , api_samr_query_groupmem },
1514 {"SAMR_ADD_ALIASMEM" , SAMR_ADD_ALIASMEM , api_samr_add_aliasmem },
1515 {"SAMR_DEL_ALIASMEM" , SAMR_DEL_ALIASMEM , api_samr_del_aliasmem },
1516 {"SAMR_ADD_GROUPMEM" , SAMR_ADD_GROUPMEM , api_samr_add_groupmem },
1517 {"SAMR_DEL_GROUPMEM" , SAMR_DEL_GROUPMEM , api_samr_del_groupmem },
1519 {"SAMR_DELETE_DOM_USER" , SAMR_DELETE_DOM_USER , api_samr_delete_dom_user },
1520 {"SAMR_DELETE_DOM_GROUP" , SAMR_DELETE_DOM_GROUP , api_samr_delete_dom_group },
1521 {"SAMR_DELETE_DOM_ALIAS" , SAMR_DELETE_DOM_ALIAS , api_samr_delete_dom_alias },
1522 {"SAMR_CREATE_DOM_GROUP" , SAMR_CREATE_DOM_GROUP , api_samr_create_dom_group },
1523 {"SAMR_CREATE_DOM_ALIAS" , SAMR_CREATE_DOM_ALIAS , api_samr_create_dom_alias },
1524 {"SAMR_LOOKUP_NAMES" , SAMR_LOOKUP_NAMES , api_samr_lookup_names },
1525 {"SAMR_OPEN_USER" , SAMR_OPEN_USER , api_samr_open_user },
1526 {"SAMR_QUERY_USERINFO" , SAMR_QUERY_USERINFO , api_samr_query_userinfo },
1527 {"SAMR_SET_USERINFO" , SAMR_SET_USERINFO , api_samr_set_userinfo },
1528 {"SAMR_SET_USERINFO2" , SAMR_SET_USERINFO2 , api_samr_set_userinfo2 },
1530 {"SAMR_QUERY_DOMAIN_INFO" , SAMR_QUERY_DOMAIN_INFO, api_samr_query_domain_info},
1531 {"SAMR_QUERY_USERGROUPS" , SAMR_QUERY_USERGROUPS , api_samr_query_usergroups },
1532 {"SAMR_QUERY_DISPINFO" , SAMR_QUERY_DISPINFO , api_samr_query_dispinfo },
1533 {"SAMR_QUERY_DISPINFO3" , SAMR_QUERY_DISPINFO3 , api_samr_query_dispinfo },
1534 {"SAMR_QUERY_DISPINFO4" , SAMR_QUERY_DISPINFO4 , api_samr_query_dispinfo },
1536 {"SAMR_QUERY_ALIASINFO" , SAMR_QUERY_ALIASINFO , api_samr_query_aliasinfo },
1537 {"SAMR_QUERY_GROUPINFO" , SAMR_QUERY_GROUPINFO , api_samr_query_groupinfo },
1538 {"SAMR_SET_GROUPINFO" , SAMR_SET_GROUPINFO , api_samr_set_groupinfo },
1539 {"SAMR_SET_ALIASINFO" , SAMR_SET_ALIASINFO , api_samr_set_aliasinfo },
1540 {"SAMR_CREATE_USER" , SAMR_CREATE_USER , api_samr_create_user },
1541 {"SAMR_LOOKUP_RIDS" , SAMR_LOOKUP_RIDS , api_samr_lookup_rids },
1542 {"SAMR_GET_DOM_PWINFO" , SAMR_GET_DOM_PWINFO , api_samr_get_dom_pwinfo },
1543 {"SAMR_CHGPASSWD_USER" , SAMR_CHGPASSWD_USER , api_samr_chgpasswd_user },
1544 {"SAMR_OPEN_ALIAS" , SAMR_OPEN_ALIAS , api_samr_open_alias },
1545 {"SAMR_OPEN_GROUP" , SAMR_OPEN_GROUP , api_samr_open_group },
1546 {"SAMR_OPEN_DOMAIN" , SAMR_OPEN_DOMAIN , api_samr_open_domain },
1547 {"SAMR_REMOVE_SID_FOREIGN_DOMAIN" , SAMR_REMOVE_SID_FOREIGN_DOMAIN , api_samr_remove_sid_foreign_domain },
1548 {"SAMR_LOOKUP_DOMAIN" , SAMR_LOOKUP_DOMAIN , api_samr_lookup_domain },
1550 {"SAMR_QUERY_SEC_OBJECT" , SAMR_QUERY_SEC_OBJECT , api_samr_query_sec_obj },
1551 {"SAMR_SET_SEC_OBJECT" , SAMR_SET_SEC_OBJECT , api_samr_set_sec_obj },
1552 {"SAMR_GET_USRDOM_PWINFO" , SAMR_GET_USRDOM_PWINFO, api_samr_get_usrdom_pwinfo},
1553 {"SAMR_QUERY_DOMAIN_INFO2", SAMR_QUERY_DOMAIN_INFO2, api_samr_query_domain_info2},
1554 {"SAMR_SET_DOMAIN_INFO" , SAMR_SET_DOMAIN_INFO , api_samr_set_dom_info },
1555 {"SAMR_CONNECT4" , SAMR_CONNECT4 , api_samr_connect4 },
1556 {"SAMR_CHGPASSWD_USER3" , SAMR_CHGPASSWD_USER3 , api_samr_chgpasswd_user3 },
1557 {"SAMR_CONNECT5" , SAMR_CONNECT5 , api_samr_connect5 }
1560 void samr_get_pipe_fns( struct api_struct **fns, int *n_fns )
1562 *fns = api_samr_cmds;
1563 *n_fns = sizeof(api_samr_cmds) / sizeof(struct api_struct);
1567 NTSTATUS rpc_samr_init(void)
1569 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "lsass", api_samr_cmds,
1570 sizeof(api_samr_cmds) / sizeof(struct api_struct));