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 2 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, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /* This is the interface to the lsa server code. */
31 #define DBGC_CLASS DBGC_RPC_SRV
33 static BOOL
proxy_lsa_call(pipes_struct
*p
, uint8 opnum
)
35 struct api_struct
*fns
;
38 lsarpc_get_pipe_fns(&fns
, &n_fns
);
43 if (fns
[opnum
].opnum
!= opnum
) {
44 smb_panic("LSA function table not sorted\n");
47 return fns
[opnum
].fn(p
);
50 /***************************************************************************
52 ***************************************************************************/
54 static BOOL
api_lsa_open_policy2(pipes_struct
*p
)
58 prs_struct
*data
= &p
->in_data
.data
;
59 prs_struct
*rdata
= &p
->out_data
.rdata
;
64 /* grab the server, object attributes and desired access flag...*/
65 if(!lsa_io_q_open_pol2("", &q_u
, data
, 0)) {
66 DEBUG(0,("api_lsa_open_policy2: unable to unmarshall LSA_Q_OPEN_POL2.\n"));
70 r_u
.status
= _lsa_open_policy2(p
, &q_u
, &r_u
);
72 /* store the response in the SMB stream */
73 if(!lsa_io_r_open_pol2("", &r_u
, rdata
, 0)) {
74 DEBUG(0,("api_lsa_open_policy2: unable to marshall LSA_R_OPEN_POL2.\n"));
81 /***************************************************************************
83 ***************************************************************************/
85 static BOOL
api_lsa_open_policy(pipes_struct
*p
)
89 prs_struct
*data
= &p
->in_data
.data
;
90 prs_struct
*rdata
= &p
->out_data
.rdata
;
95 /* grab the server, object attributes and desired access flag...*/
96 if(!lsa_io_q_open_pol("", &q_u
, data
, 0)) {
97 DEBUG(0,("api_lsa_open_policy: unable to unmarshall LSA_Q_OPEN_POL.\n"));
101 r_u
.status
= _lsa_open_policy(p
, &q_u
, &r_u
);
103 /* store the response in the SMB stream */
104 if(!lsa_io_r_open_pol("", &r_u
, rdata
, 0)) {
105 DEBUG(0,("api_lsa_open_policy: unable to marshall LSA_R_OPEN_POL.\n"));
112 /***************************************************************************
113 api_lsa_enum_trust_dom
114 ***************************************************************************/
116 static BOOL
api_lsa_enum_trust_dom(pipes_struct
*p
)
118 LSA_Q_ENUM_TRUST_DOM q_u
;
119 LSA_R_ENUM_TRUST_DOM r_u
;
120 prs_struct
*data
= &p
->in_data
.data
;
121 prs_struct
*rdata
= &p
->out_data
.rdata
;
126 /* grab the enum trust domain context etc. */
127 if(!lsa_io_q_enum_trust_dom("", &q_u
, data
, 0))
130 /* get required trusted domains information */
131 r_u
.status
= _lsa_enum_trust_dom(p
, &q_u
, &r_u
);
133 /* prepare the response */
134 if(!lsa_io_r_enum_trust_dom("", &r_u
, rdata
, 0))
140 /***************************************************************************
142 ***************************************************************************/
144 static BOOL
api_lsa_query_info(pipes_struct
*p
)
146 LSA_Q_QUERY_INFO q_u
;
147 LSA_R_QUERY_INFO r_u
;
148 prs_struct
*data
= &p
->in_data
.data
;
149 prs_struct
*rdata
= &p
->out_data
.rdata
;
154 /* grab the info class and policy handle */
155 if(!lsa_io_q_query("", &q_u
, data
, 0)) {
156 DEBUG(0,("api_lsa_query_info: failed to unmarshall LSA_Q_QUERY_INFO.\n"));
160 r_u
.status
= _lsa_query_info(p
, &q_u
, &r_u
);
162 /* store the response in the SMB stream */
163 if(!lsa_io_r_query("", &r_u
, rdata
, 0)) {
164 DEBUG(0,("api_lsa_query_info: failed to marshall LSA_R_QUERY_INFO.\n"));
171 /***************************************************************************
173 ***************************************************************************/
175 static BOOL
api_lsa_lookup_sids(pipes_struct
*p
)
177 LSA_Q_LOOKUP_SIDS q_u
;
178 LSA_R_LOOKUP_SIDS r_u
;
179 prs_struct
*data
= &p
->in_data
.data
;
180 prs_struct
*rdata
= &p
->out_data
.rdata
;
185 /* grab the info class and policy handle */
186 if(!lsa_io_q_lookup_sids("", &q_u
, data
, 0)) {
187 DEBUG(0,("api_lsa_lookup_sids: failed to unmarshall LSA_Q_LOOKUP_SIDS.\n"));
191 r_u
.status
= _lsa_lookup_sids(p
, &q_u
, &r_u
);
193 if(!lsa_io_r_lookup_sids("", &r_u
, rdata
, 0)) {
194 DEBUG(0,("api_lsa_lookup_sids: Failed to marshall LSA_R_LOOKUP_SIDS.\n"));
201 /***************************************************************************
203 ***************************************************************************/
205 static BOOL
api_lsa_lookup_names(pipes_struct
*p
)
207 LSA_Q_LOOKUP_NAMES q_u
;
208 LSA_R_LOOKUP_NAMES r_u
;
209 prs_struct
*data
= &p
->in_data
.data
;
210 prs_struct
*rdata
= &p
->out_data
.rdata
;
215 /* grab the info class and policy handle */
216 if(!lsa_io_q_lookup_names("", &q_u
, data
, 0)) {
217 DEBUG(0,("api_lsa_lookup_names: failed to unmarshall LSA_Q_LOOKUP_NAMES.\n"));
221 r_u
.status
= _lsa_lookup_names(p
, &q_u
, &r_u
);
223 /* store the response in the SMB stream */
224 if(!lsa_io_r_lookup_names("", &r_u
, rdata
, 0)) {
225 DEBUG(0,("api_lsa_lookup_names: Failed to marshall LSA_R_LOOKUP_NAMES.\n"));
232 /***************************************************************************
234 ***************************************************************************/
236 static BOOL
api_lsa_close(pipes_struct
*p
)
238 return proxy_lsa_call(p
, DCERPC_LSA_CLOSE
);
241 /***************************************************************************
243 ***************************************************************************/
245 static BOOL
api_lsa_open_secret(pipes_struct
*p
)
247 return proxy_lsa_call(p
, DCERPC_LSA_OPENSECRET
);
250 /***************************************************************************
252 ***************************************************************************/
254 static BOOL
api_lsa_enum_privs(pipes_struct
*p
)
256 LSA_Q_ENUM_PRIVS q_u
;
257 LSA_R_ENUM_PRIVS r_u
;
258 prs_struct
*data
= &p
->in_data
.data
;
259 prs_struct
*rdata
= &p
->out_data
.rdata
;
264 if(!lsa_io_q_enum_privs("", &q_u
, data
, 0)) {
265 DEBUG(0,("api_lsa_enum_privs: failed to unmarshall LSA_Q_ENUM_PRIVS.\n"));
269 r_u
.status
= _lsa_enum_privs(p
, &q_u
, &r_u
);
271 /* store the response in the SMB stream */
272 if(!lsa_io_r_enum_privs("", &r_u
, rdata
, 0)) {
273 DEBUG(0,("api_lsa_enum_privs: Failed to marshall LSA_R_ENUM_PRIVS.\n"));
280 /***************************************************************************
282 ***************************************************************************/
284 static BOOL
api_lsa_priv_get_dispname(pipes_struct
*p
)
286 LSA_Q_PRIV_GET_DISPNAME q_u
;
287 LSA_R_PRIV_GET_DISPNAME r_u
;
288 prs_struct
*data
= &p
->in_data
.data
;
289 prs_struct
*rdata
= &p
->out_data
.rdata
;
294 if(!lsa_io_q_priv_get_dispname("", &q_u
, data
, 0)) {
295 DEBUG(0,("api_lsa_priv_get_dispname: failed to unmarshall LSA_Q_PRIV_GET_DISPNAME.\n"));
299 r_u
.status
= _lsa_priv_get_dispname(p
, &q_u
, &r_u
);
301 /* store the response in the SMB stream */
302 if(!lsa_io_r_priv_get_dispname("", &r_u
, rdata
, 0)) {
303 DEBUG(0,("api_lsa_priv_get_dispname: Failed to marshall LSA_R_PRIV_GET_DISPNAME.\n"));
310 /***************************************************************************
312 ***************************************************************************/
314 static BOOL
api_lsa_enum_accounts(pipes_struct
*p
)
316 LSA_Q_ENUM_ACCOUNTS q_u
;
317 LSA_R_ENUM_ACCOUNTS r_u
;
318 prs_struct
*data
= &p
->in_data
.data
;
319 prs_struct
*rdata
= &p
->out_data
.rdata
;
324 if(!lsa_io_q_enum_accounts("", &q_u
, data
, 0)) {
325 DEBUG(0,("api_lsa_enum_accounts: failed to unmarshall LSA_Q_ENUM_ACCOUNTS.\n"));
329 r_u
.status
= _lsa_enum_accounts(p
, &q_u
, &r_u
);
331 /* store the response in the SMB stream */
332 if(!lsa_io_r_enum_accounts("", &r_u
, rdata
, 0)) {
333 DEBUG(0,("api_lsa_enum_accounts: Failed to marshall LSA_R_ENUM_ACCOUNTS.\n"));
340 /***************************************************************************
341 api_lsa_UNK_GET_CONNUSER
342 ***************************************************************************/
344 static BOOL
api_lsa_unk_get_connuser(pipes_struct
*p
)
346 LSA_Q_UNK_GET_CONNUSER q_u
;
347 LSA_R_UNK_GET_CONNUSER r_u
;
349 prs_struct
*data
= &p
->in_data
.data
;
350 prs_struct
*rdata
= &p
->out_data
.rdata
;
355 if(!lsa_io_q_unk_get_connuser("", &q_u
, data
, 0)) {
356 DEBUG(0,("api_lsa_unk_get_connuser: failed to unmarshall LSA_Q_UNK_GET_CONNUSER.\n"));
360 r_u
.status
= _lsa_unk_get_connuser(p
, &q_u
, &r_u
);
362 /* store the response in the SMB stream */
363 if(!lsa_io_r_unk_get_connuser("", &r_u
, rdata
, 0)) {
364 DEBUG(0,("api_lsa_unk_get_connuser: Failed to marshall LSA_R_UNK_GET_CONNUSER.\n"));
371 /***************************************************************************
373 ***************************************************************************/
375 static BOOL
api_lsa_create_account(pipes_struct
*p
)
377 LSA_Q_CREATEACCOUNT q_u
;
378 LSA_R_CREATEACCOUNT r_u
;
380 prs_struct
*data
= &p
->in_data
.data
;
381 prs_struct
*rdata
= &p
->out_data
.rdata
;
386 if(!lsa_io_q_create_account("", &q_u
, data
, 0)) {
387 DEBUG(0,("api_lsa_create_account: failed to unmarshall LSA_Q_CREATEACCOUNT.\n"));
391 r_u
.status
= _lsa_create_account(p
, &q_u
, &r_u
);
393 /* store the response in the SMB stream */
394 if(!lsa_io_r_create_account("", &r_u
, rdata
, 0)) {
395 DEBUG(0,("api_lsa_create_account: Failed to marshall LSA_R_CREATEACCOUNT.\n"));
402 /***************************************************************************
404 ***************************************************************************/
406 static BOOL
api_lsa_open_account(pipes_struct
*p
)
408 LSA_Q_OPENACCOUNT q_u
;
409 LSA_R_OPENACCOUNT r_u
;
411 prs_struct
*data
= &p
->in_data
.data
;
412 prs_struct
*rdata
= &p
->out_data
.rdata
;
417 if(!lsa_io_q_open_account("", &q_u
, data
, 0)) {
418 DEBUG(0,("api_lsa_open_account: failed to unmarshall LSA_Q_OPENACCOUNT.\n"));
422 r_u
.status
= _lsa_open_account(p
, &q_u
, &r_u
);
424 /* store the response in the SMB stream */
425 if(!lsa_io_r_open_account("", &r_u
, rdata
, 0)) {
426 DEBUG(0,("api_lsa_open_account: Failed to marshall LSA_R_OPENACCOUNT.\n"));
433 /***************************************************************************
435 ***************************************************************************/
437 static BOOL
api_lsa_enum_privsaccount(pipes_struct
*p
)
439 LSA_Q_ENUMPRIVSACCOUNT q_u
;
440 LSA_R_ENUMPRIVSACCOUNT r_u
;
442 prs_struct
*data
= &p
->in_data
.data
;
443 prs_struct
*rdata
= &p
->out_data
.rdata
;
448 if(!lsa_io_q_enum_privsaccount("", &q_u
, data
, 0)) {
449 DEBUG(0,("api_lsa_enum_privsaccount: failed to unmarshall LSA_Q_ENUMPRIVSACCOUNT.\n"));
453 r_u
.status
= _lsa_enum_privsaccount(p
, rdata
, &q_u
, &r_u
);
455 /* store the response in the SMB stream */
456 if(!lsa_io_r_enum_privsaccount("", &r_u
, rdata
, 0)) {
457 DEBUG(0,("api_lsa_enum_privsaccount: Failed to marshall LSA_R_ENUMPRIVSACCOUNT.\n"));
464 /***************************************************************************
465 api_lsa_getsystemaccount
466 ***************************************************************************/
468 static BOOL
api_lsa_getsystemaccount(pipes_struct
*p
)
470 LSA_Q_GETSYSTEMACCOUNT q_u
;
471 LSA_R_GETSYSTEMACCOUNT r_u
;
473 prs_struct
*data
= &p
->in_data
.data
;
474 prs_struct
*rdata
= &p
->out_data
.rdata
;
479 if(!lsa_io_q_getsystemaccount("", &q_u
, data
, 0)) {
480 DEBUG(0,("api_lsa_getsystemaccount: failed to unmarshall LSA_Q_GETSYSTEMACCOUNT.\n"));
484 r_u
.status
= _lsa_getsystemaccount(p
, &q_u
, &r_u
);
486 /* store the response in the SMB stream */
487 if(!lsa_io_r_getsystemaccount("", &r_u
, rdata
, 0)) {
488 DEBUG(0,("api_lsa_getsystemaccount: Failed to marshall LSA_R_GETSYSTEMACCOUNT.\n"));
496 /***************************************************************************
497 api_lsa_setsystemaccount
498 ***************************************************************************/
500 static BOOL
api_lsa_setsystemaccount(pipes_struct
*p
)
502 LSA_Q_SETSYSTEMACCOUNT q_u
;
503 LSA_R_SETSYSTEMACCOUNT r_u
;
505 prs_struct
*data
= &p
->in_data
.data
;
506 prs_struct
*rdata
= &p
->out_data
.rdata
;
511 if(!lsa_io_q_setsystemaccount("", &q_u
, data
, 0)) {
512 DEBUG(0,("api_lsa_setsystemaccount: failed to unmarshall LSA_Q_SETSYSTEMACCOUNT.\n"));
516 r_u
.status
= _lsa_setsystemaccount(p
, &q_u
, &r_u
);
518 /* store the response in the SMB stream */
519 if(!lsa_io_r_setsystemaccount("", &r_u
, rdata
, 0)) {
520 DEBUG(0,("api_lsa_setsystemaccount: Failed to marshall LSA_R_SETSYSTEMACCOUNT.\n"));
527 /***************************************************************************
529 ***************************************************************************/
531 static BOOL
api_lsa_addprivs(pipes_struct
*p
)
536 prs_struct
*data
= &p
->in_data
.data
;
537 prs_struct
*rdata
= &p
->out_data
.rdata
;
542 if(!lsa_io_q_addprivs("", &q_u
, data
, 0)) {
543 DEBUG(0,("api_lsa_addprivs: failed to unmarshall LSA_Q_ADDPRIVS.\n"));
547 r_u
.status
= _lsa_addprivs(p
, &q_u
, &r_u
);
549 /* store the response in the SMB stream */
550 if(!lsa_io_r_addprivs("", &r_u
, rdata
, 0)) {
551 DEBUG(0,("api_lsa_addprivs: Failed to marshall LSA_R_ADDPRIVS.\n"));
558 /***************************************************************************
560 ***************************************************************************/
562 static BOOL
api_lsa_removeprivs(pipes_struct
*p
)
564 LSA_Q_REMOVEPRIVS q_u
;
565 LSA_R_REMOVEPRIVS r_u
;
567 prs_struct
*data
= &p
->in_data
.data
;
568 prs_struct
*rdata
= &p
->out_data
.rdata
;
573 if(!lsa_io_q_removeprivs("", &q_u
, data
, 0)) {
574 DEBUG(0,("api_lsa_removeprivs: failed to unmarshall LSA_Q_REMOVEPRIVS.\n"));
578 r_u
.status
= _lsa_removeprivs(p
, &q_u
, &r_u
);
580 /* store the response in the SMB stream */
581 if(!lsa_io_r_removeprivs("", &r_u
, rdata
, 0)) {
582 DEBUG(0,("api_lsa_removeprivs: Failed to marshall LSA_R_REMOVEPRIVS.\n"));
589 /***************************************************************************
591 ***************************************************************************/
593 static BOOL
api_lsa_query_secobj(pipes_struct
*p
)
595 LSA_Q_QUERY_SEC_OBJ q_u
;
596 LSA_R_QUERY_SEC_OBJ r_u
;
598 prs_struct
*data
= &p
->in_data
.data
;
599 prs_struct
*rdata
= &p
->out_data
.rdata
;
604 if(!lsa_io_q_query_sec_obj("", &q_u
, data
, 0)) {
605 DEBUG(0,("api_lsa_query_secobj: failed to unmarshall LSA_Q_QUERY_SEC_OBJ.\n"));
609 r_u
.status
= _lsa_query_secobj(p
, &q_u
, &r_u
);
611 /* store the response in the SMB stream */
612 if(!lsa_io_r_query_sec_obj("", &r_u
, rdata
, 0)) {
613 DEBUG(0,("api_lsa_query_secobj: Failed to marshall LSA_R_QUERY_SEC_OBJ.\n"));
620 /***************************************************************************
621 api_lsa_add_acct_rights
622 ***************************************************************************/
624 static BOOL
api_lsa_add_acct_rights(pipes_struct
*p
)
626 LSA_Q_ADD_ACCT_RIGHTS q_u
;
627 LSA_R_ADD_ACCT_RIGHTS r_u
;
629 prs_struct
*data
= &p
->in_data
.data
;
630 prs_struct
*rdata
= &p
->out_data
.rdata
;
635 if(!lsa_io_q_add_acct_rights("", &q_u
, data
, 0)) {
636 DEBUG(0,("api_lsa_add_acct_rights: failed to unmarshall LSA_Q_ADD_ACCT_RIGHTS.\n"));
640 r_u
.status
= _lsa_add_acct_rights(p
, &q_u
, &r_u
);
642 /* store the response in the SMB stream */
643 if(!lsa_io_r_add_acct_rights("", &r_u
, rdata
, 0)) {
644 DEBUG(0,("api_lsa_add_acct_rights: Failed to marshall LSA_R_ADD_ACCT_RIGHTS.\n"));
651 /***************************************************************************
652 api_lsa_remove_acct_rights
653 ***************************************************************************/
655 static BOOL
api_lsa_remove_acct_rights(pipes_struct
*p
)
657 LSA_Q_REMOVE_ACCT_RIGHTS q_u
;
658 LSA_R_REMOVE_ACCT_RIGHTS r_u
;
660 prs_struct
*data
= &p
->in_data
.data
;
661 prs_struct
*rdata
= &p
->out_data
.rdata
;
666 if(!lsa_io_q_remove_acct_rights("", &q_u
, data
, 0)) {
667 DEBUG(0,("api_lsa_remove_acct_rights: failed to unmarshall LSA_Q_REMOVE_ACCT_RIGHTS.\n"));
671 r_u
.status
= _lsa_remove_acct_rights(p
, &q_u
, &r_u
);
673 /* store the response in the SMB stream */
674 if(!lsa_io_r_remove_acct_rights("", &r_u
, rdata
, 0)) {
675 DEBUG(0,("api_lsa_remove_acct_rights: Failed to marshall LSA_R_REMOVE_ACCT_RIGHTS.\n"));
682 /***************************************************************************
683 api_lsa_enum_acct_rights
684 ***************************************************************************/
686 static BOOL
api_lsa_enum_acct_rights(pipes_struct
*p
)
688 LSA_Q_ENUM_ACCT_RIGHTS q_u
;
689 LSA_R_ENUM_ACCT_RIGHTS r_u
;
691 prs_struct
*data
= &p
->in_data
.data
;
692 prs_struct
*rdata
= &p
->out_data
.rdata
;
697 if(!lsa_io_q_enum_acct_rights("", &q_u
, data
, 0)) {
698 DEBUG(0,("api_lsa_enum_acct_rights: failed to unmarshall LSA_Q_ENUM_ACCT_RIGHTS.\n"));
702 r_u
.status
= _lsa_enum_acct_rights(p
, &q_u
, &r_u
);
704 /* store the response in the SMB stream */
705 if(!lsa_io_r_enum_acct_rights("", &r_u
, rdata
, 0)) {
706 DEBUG(0,("api_lsa_enum_acct_rights: Failed to marshall LSA_R_ENUM_ACCT_RIGHTS.\n"));
713 /***************************************************************************
714 api_lsa_lookup_priv_value
715 ***************************************************************************/
717 static BOOL
api_lsa_lookup_priv_value(pipes_struct
*p
)
719 LSA_Q_LOOKUP_PRIV_VALUE q_u
;
720 LSA_R_LOOKUP_PRIV_VALUE r_u
;
722 prs_struct
*data
= &p
->in_data
.data
;
723 prs_struct
*rdata
= &p
->out_data
.rdata
;
728 if(!lsa_io_q_lookup_priv_value("", &q_u
, data
, 0)) {
729 DEBUG(0,("api_lsa_lookup_priv_value: failed to unmarshall LSA_Q_LOOKUP_PRIV_VALUE .\n"));
733 r_u
.status
= _lsa_lookup_priv_value(p
, &q_u
, &r_u
);
735 /* store the response in the SMB stream */
736 if(!lsa_io_r_lookup_priv_value("", &r_u
, rdata
, 0)) {
737 DEBUG(0,("api_lsa_lookup_priv_value: Failed to marshall LSA_R_LOOKUP_PRIV_VALUE.\n"));
744 /***************************************************************************
745 ***************************************************************************/
747 static BOOL
api_lsa_open_trust_dom(pipes_struct
*p
)
749 return proxy_lsa_call(p
, DCERPC_LSA_OPENTRUSTEDDOMAIN
);
752 /***************************************************************************
753 ***************************************************************************/
755 static BOOL
api_lsa_create_trust_dom(pipes_struct
*p
)
757 return proxy_lsa_call(p
, DCERPC_LSA_CREATETRUSTEDDOMAIN
);
760 /***************************************************************************
761 ***************************************************************************/
763 static BOOL
api_lsa_create_secret(pipes_struct
*p
)
765 return proxy_lsa_call(p
, DCERPC_LSA_CREATESECRET
);
768 /***************************************************************************
769 ***************************************************************************/
771 static BOOL
api_lsa_set_secret(pipes_struct
*p
)
773 return proxy_lsa_call(p
, DCERPC_LSA_SETSECRET
);
776 /***************************************************************************
777 ***************************************************************************/
779 static BOOL
api_lsa_delete_object(pipes_struct
*p
)
781 LSA_Q_DELETE_OBJECT q_u
;
782 LSA_R_DELETE_OBJECT r_u
;
784 prs_struct
*data
= &p
->in_data
.data
;
785 prs_struct
*rdata
= &p
->out_data
.rdata
;
790 if(!lsa_io_q_delete_object("", &q_u
, data
, 0)) {
791 DEBUG(0,("api_lsa_delete_object: failed to unmarshall LSA_Q_DELETE_OBJECT.\n"));
795 r_u
.status
= _lsa_delete_object(p
, &q_u
, &r_u
);
797 /* store the response in the SMB stream */
798 if(!lsa_io_r_delete_object("", &r_u
, rdata
, 0)) {
799 DEBUG(0,("api_lsa_delete_object: Failed to marshall LSA_R_DELETE_OBJECT.\n"));
806 /***************************************************************************
808 ***************************************************************************/
810 static BOOL
api_lsa_lookup_sids2(pipes_struct
*p
)
812 LSA_Q_LOOKUP_SIDS2 q_u
;
813 LSA_R_LOOKUP_SIDS2 r_u
;
814 prs_struct
*data
= &p
->in_data
.data
;
815 prs_struct
*rdata
= &p
->out_data
.rdata
;
820 /* grab the info class and policy handle */
821 if(!lsa_io_q_lookup_sids2("", &q_u
, data
, 0)) {
822 DEBUG(0,("api_lsa_lookup_sids2: failed to unmarshall LSA_Q_LOOKUP_SIDS2.\n"));
826 r_u
.status
= _lsa_lookup_sids2(p
, &q_u
, &r_u
);
828 if(!lsa_io_r_lookup_sids2("", &r_u
, rdata
, 0)) {
829 DEBUG(0,("api_lsa_lookup_sids2: Failed to marshall LSA_R_LOOKUP_SIDS2.\n"));
836 /***************************************************************************
838 ***************************************************************************/
840 static BOOL
api_lsa_lookup_sids3(pipes_struct
*p
)
842 LSA_Q_LOOKUP_SIDS3 q_u
;
843 LSA_R_LOOKUP_SIDS3 r_u
;
844 prs_struct
*data
= &p
->in_data
.data
;
845 prs_struct
*rdata
= &p
->out_data
.rdata
;
850 /* grab the info class and policy handle */
851 if(!lsa_io_q_lookup_sids3("", &q_u
, data
, 0)) {
852 DEBUG(0,("api_lsa_lookup_sids3: failed to unmarshall LSA_Q_LOOKUP_SIDS3.\n"));
856 r_u
.status
= _lsa_lookup_sids3(p
, &q_u
, &r_u
);
858 if(!lsa_io_r_lookup_sids3("", &r_u
, rdata
, 0)) {
859 DEBUG(0,("api_lsa_lookup_sids3: Failed to marshall LSA_R_LOOKUP_SIDS3.\n"));
866 /***************************************************************************
867 api_lsa_lookup_names2
868 ***************************************************************************/
870 static BOOL
api_lsa_lookup_names2(pipes_struct
*p
)
872 LSA_Q_LOOKUP_NAMES2 q_u
;
873 LSA_R_LOOKUP_NAMES2 r_u
;
874 prs_struct
*data
= &p
->in_data
.data
;
875 prs_struct
*rdata
= &p
->out_data
.rdata
;
880 /* grab the info class and policy handle */
881 if(!lsa_io_q_lookup_names2("", &q_u
, data
, 0)) {
882 DEBUG(0,("api_lsa_lookup_names2: failed to unmarshall LSA_Q_LOOKUP_NAMES2.\n"));
886 r_u
.status
= _lsa_lookup_names2(p
, &q_u
, &r_u
);
888 /* store the response in the SMB stream */
889 if(!lsa_io_r_lookup_names2("", &r_u
, rdata
, 0)) {
890 DEBUG(0,("api_lsa_lookup_names2: Failed to marshall LSA_R_LOOKUP_NAMES2.\n"));
897 /***************************************************************************
898 api_lsa_lookup_names3
899 ***************************************************************************/
901 static BOOL
api_lsa_lookup_names3(pipes_struct
*p
)
903 LSA_Q_LOOKUP_NAMES3 q_u
;
904 LSA_R_LOOKUP_NAMES3 r_u
;
905 prs_struct
*data
= &p
->in_data
.data
;
906 prs_struct
*rdata
= &p
->out_data
.rdata
;
911 /* grab the info class and policy handle */
912 if(!lsa_io_q_lookup_names3("", &q_u
, data
, 0)) {
913 DEBUG(0,("api_lsa_lookup_names3: failed to unmarshall LSA_Q_LOOKUP_NAMES3.\n"));
917 r_u
.status
= _lsa_lookup_names3(p
, &q_u
, &r_u
);
919 /* store the response in the SMB stream */
920 if(!lsa_io_r_lookup_names3("", &r_u
, rdata
, 0)) {
921 DEBUG(0,("api_lsa_lookup_names3: Failed to marshall LSA_R_LOOKUP_NAMES3.\n"));
928 /***************************************************************************
929 api_lsa_lookup_names4
930 ***************************************************************************/
932 static BOOL
api_lsa_lookup_names4(pipes_struct
*p
)
934 LSA_Q_LOOKUP_NAMES4 q_u
;
935 LSA_R_LOOKUP_NAMES4 r_u
;
936 prs_struct
*data
= &p
->in_data
.data
;
937 prs_struct
*rdata
= &p
->out_data
.rdata
;
942 /* grab the info class and policy handle */
943 if(!lsa_io_q_lookup_names4("", &q_u
, data
, 0)) {
944 DEBUG(0,("api_lsa_lookup_names4: failed to unmarshall LSA_Q_LOOKUP_NAMES4.\n"));
948 r_u
.status
= _lsa_lookup_names4(p
, &q_u
, &r_u
);
950 /* store the response in the SMB stream */
951 if(!lsa_io_r_lookup_names4("", &r_u
, rdata
, 0)) {
952 DEBUG(0,("api_lsa_lookup_names4: Failed to marshall LSA_R_LOOKUP_NAMES4.\n"));
959 #if 0 /* AD DC work in ongoing in Samba 4 */
961 /***************************************************************************
963 ***************************************************************************/
965 static BOOL
api_lsa_query_info2(pipes_struct
*p
)
967 LSA_Q_QUERY_INFO2 q_u
;
968 LSA_R_QUERY_INFO2 r_u
;
970 prs_struct
*data
= &p
->in_data
.data
;
971 prs_struct
*rdata
= &p
->out_data
.rdata
;
976 if(!lsa_io_q_query_info2("", &q_u
, data
, 0)) {
977 DEBUG(0,("api_lsa_query_info2: failed to unmarshall LSA_Q_QUERY_INFO2.\n"));
981 r_u
.status
= _lsa_query_info2(p
, &q_u
, &r_u
);
983 if (!lsa_io_r_query_info2("", &r_u
, rdata
, 0)) {
984 DEBUG(0,("api_lsa_query_info2: failed to marshall LSA_R_QUERY_INFO2.\n"));
990 #endif /* AD DC work in ongoing in Samba 4 */
992 /***************************************************************************
994 ***************************************************************************/
996 static struct api_struct api_lsa_cmds
[] =
998 { "LSA_OPENPOLICY2" , LSA_OPENPOLICY2
, api_lsa_open_policy2
},
999 { "LSA_OPENPOLICY" , LSA_OPENPOLICY
, api_lsa_open_policy
},
1000 { "LSA_QUERYINFOPOLICY" , LSA_QUERYINFOPOLICY
, api_lsa_query_info
},
1001 { "LSA_ENUMTRUSTDOM" , LSA_ENUMTRUSTDOM
, api_lsa_enum_trust_dom
},
1002 { "LSA_CLOSE" , LSA_CLOSE
, api_lsa_close
},
1003 { "LSA_OPENSECRET" , LSA_OPENSECRET
, api_lsa_open_secret
},
1004 { "LSA_LOOKUPSIDS" , LSA_LOOKUPSIDS
, api_lsa_lookup_sids
},
1005 { "LSA_LOOKUPNAMES" , LSA_LOOKUPNAMES
, api_lsa_lookup_names
},
1006 { "LSA_ENUM_PRIVS" , LSA_ENUM_PRIVS
, api_lsa_enum_privs
},
1007 { "LSA_PRIV_GET_DISPNAME",LSA_PRIV_GET_DISPNAME
,api_lsa_priv_get_dispname
},
1008 { "LSA_ENUM_ACCOUNTS" , LSA_ENUM_ACCOUNTS
, api_lsa_enum_accounts
},
1009 { "LSA_UNK_GET_CONNUSER", LSA_UNK_GET_CONNUSER
, api_lsa_unk_get_connuser
},
1010 { "LSA_CREATEACCOUNT" , LSA_CREATEACCOUNT
, api_lsa_create_account
},
1011 { "LSA_OPENACCOUNT" , LSA_OPENACCOUNT
, api_lsa_open_account
},
1012 { "LSA_ENUMPRIVSACCOUNT", LSA_ENUMPRIVSACCOUNT
, api_lsa_enum_privsaccount
},
1013 { "LSA_GETSYSTEMACCOUNT", LSA_GETSYSTEMACCOUNT
, api_lsa_getsystemaccount
},
1014 { "LSA_SETSYSTEMACCOUNT", LSA_SETSYSTEMACCOUNT
, api_lsa_setsystemaccount
},
1015 { "LSA_ADDPRIVS" , LSA_ADDPRIVS
, api_lsa_addprivs
},
1016 { "LSA_REMOVEPRIVS" , LSA_REMOVEPRIVS
, api_lsa_removeprivs
},
1017 { "LSA_ADDACCTRIGHTS" , LSA_ADDACCTRIGHTS
, api_lsa_add_acct_rights
},
1018 { "LSA_REMOVEACCTRIGHTS", LSA_REMOVEACCTRIGHTS
, api_lsa_remove_acct_rights
},
1019 { "LSA_ENUMACCTRIGHTS" , LSA_ENUMACCTRIGHTS
, api_lsa_enum_acct_rights
},
1020 { "LSA_QUERYSECOBJ" , LSA_QUERYSECOBJ
, api_lsa_query_secobj
},
1021 { "LSA_LOOKUPPRIVVALUE" , LSA_LOOKUPPRIVVALUE
, api_lsa_lookup_priv_value
},
1022 { "LSA_OPENTRUSTDOM" , LSA_OPENTRUSTDOM
, api_lsa_open_trust_dom
},
1023 { "LSA_OPENSECRET" , LSA_OPENSECRET
, api_lsa_open_secret
},
1024 { "LSA_CREATETRUSTDOM" , LSA_CREATETRUSTDOM
, api_lsa_create_trust_dom
},
1025 { "LSA_CREATSECRET" , LSA_CREATESECRET
, api_lsa_create_secret
},
1026 { "LSA_SETSECRET" , LSA_SETSECRET
, api_lsa_set_secret
},
1027 { "LSA_DELETEOBJECT" , LSA_DELETEOBJECT
, api_lsa_delete_object
},
1028 { "LSA_LOOKUPSIDS2" , LSA_LOOKUPSIDS2
, api_lsa_lookup_sids2
},
1029 { "LSA_LOOKUPNAMES2" , LSA_LOOKUPNAMES2
, api_lsa_lookup_names2
},
1030 { "LSA_LOOKUPNAMES3" , LSA_LOOKUPNAMES3
, api_lsa_lookup_names3
},
1031 { "LSA_LOOKUPSIDS3" , LSA_LOOKUPSIDS3
, api_lsa_lookup_sids3
},
1032 { "LSA_LOOKUPNAMES4" , LSA_LOOKUPNAMES4
, api_lsa_lookup_names4
}
1033 #if 0 /* AD DC work in ongoing in Samba 4 */
1034 /* be careful of the adding of new RPC's. See commentrs below about
1035 ADS DC capabilities */
1036 { "LSA_QUERYINFO2" , LSA_QUERYINFO2
, api_lsa_query_info2
}
1037 #endif /* AD DC work in ongoing in Samba 4 */
1040 static int count_fns(void)
1042 int funcs
= sizeof(api_lsa_cmds
) / sizeof(struct api_struct
);
1044 #if 0 /* AD DC work is on going in Samba 4 */
1046 * NOTE: Certain calls can not be enabled if we aren't an ADS DC. Make sure
1047 * these calls are always last and that you decrement by the amount of calls
1050 if (!(SEC_ADS
== lp_security() && ROLE_DOMAIN_PDC
== lp_server_role())) {
1053 #endif /* AD DC work in ongoing in Samba 4 */
1057 void lsa_get_pipe_fns( struct api_struct
**fns
, int *n_fns
)
1059 *fns
= api_lsa_cmds
;
1060 *n_fns
= count_fns();
1064 NTSTATUS
rpc_lsa_init(void)
1066 int funcs
= count_fns();
1068 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION
, "lsarpc", "lsass", api_lsa_cmds
,