2 Unix SMB/Netbios implementation.
5 Copyright (C) Tim Potter 2000-2001,
6 Copyright (C) Andrew Tridgell 1992-1997,2000,
7 Copyright (C) Luke Kenneth Casson Leighton 1996-1997,2000,
8 Copyright (C) Paul Ashton 1997,2000,
9 Copyright (C) Elrond 2000.
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.
28 /** @defgroup lsa LSA rpc client routines
37 * RPC client routines for the LSA RPC pipe. LSA means "local
38 * security authority", which is half of a password database.
41 /** Opens a SMB connection and connects to the LSARPC pipe.
43 * @param cli Uninitialised client handle.
44 * @param system_name NETBIOS name of the machine to connect to.
45 * @param creds User credentials to connect as.
46 * @returns Initialised client handle.
48 struct cli_state *cli_lsa_initialise(struct cli_state *cli, char *system_name,
49 struct ntuser_creds *creds)
51 return cli_pipe_initialise(cli, system_name, PIPE_LSARPC, creds);
54 /** Open a LSA policy handle
56 * @param cli Handle on an initialised SMB connection */
58 NTSTATUS cli_lsa_open_policy(struct cli_state *cli, TALLOC_CTX *mem_ctx,
59 BOOL sec_qos, uint32 des_access, POLICY_HND *pol)
61 prs_struct qbuf, rbuf;
70 /* Initialise parse structures */
72 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
73 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
75 /* Initialise input parameters */
78 init_lsa_sec_qos(&qos, 2, 1, 0, des_access);
79 init_q_open_pol(&q, '\\', 0, des_access, &qos);
81 init_q_open_pol(&q, '\\', 0, des_access, NULL);
84 /* Marshall data and send request */
86 if (!lsa_io_q_open_pol("", &q, &qbuf, 0) ||
87 !rpc_api_pipe_req(cli, LSA_OPENPOLICY, &qbuf, &rbuf)) {
88 result = NT_STATUS_UNSUCCESSFUL;
92 /* Unmarshall response */
94 if (!lsa_io_r_open_pol("", &r, &rbuf, 0)) {
95 result = NT_STATUS_UNSUCCESSFUL;
99 /* Return output parameters */
101 if (NT_STATUS_IS_OK(result = r.status)) {
112 /** Open a LSA policy handle */
114 NTSTATUS cli_lsa_open_policy2(struct cli_state *cli, TALLOC_CTX *mem_ctx,
115 BOOL sec_qos, uint32 des_access, POLICY_HND *pol)
117 prs_struct qbuf, rbuf;
126 /* Initialise parse structures */
128 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
129 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
131 /* Initialise input parameters */
134 init_lsa_sec_qos(&qos, 2, 1, 0, des_access);
135 init_q_open_pol2(&q, cli->clnt_name_slash, 0, des_access,
138 init_q_open_pol2(&q, cli->clnt_name_slash, 0, des_access,
142 /* Marshall data and send request */
144 if (!lsa_io_q_open_pol2("", &q, &qbuf, 0) ||
145 !rpc_api_pipe_req(cli, LSA_OPENPOLICY2, &qbuf, &rbuf)) {
146 result = NT_STATUS_UNSUCCESSFUL;
150 /* Unmarshall response */
152 if (!lsa_io_r_open_pol2("", &r, &rbuf, 0)) {
153 result = NT_STATUS_UNSUCCESSFUL;
157 /* Return output parameters */
159 if (NT_STATUS_IS_OK(result = r.status)) {
170 /** Close a LSA policy handle */
172 NTSTATUS cli_lsa_close(struct cli_state *cli, TALLOC_CTX *mem_ctx,
175 prs_struct qbuf, rbuf;
183 /* Initialise parse structures */
185 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
186 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
188 /* Marshall data and send request */
190 init_lsa_q_close(&q, pol);
192 if (!lsa_io_q_close("", &q, &qbuf, 0) ||
193 !rpc_api_pipe_req(cli, LSA_CLOSE, &qbuf, &rbuf)) {
194 result = NT_STATUS_UNSUCCESSFUL;
198 /* Unmarshall response */
200 if (!lsa_io_r_close("", &r, &rbuf, 0)) {
201 result = NT_STATUS_UNSUCCESSFUL;
205 /* Return output parameters */
207 if (NT_STATUS_IS_OK(result = r.status)) {
218 /** Lookup a list of sids */
220 NTSTATUS cli_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
221 POLICY_HND *pol, int num_sids, DOM_SID *sids,
222 char ***names, uint32 **types, int *num_names)
224 prs_struct qbuf, rbuf;
228 LSA_TRANS_NAME_ENUM t_names;
235 /* Initialise parse structures */
237 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
238 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
240 /* Marshall data and send request */
242 init_q_lookup_sids(mem_ctx, &q, pol, num_sids, sids, 1);
244 if (!lsa_io_q_lookup_sids("", &q, &qbuf, 0) ||
245 !rpc_api_pipe_req(cli, LSA_LOOKUPSIDS, &qbuf, &rbuf)) {
246 result = NT_STATUS_UNSUCCESSFUL;
250 /* Unmarshall response */
253 ZERO_STRUCT(t_names);
258 if (!lsa_io_r_lookup_sids("", &r, &rbuf, 0)) {
259 result = NT_STATUS_UNSUCCESSFUL;
265 if (!NT_STATUS_IS_OK(result) &&
266 NT_STATUS_V(result) != NT_STATUS_V(NT_STATUS_FILES_OPEN)) {
267 /* An actual error occured */
273 /* Return output parameters */
275 if (r.mapped_count == 0) {
276 result = NT_STATUS_NONE_MAPPED;
280 (*num_names) = r.mapped_count;
281 result = NT_STATUS_OK;
283 if (!((*names) = (char **)talloc(mem_ctx, sizeof(char *) * r.mapped_count))) {
284 DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
285 result = NT_STATUS_UNSUCCESSFUL;
289 if (!((*types) = (uint32 *)talloc(mem_ctx, sizeof(uint32) * r.mapped_count))) {
290 DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
291 result = NT_STATUS_UNSUCCESSFUL;
295 for (i = 0; i < r.mapped_count; i++) {
296 fstring name, dom_name, full_name;
297 uint32 dom_idx = t_names.name[i].domain_idx;
299 /* Translate optimised name through domain index array */
301 if (dom_idx != 0xffffffff) {
303 rpcstr_pull_unistr2_fstring(
304 dom_name, &ref.ref_dom[dom_idx].uni_dom_name);
305 rpcstr_pull_unistr2_fstring(
306 name, &t_names.uni_name[i]);
308 slprintf(full_name, sizeof(full_name) - 1,
310 (dom_name[0] && name[0]) ?
311 lp_winbind_separator() : "", name);
313 (*names)[i] = talloc_strdup(mem_ctx, full_name);
314 (*types)[i] = t_names.name[i].sid_name_use;
318 (*types)[i] = SID_NAME_UNKNOWN;
329 /** Lookup a list of names */
331 NTSTATUS cli_lsa_lookup_names(struct cli_state *cli, TALLOC_CTX *mem_ctx,
332 POLICY_HND *pol, int num_names, char **names,
333 DOM_SID **sids, uint32 **types, int *num_sids)
335 prs_struct qbuf, rbuf;
336 LSA_Q_LOOKUP_NAMES q;
337 LSA_R_LOOKUP_NAMES r;
345 /* Initialise parse structures */
347 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
348 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
350 /* Marshall data and send request */
352 init_q_lookup_names(mem_ctx, &q, pol, num_names, names);
354 if (!lsa_io_q_lookup_names("", &q, &qbuf, 0) ||
355 !rpc_api_pipe_req(cli, LSA_LOOKUPNAMES, &qbuf, &rbuf)) {
356 result = NT_STATUS_UNSUCCESSFUL;
360 /* Unmarshall response */
365 if (!lsa_io_r_lookup_names("", &r, &rbuf, 0)) {
366 result = NT_STATUS_UNSUCCESSFUL;
372 if (!NT_STATUS_IS_OK(result)) {
373 /* An actual error occured */
379 /* Return output parameters */
381 if (r.mapped_count == 0) {
382 result = NT_STATUS_NONE_MAPPED;
386 (*num_sids) = r.mapped_count;
387 result = NT_STATUS_OK;
389 if (!((*sids = (DOM_SID *)talloc(mem_ctx, sizeof(DOM_SID) * r.mapped_count)))) {
390 DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
391 result = NT_STATUS_UNSUCCESSFUL;
395 if (!((*types = (uint32 *)talloc(mem_ctx, sizeof(uint32) * r.mapped_count)))) {
396 DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
397 result = NT_STATUS_UNSUCCESSFUL;
401 for (i = 0; i < r.mapped_count; i++) {
402 DOM_RID2 *t_rids = r.dom_rid;
403 uint32 dom_idx = t_rids[i].rid_idx;
404 uint32 dom_rid = t_rids[i].rid;
405 DOM_SID *sid = &(*sids)[i];
407 /* Translate optimised sid through domain index array */
409 if (dom_idx != 0xffffffff) {
411 sid_copy(sid, &ref.ref_dom[dom_idx].ref_dom.sid);
413 if (dom_rid != 0xffffffff) {
414 sid_append_rid(sid, dom_rid);
417 (*types)[i] = t_rids[i].type;
420 (*types)[i] = SID_NAME_UNKNOWN;
431 /** Query info policy */
433 NTSTATUS cli_lsa_query_info_policy(struct cli_state *cli, TALLOC_CTX *mem_ctx,
434 POLICY_HND *pol, uint16 info_class,
435 fstring domain_name, DOM_SID *domain_sid)
437 prs_struct qbuf, rbuf;
445 /* Initialise parse structures */
447 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
448 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
450 /* Marshall data and send request */
452 init_q_query(&q, pol, info_class);
454 if (!lsa_io_q_query("", &q, &qbuf, 0) ||
455 !rpc_api_pipe_req(cli, LSA_QUERYINFOPOLICY, &qbuf, &rbuf)) {
456 result = NT_STATUS_UNSUCCESSFUL;
460 /* Unmarshall response */
462 if (!lsa_io_r_query("", &r, &rbuf, 0)) {
463 result = NT_STATUS_UNSUCCESSFUL;
467 if (!NT_STATUS_IS_OK(result = r.status)) {
471 /* Return output parameters */
473 ZERO_STRUCTP(domain_sid);
474 domain_name[0] = '\0';
476 switch (info_class) {
479 if (r.dom.id3.buffer_dom_name != 0) {
480 unistr2_to_ascii(domain_name,
483 sizeof (fstring) - 1);
486 if (r.dom.id3.buffer_dom_sid != 0) {
487 *domain_sid = r.dom.id3.dom_sid.sid;
494 if (r.dom.id5.buffer_dom_name != 0) {
495 unistr2_to_ascii(domain_name, &r.dom.id5.
497 sizeof (fstring) - 1);
500 if (r.dom.id5.buffer_dom_sid != 0) {
501 *domain_sid = r.dom.id5.dom_sid.sid;
507 DEBUG(3, ("unknown info class %d\n", info_class));
518 /** Enumerate list of trusted domains */
520 NTSTATUS cli_lsa_enum_trust_dom(struct cli_state *cli, TALLOC_CTX *mem_ctx,
521 POLICY_HND *pol, uint32 *enum_ctx,
522 uint32 *num_domains, char ***domain_names,
523 DOM_SID **domain_sids)
525 prs_struct qbuf, rbuf;
526 LSA_Q_ENUM_TRUST_DOM q;
527 LSA_R_ENUM_TRUST_DOM r;
534 /* Initialise parse structures */
536 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
537 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
539 /* Marshall data and send request */
541 init_q_enum_trust_dom(&q, pol, *enum_ctx, 0xffffffff);
543 if (!lsa_io_q_enum_trust_dom("", &q, &qbuf, 0) ||
544 !rpc_api_pipe_req(cli, LSA_ENUMTRUSTDOM, &qbuf, &rbuf)) {
545 result = NT_STATUS_UNSUCCESSFUL;
549 /* Unmarshall response */
551 if (!lsa_io_r_enum_trust_dom("", &r, &rbuf, 0)) {
552 result = NT_STATUS_UNSUCCESSFUL;
558 if (!NT_STATUS_IS_OK(result) &&
559 NT_STATUS_V(result) != NT_STATUS_V(NT_STATUS_NO_MORE_ENTRIES)) {
561 /* An actual error ocured */
566 result = NT_STATUS_OK;
568 /* Return output parameters */
572 /* Allocate memory for trusted domain names and sids */
574 *domain_names = (char **)talloc(mem_ctx, sizeof(char *) *
577 if (!*domain_names) {
578 DEBUG(0, ("cli_lsa_enum_trust_dom(): out of memory\n"));
579 result = NT_STATUS_UNSUCCESSFUL;
583 *domain_sids = (DOM_SID *)talloc(mem_ctx, sizeof(DOM_SID) *
586 DEBUG(0, ("cli_lsa_enum_trust_dom(): out of memory\n"));
587 result = NT_STATUS_UNSUCCESSFUL;
591 /* Copy across names and sids */
593 for (i = 0; i < r.num_domains; i++) {
596 unistr2_to_ascii(tmp, &r.uni_domain_name[i],
598 (*domain_names)[i] = strdup(tmp);
599 sid_copy(&(*domain_sids)[i], &r.domain_sid[i].sid);
603 *num_domains = r.num_domains;
604 *enum_ctx = r.enum_context;
613 /** Enumerate privileges*/
615 NTSTATUS cli_lsa_enum_privilege(struct cli_state *cli, TALLOC_CTX *mem_ctx,
616 POLICY_HND *pol, uint32 *enum_context, uint32 pref_max_length,
617 uint32 *count, char ***privs_name, uint32 **privs_high, uint32 **privs_low)
619 prs_struct qbuf, rbuf;
628 /* Initialise parse structures */
630 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
631 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
633 /* Marshall data and send request */
635 init_q_enum_privs(&q, pol, *enum_context, pref_max_length);
637 if (!lsa_io_q_enum_privs("", &q, &qbuf, 0) ||
638 !rpc_api_pipe_req(cli, LSA_ENUM_PRIVS, &qbuf, &rbuf)) {
639 result = NT_STATUS_UNSUCCESSFUL;
643 /* Unmarshall response */
645 if (!lsa_io_r_enum_privs("", &r, &rbuf, 0)) {
646 result = NT_STATUS_UNSUCCESSFUL;
650 if (!NT_STATUS_IS_OK(result = r.status)) {
654 /* Return output parameters */
656 *enum_context = r.enum_context;
659 if (!((*privs_name = (char **)talloc(mem_ctx, sizeof(char *) * r.count)))) {
660 DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n"));
661 result = NT_STATUS_UNSUCCESSFUL;
665 if (!((*privs_high = (uint32 *)talloc(mem_ctx, sizeof(uint32) * r.count)))) {
666 DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n"));
667 result = NT_STATUS_UNSUCCESSFUL;
671 if (!((*privs_low = (uint32 *)talloc(mem_ctx, sizeof(uint32) * r.count)))) {
672 DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n"));
673 result = NT_STATUS_UNSUCCESSFUL;
677 for (i = 0; i < r.count; i++) {
680 rpcstr_pull_unistr2_fstring( name, &r.privs[i].name);
682 (*privs_name)[i] = talloc_strdup(mem_ctx, name);
684 (*privs_high)[i] = r.privs[i].luid_high;
685 (*privs_low)[i] = r.privs[i].luid_low;
695 /** Get privilege name */
697 NTSTATUS cli_lsa_get_dispname(struct cli_state *cli, TALLOC_CTX *mem_ctx,
698 POLICY_HND *pol, char *name, uint16 lang_id, uint16 lang_id_sys,
699 fstring description, uint16 *lang_id_desc)
701 prs_struct qbuf, rbuf;
702 LSA_Q_PRIV_GET_DISPNAME q;
703 LSA_R_PRIV_GET_DISPNAME r;
709 /* Initialise parse structures */
711 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
712 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
714 /* Marshall data and send request */
716 init_lsa_priv_get_dispname(&q, pol, name, lang_id, lang_id_sys);
718 if (!lsa_io_q_priv_get_dispname("", &q, &qbuf, 0) ||
719 !rpc_api_pipe_req(cli, LSA_PRIV_GET_DISPNAME, &qbuf, &rbuf)) {
720 result = NT_STATUS_UNSUCCESSFUL;
724 /* Unmarshall response */
726 if (!lsa_io_r_priv_get_dispname("", &r, &rbuf, 0)) {
727 result = NT_STATUS_UNSUCCESSFUL;
731 if (!NT_STATUS_IS_OK(result = r.status)) {
735 /* Return output parameters */
737 rpcstr_pull_unistr2_fstring(description , &r.desc);
738 *lang_id_desc = r.lang_id;
747 /** Enumerate list of SIDs */
749 NTSTATUS cli_lsa_enum_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
750 POLICY_HND *pol, uint32 *enum_ctx, uint32 pref_max_length,
751 uint32 *num_sids, DOM_SID **sids)
753 prs_struct qbuf, rbuf;
754 LSA_Q_ENUM_ACCOUNTS q;
755 LSA_R_ENUM_ACCOUNTS r;
762 /* Initialise parse structures */
764 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
765 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
767 /* Marshall data and send request */
769 init_lsa_q_enum_accounts(&q, pol, *enum_ctx, pref_max_length);
771 if (!lsa_io_q_enum_accounts("", &q, &qbuf, 0) ||
772 !rpc_api_pipe_req(cli, LSA_ENUM_ACCOUNTS, &qbuf, &rbuf)) {
773 result = NT_STATUS_UNSUCCESSFUL;
777 /* Unmarshall response */
779 if (!lsa_io_r_enum_accounts("", &r, &rbuf, 0)) {
780 result = NT_STATUS_UNSUCCESSFUL;
786 if (!NT_STATUS_IS_OK(result = r.status)) {
790 if (r.sids.num_entries==0)
793 /* Return output parameters */
795 *sids = (DOM_SID *)talloc(mem_ctx, sizeof(DOM_SID) * r.sids.num_entries);
797 DEBUG(0, ("(cli_lsa_enum_sids): out of memory\n"));
798 result = NT_STATUS_UNSUCCESSFUL;
802 /* Copy across names and sids */
804 for (i = 0; i < r.sids.num_entries; i++) {
805 sid_copy(&(*sids)[i], &r.sids.sid[i].sid);
808 *num_sids= r.sids.num_entries;
809 *enum_ctx = r.enum_context;
818 /** Open a LSA user handle
820 * @param cli Handle on an initialised SMB connection */
822 NTSTATUS cli_lsa_open_account(struct cli_state *cli, TALLOC_CTX *mem_ctx,
823 POLICY_HND *dom_pol, DOM_SID *sid, uint32 des_access,
824 POLICY_HND *user_pol)
826 prs_struct qbuf, rbuf;
834 /* Initialise parse structures */
836 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
837 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
839 /* Initialise input parameters */
841 init_lsa_q_open_account(&q, dom_pol, sid, des_access);
843 /* Marshall data and send request */
845 if (!lsa_io_q_open_account("", &q, &qbuf, 0) ||
846 !rpc_api_pipe_req(cli, LSA_OPENACCOUNT, &qbuf, &rbuf)) {
847 result = NT_STATUS_UNSUCCESSFUL;
851 /* Unmarshall response */
853 if (!lsa_io_r_open_account("", &r, &rbuf, 0)) {
854 result = NT_STATUS_UNSUCCESSFUL;
858 /* Return output parameters */
860 if (NT_STATUS_IS_OK(result = r.status)) {
871 /** Enumerate user privileges
873 * @param cli Handle on an initialised SMB connection */
875 NTSTATUS cli_lsa_enum_privsaccount(struct cli_state *cli, TALLOC_CTX *mem_ctx,
876 POLICY_HND *pol, uint32 *count, LUID_ATTR **set)
878 prs_struct qbuf, rbuf;
879 LSA_Q_ENUMPRIVSACCOUNT q;
880 LSA_R_ENUMPRIVSACCOUNT r;
887 /* Initialise parse structures */
889 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
890 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
892 /* Initialise input parameters */
894 init_lsa_q_enum_privsaccount(&q, pol);
896 /* Marshall data and send request */
898 if (!lsa_io_q_enum_privsaccount("", &q, &qbuf, 0) ||
899 !rpc_api_pipe_req(cli, LSA_ENUMPRIVSACCOUNT, &qbuf, &rbuf)) {
900 result = NT_STATUS_UNSUCCESSFUL;
904 /* Unmarshall response */
906 if (!lsa_io_r_enum_privsaccount("", &r, &rbuf, 0)) {
907 result = NT_STATUS_UNSUCCESSFUL;
911 /* Return output parameters */
913 if (!NT_STATUS_IS_OK(result = r.status)) {
920 if (!((*set = (LUID_ATTR *)talloc(mem_ctx, sizeof(LUID_ATTR) * r.count)))) {
921 DEBUG(0, ("(cli_lsa_enum_privsaccount): out of memory\n"));
922 result = NT_STATUS_UNSUCCESSFUL;
926 for (i=0; i<r.count; i++) {
927 (*set)[i].luid.low = r.set.set[i].luid.low;
928 (*set)[i].luid.high = r.set.set[i].luid.high;
929 (*set)[i].attr = r.set.set[i].attr;
940 /** Get a privilege value given its name */
942 NTSTATUS cli_lsa_lookupprivvalue(struct cli_state *cli, TALLOC_CTX *mem_ctx,
943 POLICY_HND *pol, char *name, LUID *luid)
945 prs_struct qbuf, rbuf;
946 LSA_Q_LOOKUPPRIVVALUE q;
947 LSA_R_LOOKUPPRIVVALUE r;
953 /* Initialise parse structures */
955 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
956 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
958 /* Marshall data and send request */
960 init_lsa_q_lookupprivvalue(&q, pol, name);
962 if (!lsa_io_q_lookupprivvalue("", &q, &qbuf, 0) ||
963 !rpc_api_pipe_req(cli, LSA_LOOKUPPRIVVALUE, &qbuf, &rbuf)) {
964 result = NT_STATUS_UNSUCCESSFUL;
968 /* Unmarshall response */
970 if (!lsa_io_r_lookupprivvalue("", &r, &rbuf, 0)) {
971 result = NT_STATUS_UNSUCCESSFUL;
975 if (!NT_STATUS_IS_OK(result = r.status)) {
979 /* Return output parameters */
981 (*luid).low=r.luid.low;
982 (*luid).high=r.luid.high;