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) Jeremy Allison 2001,
8 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002-2003.
9 * Copyright (C) Gerald (Jerry) Carter 2005
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 /* This is the interface to the lsa server code. */
30 #define DBGC_CLASS DBGC_RPC_SRV
32 static BOOL proxy_lsa_call(pipes_struct *p, uint8 opnum)
34 struct api_struct *fns;
37 lsarpc_get_pipe_fns(&fns, &n_fns);
42 if (fns[opnum].opnum != opnum) {
43 smb_panic("LSA function table not sorted");
46 return fns[opnum].fn(p);
49 /***************************************************************************
51 ***************************************************************************/
53 static BOOL api_lsa_open_policy2(pipes_struct *p)
57 prs_struct *data = &p->in_data.data;
58 prs_struct *rdata = &p->out_data.rdata;
63 /* grab the server, object attributes and desired access flag...*/
64 if(!lsa_io_q_open_pol2("", &q_u, data, 0)) {
65 DEBUG(0,("api_lsa_open_policy2: unable to unmarshall LSA_Q_OPEN_POL2.\n"));
69 r_u.status = _lsa_open_policy2(p, &q_u, &r_u);
71 /* store the response in the SMB stream */
72 if(!lsa_io_r_open_pol2("", &r_u, rdata, 0)) {
73 DEBUG(0,("api_lsa_open_policy2: unable to marshall LSA_R_OPEN_POL2.\n"));
80 /***************************************************************************
82 ***************************************************************************/
84 static BOOL api_lsa_open_policy(pipes_struct *p)
88 prs_struct *data = &p->in_data.data;
89 prs_struct *rdata = &p->out_data.rdata;
94 /* grab the server, object attributes and desired access flag...*/
95 if(!lsa_io_q_open_pol("", &q_u, data, 0)) {
96 DEBUG(0,("api_lsa_open_policy: unable to unmarshall LSA_Q_OPEN_POL.\n"));
100 r_u.status = _lsa_open_policy(p, &q_u, &r_u);
102 /* store the response in the SMB stream */
103 if(!lsa_io_r_open_pol("", &r_u, rdata, 0)) {
104 DEBUG(0,("api_lsa_open_policy: unable to marshall LSA_R_OPEN_POL.\n"));
111 /***************************************************************************
112 api_lsa_enum_trust_dom
113 ***************************************************************************/
115 static BOOL api_lsa_enum_trust_dom(pipes_struct *p)
117 LSA_Q_ENUM_TRUST_DOM q_u;
118 LSA_R_ENUM_TRUST_DOM r_u;
119 prs_struct *data = &p->in_data.data;
120 prs_struct *rdata = &p->out_data.rdata;
125 /* grab the enum trust domain context etc. */
126 if(!lsa_io_q_enum_trust_dom("", &q_u, data, 0))
129 /* get required trusted domains information */
130 r_u.status = _lsa_enum_trust_dom(p, &q_u, &r_u);
132 /* prepare the response */
133 if(!lsa_io_r_enum_trust_dom("", &r_u, rdata, 0))
139 /***************************************************************************
141 ***************************************************************************/
143 static BOOL api_lsa_query_info(pipes_struct *p)
145 LSA_Q_QUERY_INFO q_u;
146 LSA_R_QUERY_INFO r_u;
147 prs_struct *data = &p->in_data.data;
148 prs_struct *rdata = &p->out_data.rdata;
153 /* grab the info class and policy handle */
154 if(!lsa_io_q_query("", &q_u, data, 0)) {
155 DEBUG(0,("api_lsa_query_info: failed to unmarshall LSA_Q_QUERY_INFO.\n"));
159 r_u.status = _lsa_query_info(p, &q_u, &r_u);
161 /* store the response in the SMB stream */
162 if(!lsa_io_r_query("", &r_u, rdata, 0)) {
163 DEBUG(0,("api_lsa_query_info: failed to marshall LSA_R_QUERY_INFO.\n"));
170 /***************************************************************************
172 ***************************************************************************/
174 static BOOL api_lsa_lookup_sids(pipes_struct *p)
176 LSA_Q_LOOKUP_SIDS q_u;
177 LSA_R_LOOKUP_SIDS r_u;
178 prs_struct *data = &p->in_data.data;
179 prs_struct *rdata = &p->out_data.rdata;
184 /* grab the info class and policy handle */
185 if(!lsa_io_q_lookup_sids("", &q_u, data, 0)) {
186 DEBUG(0,("api_lsa_lookup_sids: failed to unmarshall LSA_Q_LOOKUP_SIDS.\n"));
190 r_u.status = _lsa_lookup_sids(p, &q_u, &r_u);
192 if(!lsa_io_r_lookup_sids("", &r_u, rdata, 0)) {
193 DEBUG(0,("api_lsa_lookup_sids: Failed to marshall LSA_R_LOOKUP_SIDS.\n"));
200 /***************************************************************************
202 ***************************************************************************/
204 static BOOL api_lsa_lookup_names(pipes_struct *p)
206 LSA_Q_LOOKUP_NAMES q_u;
207 LSA_R_LOOKUP_NAMES r_u;
208 prs_struct *data = &p->in_data.data;
209 prs_struct *rdata = &p->out_data.rdata;
214 /* grab the info class and policy handle */
215 if(!lsa_io_q_lookup_names("", &q_u, data, 0)) {
216 DEBUG(0,("api_lsa_lookup_names: failed to unmarshall LSA_Q_LOOKUP_NAMES.\n"));
220 r_u.status = _lsa_lookup_names(p, &q_u, &r_u);
222 /* store the response in the SMB stream */
223 if(!lsa_io_r_lookup_names("", &r_u, rdata, 0)) {
224 DEBUG(0,("api_lsa_lookup_names: Failed to marshall LSA_R_LOOKUP_NAMES.\n"));
231 /***************************************************************************
233 ***************************************************************************/
235 static BOOL api_lsa_close(pipes_struct *p)
237 return proxy_lsa_call(p, DCERPC_LSA_CLOSE);
240 /***************************************************************************
242 ***************************************************************************/
244 static BOOL api_lsa_open_secret(pipes_struct *p)
246 return proxy_lsa_call(p, DCERPC_LSA_OPENSECRET);
249 /***************************************************************************
251 ***************************************************************************/
253 static BOOL api_lsa_enum_privs(pipes_struct *p)
255 LSA_Q_ENUM_PRIVS q_u;
256 LSA_R_ENUM_PRIVS r_u;
257 prs_struct *data = &p->in_data.data;
258 prs_struct *rdata = &p->out_data.rdata;
263 if(!lsa_io_q_enum_privs("", &q_u, data, 0)) {
264 DEBUG(0,("api_lsa_enum_privs: failed to unmarshall LSA_Q_ENUM_PRIVS.\n"));
268 r_u.status = _lsa_enum_privs(p, &q_u, &r_u);
270 /* store the response in the SMB stream */
271 if(!lsa_io_r_enum_privs("", &r_u, rdata, 0)) {
272 DEBUG(0,("api_lsa_enum_privs: Failed to marshall LSA_R_ENUM_PRIVS.\n"));
279 /***************************************************************************
281 ***************************************************************************/
283 static BOOL api_lsa_priv_get_dispname(pipes_struct *p)
285 LSA_Q_PRIV_GET_DISPNAME q_u;
286 LSA_R_PRIV_GET_DISPNAME r_u;
287 prs_struct *data = &p->in_data.data;
288 prs_struct *rdata = &p->out_data.rdata;
293 if(!lsa_io_q_priv_get_dispname("", &q_u, data, 0)) {
294 DEBUG(0,("api_lsa_priv_get_dispname: failed to unmarshall LSA_Q_PRIV_GET_DISPNAME.\n"));
298 r_u.status = _lsa_priv_get_dispname(p, &q_u, &r_u);
300 /* store the response in the SMB stream */
301 if(!lsa_io_r_priv_get_dispname("", &r_u, rdata, 0)) {
302 DEBUG(0,("api_lsa_priv_get_dispname: Failed to marshall LSA_R_PRIV_GET_DISPNAME.\n"));
309 /***************************************************************************
311 ***************************************************************************/
313 static BOOL api_lsa_enum_accounts(pipes_struct *p)
315 LSA_Q_ENUM_ACCOUNTS q_u;
316 LSA_R_ENUM_ACCOUNTS r_u;
317 prs_struct *data = &p->in_data.data;
318 prs_struct *rdata = &p->out_data.rdata;
323 if(!lsa_io_q_enum_accounts("", &q_u, data, 0)) {
324 DEBUG(0,("api_lsa_enum_accounts: failed to unmarshall LSA_Q_ENUM_ACCOUNTS.\n"));
328 r_u.status = _lsa_enum_accounts(p, &q_u, &r_u);
330 /* store the response in the SMB stream */
331 if(!lsa_io_r_enum_accounts("", &r_u, rdata, 0)) {
332 DEBUG(0,("api_lsa_enum_accounts: Failed to marshall LSA_R_ENUM_ACCOUNTS.\n"));
339 /***************************************************************************
340 api_lsa_UNK_GET_CONNUSER
341 ***************************************************************************/
343 static BOOL api_lsa_unk_get_connuser(pipes_struct *p)
345 LSA_Q_UNK_GET_CONNUSER q_u;
346 LSA_R_UNK_GET_CONNUSER r_u;
348 prs_struct *data = &p->in_data.data;
349 prs_struct *rdata = &p->out_data.rdata;
354 if(!lsa_io_q_unk_get_connuser("", &q_u, data, 0)) {
355 DEBUG(0,("api_lsa_unk_get_connuser: failed to unmarshall LSA_Q_UNK_GET_CONNUSER.\n"));
359 r_u.status = _lsa_unk_get_connuser(p, &q_u, &r_u);
361 /* store the response in the SMB stream */
362 if(!lsa_io_r_unk_get_connuser("", &r_u, rdata, 0)) {
363 DEBUG(0,("api_lsa_unk_get_connuser: Failed to marshall LSA_R_UNK_GET_CONNUSER.\n"));
370 /***************************************************************************
372 ***************************************************************************/
374 static BOOL api_lsa_create_account(pipes_struct *p)
376 LSA_Q_CREATEACCOUNT q_u;
377 LSA_R_CREATEACCOUNT r_u;
379 prs_struct *data = &p->in_data.data;
380 prs_struct *rdata = &p->out_data.rdata;
385 if(!lsa_io_q_create_account("", &q_u, data, 0)) {
386 DEBUG(0,("api_lsa_create_account: failed to unmarshall LSA_Q_CREATEACCOUNT.\n"));
390 r_u.status = _lsa_create_account(p, &q_u, &r_u);
392 /* store the response in the SMB stream */
393 if(!lsa_io_r_create_account("", &r_u, rdata, 0)) {
394 DEBUG(0,("api_lsa_create_account: Failed to marshall LSA_R_CREATEACCOUNT.\n"));
401 /***************************************************************************
403 ***************************************************************************/
405 static BOOL api_lsa_open_account(pipes_struct *p)
407 LSA_Q_OPENACCOUNT q_u;
408 LSA_R_OPENACCOUNT r_u;
410 prs_struct *data = &p->in_data.data;
411 prs_struct *rdata = &p->out_data.rdata;
416 if(!lsa_io_q_open_account("", &q_u, data, 0)) {
417 DEBUG(0,("api_lsa_open_account: failed to unmarshall LSA_Q_OPENACCOUNT.\n"));
421 r_u.status = _lsa_open_account(p, &q_u, &r_u);
423 /* store the response in the SMB stream */
424 if(!lsa_io_r_open_account("", &r_u, rdata, 0)) {
425 DEBUG(0,("api_lsa_open_account: Failed to marshall LSA_R_OPENACCOUNT.\n"));
432 /***************************************************************************
434 ***************************************************************************/
436 static BOOL api_lsa_enum_privsaccount(pipes_struct *p)
438 LSA_Q_ENUMPRIVSACCOUNT q_u;
439 LSA_R_ENUMPRIVSACCOUNT r_u;
441 prs_struct *data = &p->in_data.data;
442 prs_struct *rdata = &p->out_data.rdata;
447 if(!lsa_io_q_enum_privsaccount("", &q_u, data, 0)) {
448 DEBUG(0,("api_lsa_enum_privsaccount: failed to unmarshall LSA_Q_ENUMPRIVSACCOUNT.\n"));
452 r_u.status = _lsa_enum_privsaccount(p, rdata, &q_u, &r_u);
454 /* store the response in the SMB stream */
455 if(!lsa_io_r_enum_privsaccount("", &r_u, rdata, 0)) {
456 DEBUG(0,("api_lsa_enum_privsaccount: Failed to marshall LSA_R_ENUMPRIVSACCOUNT.\n"));
463 /***************************************************************************
464 api_lsa_getsystemaccount
465 ***************************************************************************/
467 static BOOL api_lsa_getsystemaccount(pipes_struct *p)
469 LSA_Q_GETSYSTEMACCOUNT q_u;
470 LSA_R_GETSYSTEMACCOUNT r_u;
472 prs_struct *data = &p->in_data.data;
473 prs_struct *rdata = &p->out_data.rdata;
478 if(!lsa_io_q_getsystemaccount("", &q_u, data, 0)) {
479 DEBUG(0,("api_lsa_getsystemaccount: failed to unmarshall LSA_Q_GETSYSTEMACCOUNT.\n"));
483 r_u.status = _lsa_getsystemaccount(p, &q_u, &r_u);
485 /* store the response in the SMB stream */
486 if(!lsa_io_r_getsystemaccount("", &r_u, rdata, 0)) {
487 DEBUG(0,("api_lsa_getsystemaccount: Failed to marshall LSA_R_GETSYSTEMACCOUNT.\n"));
495 /***************************************************************************
496 api_lsa_setsystemaccount
497 ***************************************************************************/
499 static BOOL api_lsa_setsystemaccount(pipes_struct *p)
501 LSA_Q_SETSYSTEMACCOUNT q_u;
502 LSA_R_SETSYSTEMACCOUNT r_u;
504 prs_struct *data = &p->in_data.data;
505 prs_struct *rdata = &p->out_data.rdata;
510 if(!lsa_io_q_setsystemaccount("", &q_u, data, 0)) {
511 DEBUG(0,("api_lsa_setsystemaccount: failed to unmarshall LSA_Q_SETSYSTEMACCOUNT.\n"));
515 r_u.status = _lsa_setsystemaccount(p, &q_u, &r_u);
517 /* store the response in the SMB stream */
518 if(!lsa_io_r_setsystemaccount("", &r_u, rdata, 0)) {
519 DEBUG(0,("api_lsa_setsystemaccount: Failed to marshall LSA_R_SETSYSTEMACCOUNT.\n"));
526 /***************************************************************************
528 ***************************************************************************/
530 static BOOL api_lsa_addprivs(pipes_struct *p)
535 prs_struct *data = &p->in_data.data;
536 prs_struct *rdata = &p->out_data.rdata;
541 if(!lsa_io_q_addprivs("", &q_u, data, 0)) {
542 DEBUG(0,("api_lsa_addprivs: failed to unmarshall LSA_Q_ADDPRIVS.\n"));
546 r_u.status = _lsa_addprivs(p, &q_u, &r_u);
548 /* store the response in the SMB stream */
549 if(!lsa_io_r_addprivs("", &r_u, rdata, 0)) {
550 DEBUG(0,("api_lsa_addprivs: Failed to marshall LSA_R_ADDPRIVS.\n"));
557 /***************************************************************************
559 ***************************************************************************/
561 static BOOL api_lsa_removeprivs(pipes_struct *p)
563 LSA_Q_REMOVEPRIVS q_u;
564 LSA_R_REMOVEPRIVS r_u;
566 prs_struct *data = &p->in_data.data;
567 prs_struct *rdata = &p->out_data.rdata;
572 if(!lsa_io_q_removeprivs("", &q_u, data, 0)) {
573 DEBUG(0,("api_lsa_removeprivs: failed to unmarshall LSA_Q_REMOVEPRIVS.\n"));
577 r_u.status = _lsa_removeprivs(p, &q_u, &r_u);
579 /* store the response in the SMB stream */
580 if(!lsa_io_r_removeprivs("", &r_u, rdata, 0)) {
581 DEBUG(0,("api_lsa_removeprivs: Failed to marshall LSA_R_REMOVEPRIVS.\n"));
588 /***************************************************************************
590 ***************************************************************************/
592 static BOOL api_lsa_query_secobj(pipes_struct *p)
594 LSA_Q_QUERY_SEC_OBJ q_u;
595 LSA_R_QUERY_SEC_OBJ r_u;
597 prs_struct *data = &p->in_data.data;
598 prs_struct *rdata = &p->out_data.rdata;
603 if(!lsa_io_q_query_sec_obj("", &q_u, data, 0)) {
604 DEBUG(0,("api_lsa_query_secobj: failed to unmarshall LSA_Q_QUERY_SEC_OBJ.\n"));
608 r_u.status = _lsa_query_secobj(p, &q_u, &r_u);
610 /* store the response in the SMB stream */
611 if(!lsa_io_r_query_sec_obj("", &r_u, rdata, 0)) {
612 DEBUG(0,("api_lsa_query_secobj: Failed to marshall LSA_R_QUERY_SEC_OBJ.\n"));
619 /***************************************************************************
620 api_lsa_add_acct_rights
621 ***************************************************************************/
623 static BOOL api_lsa_add_acct_rights(pipes_struct *p)
625 LSA_Q_ADD_ACCT_RIGHTS q_u;
626 LSA_R_ADD_ACCT_RIGHTS r_u;
628 prs_struct *data = &p->in_data.data;
629 prs_struct *rdata = &p->out_data.rdata;
634 if(!lsa_io_q_add_acct_rights("", &q_u, data, 0)) {
635 DEBUG(0,("api_lsa_add_acct_rights: failed to unmarshall LSA_Q_ADD_ACCT_RIGHTS.\n"));
639 r_u.status = _lsa_add_acct_rights(p, &q_u, &r_u);
641 /* store the response in the SMB stream */
642 if(!lsa_io_r_add_acct_rights("", &r_u, rdata, 0)) {
643 DEBUG(0,("api_lsa_add_acct_rights: Failed to marshall LSA_R_ADD_ACCT_RIGHTS.\n"));
650 /***************************************************************************
651 api_lsa_remove_acct_rights
652 ***************************************************************************/
654 static BOOL api_lsa_remove_acct_rights(pipes_struct *p)
656 LSA_Q_REMOVE_ACCT_RIGHTS q_u;
657 LSA_R_REMOVE_ACCT_RIGHTS r_u;
659 prs_struct *data = &p->in_data.data;
660 prs_struct *rdata = &p->out_data.rdata;
665 if(!lsa_io_q_remove_acct_rights("", &q_u, data, 0)) {
666 DEBUG(0,("api_lsa_remove_acct_rights: failed to unmarshall LSA_Q_REMOVE_ACCT_RIGHTS.\n"));
670 r_u.status = _lsa_remove_acct_rights(p, &q_u, &r_u);
672 /* store the response in the SMB stream */
673 if(!lsa_io_r_remove_acct_rights("", &r_u, rdata, 0)) {
674 DEBUG(0,("api_lsa_remove_acct_rights: Failed to marshall LSA_R_REMOVE_ACCT_RIGHTS.\n"));
681 /***************************************************************************
682 api_lsa_enum_acct_rights
683 ***************************************************************************/
685 static BOOL api_lsa_enum_acct_rights(pipes_struct *p)
687 LSA_Q_ENUM_ACCT_RIGHTS q_u;
688 LSA_R_ENUM_ACCT_RIGHTS r_u;
690 prs_struct *data = &p->in_data.data;
691 prs_struct *rdata = &p->out_data.rdata;
696 if(!lsa_io_q_enum_acct_rights("", &q_u, data, 0)) {
697 DEBUG(0,("api_lsa_enum_acct_rights: failed to unmarshall LSA_Q_ENUM_ACCT_RIGHTS.\n"));
701 r_u.status = _lsa_enum_acct_rights(p, &q_u, &r_u);
703 /* store the response in the SMB stream */
704 if(!lsa_io_r_enum_acct_rights("", &r_u, rdata, 0)) {
705 DEBUG(0,("api_lsa_enum_acct_rights: Failed to marshall LSA_R_ENUM_ACCT_RIGHTS.\n"));
712 /***************************************************************************
713 api_lsa_lookup_priv_value
714 ***************************************************************************/
716 static BOOL api_lsa_lookup_priv_value(pipes_struct *p)
718 LSA_Q_LOOKUP_PRIV_VALUE q_u;
719 LSA_R_LOOKUP_PRIV_VALUE r_u;
721 prs_struct *data = &p->in_data.data;
722 prs_struct *rdata = &p->out_data.rdata;
727 if(!lsa_io_q_lookup_priv_value("", &q_u, data, 0)) {
728 DEBUG(0,("api_lsa_lookup_priv_value: failed to unmarshall LSA_Q_LOOKUP_PRIV_VALUE .\n"));
732 r_u.status = _lsa_lookup_priv_value(p, &q_u, &r_u);
734 /* store the response in the SMB stream */
735 if(!lsa_io_r_lookup_priv_value("", &r_u, rdata, 0)) {
736 DEBUG(0,("api_lsa_lookup_priv_value: Failed to marshall LSA_R_LOOKUP_PRIV_VALUE.\n"));
743 /***************************************************************************
744 ***************************************************************************/
746 static BOOL api_lsa_open_trust_dom(pipes_struct *p)
748 return proxy_lsa_call(p, DCERPC_LSA_OPENTRUSTEDDOMAIN);
751 /***************************************************************************
752 ***************************************************************************/
754 static BOOL api_lsa_create_trust_dom(pipes_struct *p)
756 return proxy_lsa_call(p, DCERPC_LSA_CREATETRUSTEDDOMAIN);
759 /***************************************************************************
760 ***************************************************************************/
762 static BOOL api_lsa_create_secret(pipes_struct *p)
764 return proxy_lsa_call(p, DCERPC_LSA_CREATESECRET);
767 /***************************************************************************
768 ***************************************************************************/
770 static BOOL api_lsa_set_secret(pipes_struct *p)
772 return proxy_lsa_call(p, DCERPC_LSA_SETSECRET);
775 /***************************************************************************
776 ***************************************************************************/
778 static BOOL api_lsa_delete_object(pipes_struct *p)
780 LSA_Q_DELETE_OBJECT q_u;
781 LSA_R_DELETE_OBJECT r_u;
783 prs_struct *data = &p->in_data.data;
784 prs_struct *rdata = &p->out_data.rdata;
789 if(!lsa_io_q_delete_object("", &q_u, data, 0)) {
790 DEBUG(0,("api_lsa_delete_object: failed to unmarshall LSA_Q_DELETE_OBJECT.\n"));
794 r_u.status = _lsa_delete_object(p, &q_u, &r_u);
796 /* store the response in the SMB stream */
797 if(!lsa_io_r_delete_object("", &r_u, rdata, 0)) {
798 DEBUG(0,("api_lsa_delete_object: Failed to marshall LSA_R_DELETE_OBJECT.\n"));
805 /***************************************************************************
807 ***************************************************************************/
809 static BOOL api_lsa_lookup_sids2(pipes_struct *p)
811 LSA_Q_LOOKUP_SIDS2 q_u;
812 LSA_R_LOOKUP_SIDS2 r_u;
813 prs_struct *data = &p->in_data.data;
814 prs_struct *rdata = &p->out_data.rdata;
819 /* grab the info class and policy handle */
820 if(!lsa_io_q_lookup_sids2("", &q_u, data, 0)) {
821 DEBUG(0,("api_lsa_lookup_sids2: failed to unmarshall LSA_Q_LOOKUP_SIDS2.\n"));
825 r_u.status = _lsa_lookup_sids2(p, &q_u, &r_u);
827 if(!lsa_io_r_lookup_sids2("", &r_u, rdata, 0)) {
828 DEBUG(0,("api_lsa_lookup_sids2: Failed to marshall LSA_R_LOOKUP_SIDS2.\n"));
835 /***************************************************************************
837 ***************************************************************************/
839 static BOOL api_lsa_lookup_sids3(pipes_struct *p)
841 LSA_Q_LOOKUP_SIDS3 q_u;
842 LSA_R_LOOKUP_SIDS3 r_u;
843 prs_struct *data = &p->in_data.data;
844 prs_struct *rdata = &p->out_data.rdata;
849 /* grab the info class and policy handle */
850 if(!lsa_io_q_lookup_sids3("", &q_u, data, 0)) {
851 DEBUG(0,("api_lsa_lookup_sids3: failed to unmarshall LSA_Q_LOOKUP_SIDS3.\n"));
855 r_u.status = _lsa_lookup_sids3(p, &q_u, &r_u);
857 if(!lsa_io_r_lookup_sids3("", &r_u, rdata, 0)) {
858 DEBUG(0,("api_lsa_lookup_sids3: Failed to marshall LSA_R_LOOKUP_SIDS3.\n"));
865 /***************************************************************************
866 api_lsa_lookup_names2
867 ***************************************************************************/
869 static BOOL api_lsa_lookup_names2(pipes_struct *p)
871 LSA_Q_LOOKUP_NAMES2 q_u;
872 LSA_R_LOOKUP_NAMES2 r_u;
873 prs_struct *data = &p->in_data.data;
874 prs_struct *rdata = &p->out_data.rdata;
879 /* grab the info class and policy handle */
880 if(!lsa_io_q_lookup_names2("", &q_u, data, 0)) {
881 DEBUG(0,("api_lsa_lookup_names2: failed to unmarshall LSA_Q_LOOKUP_NAMES2.\n"));
885 r_u.status = _lsa_lookup_names2(p, &q_u, &r_u);
887 /* store the response in the SMB stream */
888 if(!lsa_io_r_lookup_names2("", &r_u, rdata, 0)) {
889 DEBUG(0,("api_lsa_lookup_names2: Failed to marshall LSA_R_LOOKUP_NAMES2.\n"));
896 /***************************************************************************
897 api_lsa_lookup_names3
898 ***************************************************************************/
900 static BOOL api_lsa_lookup_names3(pipes_struct *p)
902 LSA_Q_LOOKUP_NAMES3 q_u;
903 LSA_R_LOOKUP_NAMES3 r_u;
904 prs_struct *data = &p->in_data.data;
905 prs_struct *rdata = &p->out_data.rdata;
910 /* grab the info class and policy handle */
911 if(!lsa_io_q_lookup_names3("", &q_u, data, 0)) {
912 DEBUG(0,("api_lsa_lookup_names3: failed to unmarshall LSA_Q_LOOKUP_NAMES3.\n"));
916 r_u.status = _lsa_lookup_names3(p, &q_u, &r_u);
918 /* store the response in the SMB stream */
919 if(!lsa_io_r_lookup_names3("", &r_u, rdata, 0)) {
920 DEBUG(0,("api_lsa_lookup_names3: Failed to marshall LSA_R_LOOKUP_NAMES3.\n"));
927 /***************************************************************************
928 api_lsa_lookup_names4
929 ***************************************************************************/
931 static BOOL api_lsa_lookup_names4(pipes_struct *p)
933 LSA_Q_LOOKUP_NAMES4 q_u;
934 LSA_R_LOOKUP_NAMES4 r_u;
935 prs_struct *data = &p->in_data.data;
936 prs_struct *rdata = &p->out_data.rdata;
941 /* grab the info class and policy handle */
942 if(!lsa_io_q_lookup_names4("", &q_u, data, 0)) {
943 DEBUG(0,("api_lsa_lookup_names4: failed to unmarshall LSA_Q_LOOKUP_NAMES4.\n"));
947 r_u.status = _lsa_lookup_names4(p, &q_u, &r_u);
949 /* store the response in the SMB stream */
950 if(!lsa_io_r_lookup_names4("", &r_u, rdata, 0)) {
951 DEBUG(0,("api_lsa_lookup_names4: Failed to marshall LSA_R_LOOKUP_NAMES4.\n"));
958 #if 0 /* AD DC work in ongoing in Samba 4 */
960 /***************************************************************************
962 ***************************************************************************/
964 static BOOL api_lsa_query_info2(pipes_struct *p)
966 LSA_Q_QUERY_INFO2 q_u;
967 LSA_R_QUERY_INFO2 r_u;
969 prs_struct *data = &p->in_data.data;
970 prs_struct *rdata = &p->out_data.rdata;
975 if(!lsa_io_q_query_info2("", &q_u, data, 0)) {
976 DEBUG(0,("api_lsa_query_info2: failed to unmarshall LSA_Q_QUERY_INFO2.\n"));
980 r_u.status = _lsa_query_info2(p, &q_u, &r_u);
982 if (!lsa_io_r_query_info2("", &r_u, rdata, 0)) {
983 DEBUG(0,("api_lsa_query_info2: failed to marshall LSA_R_QUERY_INFO2.\n"));
989 #endif /* AD DC work in ongoing in Samba 4 */
991 /***************************************************************************
993 ***************************************************************************/
995 static struct api_struct api_lsa_cmds[] =
997 { "LSA_OPENPOLICY2" , LSA_OPENPOLICY2 , api_lsa_open_policy2 },
998 { "LSA_OPENPOLICY" , LSA_OPENPOLICY , api_lsa_open_policy },
999 { "LSA_QUERYINFOPOLICY" , LSA_QUERYINFOPOLICY , api_lsa_query_info },
1000 { "LSA_ENUMTRUSTDOM" , LSA_ENUMTRUSTDOM , api_lsa_enum_trust_dom },
1001 { "LSA_CLOSE" , LSA_CLOSE , api_lsa_close },
1002 { "LSA_OPENSECRET" , LSA_OPENSECRET , api_lsa_open_secret },
1003 { "LSA_LOOKUPSIDS" , LSA_LOOKUPSIDS , api_lsa_lookup_sids },
1004 { "LSA_LOOKUPNAMES" , LSA_LOOKUPNAMES , api_lsa_lookup_names },
1005 { "LSA_ENUM_PRIVS" , LSA_ENUM_PRIVS , api_lsa_enum_privs },
1006 { "LSA_PRIV_GET_DISPNAME",LSA_PRIV_GET_DISPNAME,api_lsa_priv_get_dispname},
1007 { "LSA_ENUM_ACCOUNTS" , LSA_ENUM_ACCOUNTS , api_lsa_enum_accounts },
1008 { "LSA_UNK_GET_CONNUSER", LSA_UNK_GET_CONNUSER, api_lsa_unk_get_connuser },
1009 { "LSA_CREATEACCOUNT" , LSA_CREATEACCOUNT , api_lsa_create_account },
1010 { "LSA_OPENACCOUNT" , LSA_OPENACCOUNT , api_lsa_open_account },
1011 { "LSA_ENUMPRIVSACCOUNT", LSA_ENUMPRIVSACCOUNT, api_lsa_enum_privsaccount},
1012 { "LSA_GETSYSTEMACCOUNT", LSA_GETSYSTEMACCOUNT, api_lsa_getsystemaccount },
1013 { "LSA_SETSYSTEMACCOUNT", LSA_SETSYSTEMACCOUNT, api_lsa_setsystemaccount },
1014 { "LSA_ADDPRIVS" , LSA_ADDPRIVS , api_lsa_addprivs },
1015 { "LSA_REMOVEPRIVS" , LSA_REMOVEPRIVS , api_lsa_removeprivs },
1016 { "LSA_ADDACCTRIGHTS" , LSA_ADDACCTRIGHTS , api_lsa_add_acct_rights },
1017 { "LSA_REMOVEACCTRIGHTS", LSA_REMOVEACCTRIGHTS, api_lsa_remove_acct_rights },
1018 { "LSA_ENUMACCTRIGHTS" , LSA_ENUMACCTRIGHTS , api_lsa_enum_acct_rights },
1019 { "LSA_QUERYSECOBJ" , LSA_QUERYSECOBJ , api_lsa_query_secobj },
1020 { "LSA_LOOKUPPRIVVALUE" , LSA_LOOKUPPRIVVALUE , api_lsa_lookup_priv_value },
1021 { "LSA_OPENTRUSTDOM" , LSA_OPENTRUSTDOM , api_lsa_open_trust_dom },
1022 { "LSA_OPENSECRET" , LSA_OPENSECRET , api_lsa_open_secret },
1023 { "LSA_CREATETRUSTDOM" , LSA_CREATETRUSTDOM , api_lsa_create_trust_dom },
1024 { "LSA_CREATSECRET" , LSA_CREATESECRET , api_lsa_create_secret },
1025 { "LSA_SETSECRET" , LSA_SETSECRET , api_lsa_set_secret },
1026 { "LSA_DELETEOBJECT" , LSA_DELETEOBJECT , api_lsa_delete_object },
1027 { "LSA_LOOKUPSIDS2" , LSA_LOOKUPSIDS2 , api_lsa_lookup_sids2 },
1028 { "LSA_LOOKUPNAMES2" , LSA_LOOKUPNAMES2 , api_lsa_lookup_names2 },
1029 { "LSA_LOOKUPNAMES3" , LSA_LOOKUPNAMES3 , api_lsa_lookup_names3 },
1030 { "LSA_LOOKUPSIDS3" , LSA_LOOKUPSIDS3 , api_lsa_lookup_sids3 },
1031 { "LSA_LOOKUPNAMES4" , LSA_LOOKUPNAMES4 , api_lsa_lookup_names4 }
1032 #if 0 /* AD DC work in ongoing in Samba 4 */
1033 /* be careful of the adding of new RPC's. See commentrs below about
1034 ADS DC capabilities */
1035 { "LSA_QUERYINFO2" , LSA_QUERYINFO2 , api_lsa_query_info2 }
1036 #endif /* AD DC work in ongoing in Samba 4 */
1039 static int count_fns(void)
1041 int funcs = sizeof(api_lsa_cmds) / sizeof(struct api_struct);
1043 #if 0 /* AD DC work is on going in Samba 4 */
1045 * NOTE: Certain calls can not be enabled if we aren't an ADS DC. Make sure
1046 * these calls are always last and that you decrement by the amount of calls
1049 if (!(SEC_ADS == lp_security() && ROLE_DOMAIN_PDC == lp_server_role())) {
1052 #endif /* AD DC work in ongoing in Samba 4 */
1056 void lsa_get_pipe_fns( struct api_struct **fns, int *n_fns )
1058 *fns = api_lsa_cmds;
1059 *n_fns = count_fns();
1063 NTSTATUS rpc_lsa_init(void)
1065 int funcs = count_fns();
1067 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsarpc", "lsass", api_lsa_cmds,