2 Unix SMB/CIFS implementation.
5 Copyright (C) Tim Potter 2000
6 Copyright (C) Rafal Szczesniak 2002
7 Copyright (C) Guenther Deschner 2008
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "rpcclient.h"
25 #include "../libcli/auth/libcli_auth.h"
26 #include "../librpc/gen_ndr/ndr_lsa.h"
27 #include "../librpc/gen_ndr/ndr_lsa_c.h"
28 #include "rpc_client/cli_lsarpc.h"
29 #include "rpc_client/init_lsa.h"
30 #include "../libcli/security/security.h"
32 /* useful function to allow entering a name instead of a SID and
33 * looking it up automatically */
34 static NTSTATUS
name_to_sid(struct rpc_pipe_client
*cli
,
39 struct policy_handle pol
;
40 enum lsa_SidType
*sid_types
;
41 NTSTATUS status
, result
;
43 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
45 /* maybe its a raw SID */
46 if (strncmp(name
, "S-", 2) == 0 &&
47 string_to_sid(sid
, name
)) {
51 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
52 SEC_FLAG_MAXIMUM_ALLOWED
,
54 if (!NT_STATUS_IS_OK(status
))
57 status
= rpccli_lsa_lookup_names(cli
, mem_ctx
, &pol
, 1, &name
, NULL
, 1, &sids
, &sid_types
);
58 if (!NT_STATUS_IS_OK(status
))
61 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
69 static void display_query_info_1(struct lsa_AuditLogInfo
*r
)
71 d_printf("percent_full:\t%d\n", r
->percent_full
);
72 d_printf("maximum_log_size:\t%d\n", r
->maximum_log_size
);
73 d_printf("retention_time:\t%lld\n", (long long)r
->retention_time
);
74 d_printf("shutdown_in_progress:\t%d\n", r
->shutdown_in_progress
);
75 d_printf("time_to_shutdown:\t%lld\n", (long long)r
->time_to_shutdown
);
76 d_printf("next_audit_record:\t%d\n", r
->next_audit_record
);
79 static void display_query_info_2(struct lsa_AuditEventsInfo
*r
)
82 d_printf("Auditing enabled:\t%d\n", r
->auditing_mode
);
83 d_printf("Auditing categories:\t%d\n", r
->count
);
84 d_printf("Auditsettings:\n");
85 for (i
=0; i
<r
->count
; i
++) {
86 const char *val
= audit_policy_str(talloc_tos(), r
->settings
[i
]);
87 const char *policy
= audit_description_str(i
);
88 d_printf("%s:\t%s\n", policy
, val
);
92 static void display_query_info_3(struct lsa_DomainInfo
*r
)
94 struct dom_sid_buf buf
;
95 d_printf("Domain Name: %s\n", r
->name
.string
);
96 d_printf("Domain Sid: %s\n", dom_sid_str_buf(r
->sid
, &buf
));
99 static void display_query_info_5(struct lsa_DomainInfo
*r
)
101 struct dom_sid_buf buf
;
102 d_printf("Domain Name: %s\n", r
->name
.string
);
103 d_printf("Domain Sid: %s\n", dom_sid_str_buf(r
->sid
, &buf
));
106 static void display_query_info_10(struct lsa_AuditFullSetInfo
*r
)
108 d_printf("Shutdown on full: %d\n", r
->shutdown_on_full
);
111 static void display_query_info_11(struct lsa_AuditFullQueryInfo
*r
)
113 d_printf("Shutdown on full: %d\n", r
->shutdown_on_full
);
114 d_printf("Log is full: %d\n", r
->log_is_full
);
117 static void display_query_info_12(struct lsa_DnsDomainInfo
*r
)
119 struct dom_sid_buf buf
;
120 d_printf("Domain NetBios Name: %s\n", r
->name
.string
);
121 d_printf("Domain DNS Name: %s\n", r
->dns_domain
.string
);
122 d_printf("Domain Forest Name: %s\n", r
->dns_forest
.string
);
123 d_printf("Domain Sid: %s\n", dom_sid_str_buf(r
->sid
, &buf
));
124 d_printf("Domain GUID: %s\n", GUID_string(talloc_tos(),
128 static void display_lsa_query_info(union lsa_PolicyInformation
*info
,
129 enum lsa_PolicyInfo level
)
133 display_query_info_1(&info
->audit_log
);
136 display_query_info_2(&info
->audit_events
);
139 display_query_info_3(&info
->domain
);
142 display_query_info_5(&info
->account_domain
);
145 display_query_info_10(&info
->auditfullset
);
148 display_query_info_11(&info
->auditfullquery
);
151 display_query_info_12(&info
->dns
);
154 printf("can't display info level: %d\n", level
);
159 static NTSTATUS
cmd_lsa_query_info_policy(struct rpc_pipe_client
*cli
,
164 struct policy_handle pol
;
165 NTSTATUS status
, result
;
166 union lsa_PolicyInformation
*info
= NULL
;
167 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
169 uint32_t info_class
= 3;
172 printf("Usage: %s [info_class]\n", argv
[0]);
177 info_class
= atoi(argv
[1]);
179 switch (info_class
) {
181 union lsa_revision_info out_revision_info
= {
186 uint32_t out_version
= 0;
188 status
= dcerpc_lsa_open_policy_fallback(
193 SEC_FLAG_MAXIMUM_ALLOWED
,
198 if (any_nt_status_not_ok(status
, result
, &status
)) {
202 status
= dcerpc_lsa_QueryInfoPolicy2(b
, mem_ctx
,
210 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
211 SEC_FLAG_MAXIMUM_ALLOWED
,
214 if (!NT_STATUS_IS_OK(status
))
217 status
= dcerpc_lsa_QueryInfoPolicy(b
, mem_ctx
,
224 if (!NT_STATUS_IS_OK(status
)) {
228 if (NT_STATUS_IS_OK(result
)) {
229 display_lsa_query_info(info
, info_class
);
232 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
238 /* Resolve a list of names to a list of sids */
240 static NTSTATUS
cmd_lsa_lookup_names(struct rpc_pipe_client
*cli
,
245 struct policy_handle pol
;
246 NTSTATUS status
, result
;
247 struct dom_sid
*sids
;
248 enum lsa_SidType
*types
;
250 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
253 printf("Usage: %s [name1 [name2 [...]]]\n", argv
[0]);
257 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
258 LSA_POLICY_LOOKUP_NAMES
,
261 if (!NT_STATUS_IS_OK(status
))
264 status
= rpccli_lsa_lookup_names(cli
, mem_ctx
, &pol
, argc
- 1,
265 (const char**)(argv
+ 1), NULL
, 1, &sids
, &types
);
267 if (!NT_STATUS_IS_OK(status
) && NT_STATUS_V(status
) !=
268 NT_STATUS_V(STATUS_SOME_UNMAPPED
))
271 status
= NT_STATUS_OK
;
275 for (i
= 0; i
< (argc
- 1); i
++) {
276 struct dom_sid_buf sid_str
;
277 printf("%s %s (%s: %d)\n",
279 dom_sid_str_buf(&sids
[i
], &sid_str
),
280 sid_type_lookup(types
[i
]),
284 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
290 /* Resolve a list of names to a list of sids */
292 static NTSTATUS
cmd_lsa_lookup_names_level(struct rpc_pipe_client
*cli
,
297 struct policy_handle pol
;
298 NTSTATUS status
, result
;
299 struct dom_sid
*sids
= NULL
;
300 enum lsa_SidType
*types
= NULL
;
302 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
305 printf("Usage: %s [level] [name1 [name2 [...]]]\n", argv
[0]);
309 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
310 LSA_POLICY_LOOKUP_NAMES
,
312 if (!NT_STATUS_IS_OK(status
)) {
316 level
= atoi(argv
[1]);
318 status
= rpccli_lsa_lookup_names(cli
, mem_ctx
, &pol
, argc
- 2,
319 (const char**)(argv
+ 2), NULL
, level
, &sids
, &types
);
321 if (!NT_STATUS_IS_OK(status
) && NT_STATUS_V(status
) !=
322 NT_STATUS_V(STATUS_SOME_UNMAPPED
))
327 status
= NT_STATUS_OK
;
331 for (i
= 0; i
< (argc
- 2); i
++) {
332 struct dom_sid_buf sid_str
;
333 printf("%s %s (%s: %d)\n",
335 dom_sid_str_buf(&sids
[i
], &sid_str
),
336 sid_type_lookup(types
[i
]),
340 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
346 static NTSTATUS
cmd_lsa_lookup_names4(struct rpc_pipe_client
*cli
,
347 TALLOC_CTX
*mem_ctx
, int argc
,
350 NTSTATUS status
, result
;
353 struct lsa_String
*names
;
354 struct lsa_RefDomainList
*domains
= NULL
;
355 struct lsa_TransSidArray3 sids
;
358 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
361 printf("Usage: %s [name1 [name2 [...]]]\n", argv
[0]);
368 names
= talloc_array(mem_ctx
, struct lsa_String
, num_names
);
369 NT_STATUS_HAVE_NO_MEMORY(names
);
371 for (i
=0; i
< num_names
; i
++) {
372 init_lsa_String(&names
[i
], argv
[i
+1]);
375 status
= dcerpc_lsa_LookupNames4(b
, mem_ctx
,
385 if (!NT_STATUS_IS_OK(status
)) {
388 if (!NT_STATUS_IS_OK(result
)) {
392 if (sids
.count
!= num_names
) {
393 return NT_STATUS_INVALID_NETWORK_RESPONSE
;
396 for (i
= 0; i
< sids
.count
; i
++) {
397 struct dom_sid_buf sid_str
;
398 printf("%s %s (%s: %d)\n",
400 dom_sid_str_buf(sids
.sids
[i
].sid
, &sid_str
),
401 sid_type_lookup(sids
.sids
[i
].sid_type
),
402 sids
.sids
[i
].sid_type
);
408 /* Resolve a list of SIDs to a list of names */
410 static NTSTATUS
cmd_lsa_lookup_sids(struct rpc_pipe_client
*cli
, TALLOC_CTX
*mem_ctx
,
411 int argc
, const char **argv
)
413 struct policy_handle pol
;
414 NTSTATUS status
, result
;
415 struct dom_sid
*sids
;
418 enum lsa_SidType
*types
;
420 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
423 printf("Usage: %s [sid1 [sid2 [...]]]\n", argv
[0]);
427 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
428 LSA_POLICY_LOOKUP_NAMES
,
431 if (!NT_STATUS_IS_OK(status
))
434 /* Convert arguments to sids */
436 sids
= talloc_array(mem_ctx
, struct dom_sid
, argc
- 1);
439 printf("could not allocate memory for %d sids\n", argc
- 1);
443 for (i
= 0; i
< argc
- 1; i
++)
444 if (!string_to_sid(&sids
[i
], argv
[i
+ 1])) {
445 status
= NT_STATUS_INVALID_SID
;
449 /* Lookup the SIDs */
451 status
= rpccli_lsa_lookup_sids(cli
, mem_ctx
, &pol
, argc
- 1, sids
,
452 &domains
, &names
, &types
);
454 if (!NT_STATUS_IS_OK(status
) && NT_STATUS_V(status
) !=
455 NT_STATUS_V(STATUS_SOME_UNMAPPED
))
458 status
= NT_STATUS_OK
;
462 for (i
= 0; i
< (argc
- 1); i
++) {
463 struct dom_sid_buf sid_str
;
465 dom_sid_str_buf(&sids
[i
], &sid_str
);
466 if (types
[i
] == SID_NAME_DOMAIN
) {
467 printf("%s %s (%d)\n", sid_str
.buf
,
468 domains
[i
] ? domains
[i
] : "*unknown*",
471 printf("%s %s\\%s (%d)\n", sid_str
.buf
,
472 domains
[i
] ? domains
[i
] : "*unknown*",
473 names
[i
] ? names
[i
] : "*unknown*",
478 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
484 static NTSTATUS
cmd_lsa_lookup_sids_level(struct rpc_pipe_client
*cli
,
485 TALLOC_CTX
*mem_ctx
, int argc
,
488 struct policy_handle pol
;
489 NTSTATUS status
, result
;
490 struct dom_sid
*sids
= NULL
;
491 char **domains
= NULL
;
493 enum lsa_SidType
*types
= NULL
;
495 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
498 printf("Usage: %s [level] [sid1 [sid2 [...]]]\n", argv
[0]);
502 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
503 LSA_POLICY_LOOKUP_NAMES
,
505 if (!NT_STATUS_IS_OK(status
)) {
509 level
= atoi(argv
[1]);
511 /* Convert arguments to sids */
513 sids
= talloc_array(mem_ctx
, struct dom_sid
, argc
- 2);
515 printf("could not allocate memory for %d sids\n", argc
- 2);
519 for (i
= 0; i
< argc
- 2; i
++) {
520 if (!string_to_sid(&sids
[i
], argv
[i
+ 2])) {
521 status
= NT_STATUS_INVALID_SID
;
526 /* Lookup the SIDs */
528 status
= dcerpc_lsa_lookup_sids_generic(cli
->binding_handle
,
539 if (!NT_STATUS_IS_OK(status
)) {
544 if (!NT_STATUS_IS_OK(status
) && NT_STATUS_V(status
) !=
545 NT_STATUS_V(STATUS_SOME_UNMAPPED
))
550 status
= NT_STATUS_OK
;
554 for (i
= 0; i
< (argc
- 2); i
++) {
555 struct dom_sid_buf sid_str
;
557 dom_sid_str_buf(&sids
[i
], &sid_str
);
558 if (types
[i
] == SID_NAME_DOMAIN
) {
559 printf("%s %s (%d)\n", sid_str
.buf
,
560 domains
[i
] ? domains
[i
] : "*unknown*",
563 printf("%s %s\\%s (%d)\n", sid_str
.buf
,
564 domains
[i
] ? domains
[i
] : "*unknown*",
565 names
[i
] ? names
[i
] : "*unknown*",
570 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
576 /* Resolve a list of SIDs to a list of names */
578 static NTSTATUS
cmd_lsa_lookup_sids3(struct rpc_pipe_client
*cli
,
580 int argc
, const char **argv
)
582 NTSTATUS status
= NT_STATUS_UNSUCCESSFUL
, result
;
584 struct lsa_SidArray sids
;
585 struct lsa_RefDomainList
*domains
= NULL
;
586 struct lsa_TransNameArray2 names
;
588 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
591 printf("Usage: %s [sid1 [sid2 [...]]]\n", argv
[0]);
597 /* Convert arguments to sids */
599 sids
.num_sids
= argc
-1;
600 sids
.sids
= talloc_array(mem_ctx
, struct lsa_SidPtr
, sids
.num_sids
);
602 printf("could not allocate memory for %d sids\n", sids
.num_sids
);
606 for (i
= 0; i
< sids
.num_sids
; i
++) {
607 sids
.sids
[i
].sid
= talloc(sids
.sids
, struct dom_sid
);
608 if (sids
.sids
[i
].sid
== NULL
) {
609 status
= NT_STATUS_NO_MEMORY
;
612 if (!string_to_sid(sids
.sids
[i
].sid
, argv
[i
+1])) {
613 status
= NT_STATUS_INVALID_SID
;
618 /* Lookup the SIDs */
619 status
= dcerpc_lsa_LookupSids3(b
, mem_ctx
,
628 if (!NT_STATUS_IS_OK(status
)) {
631 if (!NT_STATUS_IS_OK(result
) && NT_STATUS_V(result
) !=
632 NT_STATUS_V(STATUS_SOME_UNMAPPED
)) {
637 status
= NT_STATUS_OK
;
641 for (i
= 0; i
< names
.count
; i
++) {
642 struct dom_sid_buf sid_str
;
644 if (i
>= sids
.num_sids
) {
647 printf("%s %s (%d)\n",
648 dom_sid_str_buf(sids
.sids
[i
].sid
, &sid_str
),
649 names
.names
[i
].name
.string
,
650 names
.names
[i
].sid_type
);
658 /* Enumerate list of trusted domains */
660 static NTSTATUS
cmd_lsa_enum_trust_dom(struct rpc_pipe_client
*cli
,
665 struct policy_handle pol
;
666 NTSTATUS status
, result
;
667 struct lsa_DomainList domain_list
;
668 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
670 /* defaults, but may be changed using params */
671 uint32_t enum_ctx
= 0;
673 uint32_t max_size
= (uint32_t)-1;
676 printf("Usage: %s [enum context (0)]\n", argv
[0]);
680 if (argc
== 2 && argv
[1]) {
681 enum_ctx
= atoi(argv
[2]);
684 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
685 LSA_POLICY_VIEW_LOCAL_INFORMATION
,
688 if (!NT_STATUS_IS_OK(status
))
691 status
= STATUS_MORE_ENTRIES
;
693 while (NT_STATUS_EQUAL(status
, STATUS_MORE_ENTRIES
)) {
695 /* Lookup list of trusted domains */
697 status
= dcerpc_lsa_EnumTrustDom(b
, mem_ctx
,
703 if (!NT_STATUS_IS_OK(status
)) {
706 if (!NT_STATUS_IS_OK(result
) &&
707 !NT_STATUS_EQUAL(result
, NT_STATUS_NO_MORE_ENTRIES
) &&
708 !NT_STATUS_EQUAL(result
, STATUS_MORE_ENTRIES
)) {
713 /* Print results: list of names and sids returned in this
715 for (i
= 0; i
< domain_list
.count
; i
++) {
716 struct dom_sid_buf sid_str
;
719 domain_list
.domains
[i
].name
.string
?
720 domain_list
.domains
[i
].name
.string
: "*unknown*",
721 dom_sid_str_buf(domain_list
.domains
[i
].sid
,
726 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
731 /* Enumerates privileges */
733 static NTSTATUS
cmd_lsa_enum_privilege(struct rpc_pipe_client
*cli
,
738 struct policy_handle pol
;
739 NTSTATUS status
, result
;
740 struct lsa_PrivArray priv_array
;
741 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
743 uint32_t enum_context
=0;
744 uint32_t pref_max_length
=0x1000;
748 printf("Usage: %s [enum context] [max length]\n", argv
[0]);
753 enum_context
=atoi(argv
[1]);
756 pref_max_length
=atoi(argv
[2]);
758 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
759 SEC_FLAG_MAXIMUM_ALLOWED
,
762 if (!NT_STATUS_IS_OK(status
))
765 status
= dcerpc_lsa_EnumPrivs(b
, mem_ctx
,
771 if (!NT_STATUS_IS_OK(status
))
773 if (!NT_STATUS_IS_OK(result
)) {
779 printf("found %d privileges\n\n", priv_array
.count
);
781 for (i
= 0; i
< priv_array
.count
; i
++) {
782 printf("%s \t\t%d:%d (0x%x:0x%x)\n",
783 priv_array
.privs
[i
].name
.string
? priv_array
.privs
[i
].name
.string
: "*unknown*",
784 priv_array
.privs
[i
].luid
.high
,
785 priv_array
.privs
[i
].luid
.low
,
786 priv_array
.privs
[i
].luid
.high
,
787 priv_array
.privs
[i
].luid
.low
);
790 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
795 /* Get privilege name */
797 static NTSTATUS
cmd_lsa_get_dispname(struct rpc_pipe_client
*cli
,
802 struct policy_handle pol
;
803 NTSTATUS status
, result
;
804 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
807 uint16_t lang_id_sys
=0;
808 uint16_t lang_id_desc
;
809 struct lsa_String lsa_name
;
810 struct lsa_StringLarge
*description
= NULL
;
813 printf("Usage: %s privilege name\n", argv
[0]);
817 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
818 SEC_FLAG_MAXIMUM_ALLOWED
,
821 if (!NT_STATUS_IS_OK(status
))
824 init_lsa_String(&lsa_name
, argv
[1]);
826 status
= dcerpc_lsa_LookupPrivDisplayName(b
, mem_ctx
,
834 if (!NT_STATUS_IS_OK(status
))
836 if (!NT_STATUS_IS_OK(result
)) {
842 printf("%s -> %s (language: 0x%x)\n", argv
[1], description
->string
, lang_id_desc
);
844 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
849 /* Enumerate the LSA SIDS */
851 static NTSTATUS
cmd_lsa_enum_sids(struct rpc_pipe_client
*cli
,
856 struct policy_handle pol
;
857 NTSTATUS status
, result
;
858 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
860 uint32_t enum_context
=0;
861 uint32_t pref_max_length
=0x1000;
862 struct lsa_SidArray sid_array
;
866 printf("Usage: %s [enum context] [max length]\n", argv
[0]);
871 enum_context
=atoi(argv
[1]);
874 pref_max_length
=atoi(argv
[2]);
876 status
= rpccli_lsa_open_policy(cli
, mem_ctx
, True
,
877 SEC_FLAG_MAXIMUM_ALLOWED
,
880 if (!NT_STATUS_IS_OK(status
))
883 status
= dcerpc_lsa_EnumAccounts(b
, mem_ctx
,
889 if (!NT_STATUS_IS_OK(status
))
891 if (!NT_STATUS_IS_OK(result
)) {
897 printf("found %d SIDs\n\n", sid_array
.num_sids
);
899 for (i
= 0; i
< sid_array
.num_sids
; i
++) {
900 struct dom_sid_buf sid_str
;
903 dom_sid_str_buf(sid_array
.sids
[i
].sid
, &sid_str
));
906 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
911 /* Create a new account */
913 static NTSTATUS
cmd_lsa_create_account(struct rpc_pipe_client
*cli
,
918 struct policy_handle dom_pol
;
919 struct policy_handle user_pol
;
920 NTSTATUS status
, result
;
921 uint32_t des_access
= 0x000f000f;
922 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
923 union lsa_revision_info out_revision_info
= {
928 uint32_t out_version
= 0;
933 printf("Usage: %s SID\n", argv
[0]);
937 status
= name_to_sid(cli
, mem_ctx
, &sid
, argv
[1]);
938 if (!NT_STATUS_IS_OK(status
))
941 status
= dcerpc_lsa_open_policy_fallback(b
,
945 SEC_FLAG_MAXIMUM_ALLOWED
,
950 if (any_nt_status_not_ok(status
, result
, &status
)) {
954 status
= dcerpc_lsa_CreateAccount(b
, mem_ctx
,
960 if (!NT_STATUS_IS_OK(status
))
962 if (!NT_STATUS_IS_OK(result
)) {
967 printf("Account for SID %s successfully created\n\n", argv
[1]);
968 status
= NT_STATUS_OK
;
970 dcerpc_lsa_Close(b
, mem_ctx
, &dom_pol
, &result
);
976 /* Enumerate the privileges of an SID */
978 static NTSTATUS
cmd_lsa_enum_privsaccounts(struct rpc_pipe_client
*cli
,
983 struct policy_handle dom_pol
;
984 struct policy_handle user_pol
;
985 NTSTATUS status
, result
;
986 uint32_t access_desired
= 0x000f000f;
988 struct lsa_PrivilegeSet
*privs
= NULL
;
990 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
991 union lsa_revision_info out_revision_info
= {
996 uint32_t out_version
= 0;
999 printf("Usage: %s SID\n", argv
[0]);
1000 return NT_STATUS_OK
;
1003 status
= name_to_sid(cli
, mem_ctx
, &sid
, argv
[1]);
1004 if (!NT_STATUS_IS_OK(status
))
1007 status
= dcerpc_lsa_open_policy_fallback(b
,
1009 cli
->srv_name_slash
,
1011 SEC_FLAG_MAXIMUM_ALLOWED
,
1016 if (any_nt_status_not_ok(status
, result
, &status
)) {
1020 status
= dcerpc_lsa_OpenAccount(b
, mem_ctx
,
1026 if (!NT_STATUS_IS_OK(status
))
1028 if (!NT_STATUS_IS_OK(result
)) {
1033 status
= dcerpc_lsa_EnumPrivsAccount(b
, mem_ctx
,
1037 if (!NT_STATUS_IS_OK(status
))
1039 if (!NT_STATUS_IS_OK(result
)) {
1045 printf("found %d privileges for SID %s\n\n", privs
->count
, argv
[1]);
1046 printf("high\tlow\tattribute\n");
1048 for (i
= 0; i
< privs
->count
; i
++) {
1049 printf("%u\t%u\t%u\n",
1050 privs
->set
[i
].luid
.high
,
1051 privs
->set
[i
].luid
.low
,
1052 privs
->set
[i
].attribute
);
1055 dcerpc_lsa_Close(b
, mem_ctx
, &dom_pol
, &result
);
1061 /* Enumerate the privileges of an SID via LsaEnumerateAccountRights */
1063 static NTSTATUS
cmd_lsa_enum_acct_rights(struct rpc_pipe_client
*cli
,
1064 TALLOC_CTX
*mem_ctx
,
1068 struct policy_handle dom_pol
;
1069 NTSTATUS status
, result
;
1071 struct dom_sid_buf buf
;
1072 struct lsa_RightSet rights
;
1073 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1074 union lsa_revision_info out_revision_info
= {
1079 uint32_t out_version
= 0;
1084 printf("Usage: %s SID\n", argv
[0]);
1085 return NT_STATUS_OK
;
1088 status
= name_to_sid(cli
, mem_ctx
, &sid
, argv
[1]);
1089 if (!NT_STATUS_IS_OK(status
))
1092 status
= dcerpc_lsa_open_policy_fallback(b
,
1094 cli
->srv_name_slash
,
1096 SEC_FLAG_MAXIMUM_ALLOWED
,
1101 if (any_nt_status_not_ok(status
, result
, &status
)) {
1105 status
= dcerpc_lsa_EnumAccountRights(b
, mem_ctx
,
1110 if (!NT_STATUS_IS_OK(status
))
1112 if (!NT_STATUS_IS_OK(result
)) {
1117 printf("found %d privileges for SID %s\n", rights
.count
,
1118 dom_sid_str_buf(&sid
, &buf
));
1120 for (i
= 0; i
< rights
.count
; i
++) {
1121 printf("\t%s\n", rights
.names
[i
].string
);
1124 dcerpc_lsa_Close(b
, mem_ctx
, &dom_pol
, &result
);
1130 /* add some privileges to a SID via LsaAddAccountRights */
1132 static NTSTATUS
cmd_lsa_add_acct_rights(struct rpc_pipe_client
*cli
,
1133 TALLOC_CTX
*mem_ctx
,
1137 struct policy_handle dom_pol
;
1138 NTSTATUS status
, result
;
1139 struct lsa_RightSet rights
;
1142 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1143 union lsa_revision_info out_revision_info
= {
1148 uint32_t out_version
= 0;
1151 printf("Usage: %s SID [rights...]\n", argv
[0]);
1152 return NT_STATUS_OK
;
1155 status
= name_to_sid(cli
, mem_ctx
, &sid
, argv
[1]);
1156 if (!NT_STATUS_IS_OK(status
))
1159 status
= dcerpc_lsa_open_policy_fallback(b
,
1161 cli
->srv_name_slash
,
1163 SEC_FLAG_MAXIMUM_ALLOWED
,
1168 if (any_nt_status_not_ok(status
, result
, &status
)) {
1172 rights
.count
= argc
-2;
1173 rights
.names
= talloc_array(mem_ctx
, struct lsa_StringLarge
,
1175 if (!rights
.names
) {
1176 return NT_STATUS_NO_MEMORY
;
1179 for (i
=0; i
<argc
-2; i
++) {
1180 init_lsa_StringLarge(&rights
.names
[i
], argv
[i
+2]);
1183 status
= dcerpc_lsa_AddAccountRights(b
, mem_ctx
,
1188 if (!NT_STATUS_IS_OK(status
))
1190 if (!NT_STATUS_IS_OK(result
)) {
1195 dcerpc_lsa_Close(b
, mem_ctx
, &dom_pol
, &result
);
1201 /* remove some privileges to a SID via LsaRemoveAccountRights */
1203 static NTSTATUS
cmd_lsa_remove_acct_rights(struct rpc_pipe_client
*cli
,
1204 TALLOC_CTX
*mem_ctx
,
1208 struct policy_handle dom_pol
;
1209 NTSTATUS status
, result
;
1210 struct lsa_RightSet rights
;
1213 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1214 union lsa_revision_info out_revision_info
= {
1219 uint32_t out_version
= 0;
1222 printf("Usage: %s SID [rights...]\n", argv
[0]);
1223 return NT_STATUS_OK
;
1226 status
= name_to_sid(cli
, mem_ctx
, &sid
, argv
[1]);
1227 if (!NT_STATUS_IS_OK(status
))
1230 status
= dcerpc_lsa_open_policy_fallback(b
,
1232 cli
->srv_name_slash
,
1234 SEC_FLAG_MAXIMUM_ALLOWED
,
1239 if (any_nt_status_not_ok(status
, result
, &status
)) {
1243 rights
.count
= argc
-2;
1244 rights
.names
= talloc_array(mem_ctx
, struct lsa_StringLarge
,
1246 if (!rights
.names
) {
1247 return NT_STATUS_NO_MEMORY
;
1250 for (i
=0; i
<argc
-2; i
++) {
1251 init_lsa_StringLarge(&rights
.names
[i
], argv
[i
+2]);
1254 status
= dcerpc_lsa_RemoveAccountRights(b
, mem_ctx
,
1260 if (!NT_STATUS_IS_OK(status
))
1262 if (!NT_STATUS_IS_OK(result
)) {
1267 dcerpc_lsa_Close(b
, mem_ctx
, &dom_pol
, &result
);
1274 /* Get a privilege value given its name */
1276 static NTSTATUS
cmd_lsa_lookup_priv_value(struct rpc_pipe_client
*cli
,
1277 TALLOC_CTX
*mem_ctx
,
1281 struct policy_handle pol
;
1282 NTSTATUS status
, result
;
1283 struct lsa_LUID luid
;
1284 struct lsa_String name
;
1285 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1286 union lsa_revision_info out_revision_info
= {
1291 uint32_t out_version
= 0;
1294 printf("Usage: %s name\n", argv
[0]);
1295 return NT_STATUS_OK
;
1298 status
= dcerpc_lsa_open_policy_fallback(b
,
1300 cli
->srv_name_slash
,
1302 SEC_FLAG_MAXIMUM_ALLOWED
,
1307 if (any_nt_status_not_ok(status
, result
, &status
)) {
1311 init_lsa_String(&name
, argv
[1]);
1313 status
= dcerpc_lsa_LookupPrivValue(b
, mem_ctx
,
1318 if (!NT_STATUS_IS_OK(status
))
1320 if (!NT_STATUS_IS_OK(result
)) {
1327 printf("%u:%u (0x%x:0x%x)\n", luid
.high
, luid
.low
, luid
.high
, luid
.low
);
1329 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
1334 /* Query LSA security object */
1336 static NTSTATUS
cmd_lsa_query_secobj(struct rpc_pipe_client
*cli
,
1337 TALLOC_CTX
*mem_ctx
,
1341 struct policy_handle pol
;
1342 NTSTATUS status
, result
;
1343 struct sec_desc_buf
*sdb
;
1344 uint32_t sec_info
= SECINFO_DACL
;
1345 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1346 union lsa_revision_info out_revision_info
= {
1351 uint32_t out_version
= 0;
1353 if (argc
< 1 || argc
> 2) {
1354 printf("Usage: %s [sec_info]\n", argv
[0]);
1355 return NT_STATUS_OK
;
1359 sscanf(argv
[1], "%x", &sec_info
);
1361 status
= dcerpc_lsa_open_policy_fallback(b
,
1363 cli
->srv_name_slash
,
1365 SEC_FLAG_MAXIMUM_ALLOWED
,
1370 if (any_nt_status_not_ok(status
, result
, &status
)) {
1374 status
= dcerpc_lsa_QuerySecurity(b
, mem_ctx
,
1379 if (!NT_STATUS_IS_OK(status
))
1381 if (!NT_STATUS_IS_OK(result
)) {
1388 display_sec_desc(sdb
->sd
);
1390 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
1395 static void display_trust_dom_info_4(struct lsa_TrustDomainInfoPassword
*p
,
1396 DATA_BLOB session_key
)
1398 char *pwd
, *pwd_old
;
1400 DATA_BLOB data
= data_blob_const(p
->password
->data
, p
->password
->length
);
1401 DATA_BLOB data_old
= data_blob_const(p
->old_password
->data
, p
->old_password
->length
);
1403 pwd
= sess_decrypt_string(talloc_tos(), &data
, &session_key
);
1404 pwd_old
= sess_decrypt_string(talloc_tos(), &data_old
, &session_key
);
1406 d_printf("Password:\t%s\n", pwd
);
1407 d_printf("Old Password:\t%s\n", pwd_old
);
1410 talloc_free(pwd_old
);
1413 static void display_trust_dom_info(TALLOC_CTX
*mem_ctx
,
1414 union lsa_TrustedDomainInfo
*info
,
1415 enum lsa_TrustDomInfoEnum info_class
,
1416 DATA_BLOB session_key
)
1418 switch (info_class
) {
1419 case LSA_TRUSTED_DOMAIN_INFO_PASSWORD
:
1420 display_trust_dom_info_4(&info
->password
, session_key
);
1423 const char *str
= NULL
;
1424 str
= NDR_PRINT_UNION_STRING(mem_ctx
,
1425 lsa_TrustedDomainInfo
,
1428 d_printf("%s\n", str
);
1435 static NTSTATUS
cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client
*cli
,
1436 TALLOC_CTX
*mem_ctx
,
1440 struct policy_handle pol
;
1441 NTSTATUS status
, result
;
1442 struct dom_sid dom_sid
;
1443 uint32_t access_mask
= SEC_FLAG_MAXIMUM_ALLOWED
;
1444 union lsa_TrustedDomainInfo
*info
= NULL
;
1445 enum lsa_TrustDomInfoEnum info_class
= 1;
1446 DATA_BLOB session_key
;
1447 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1448 union lsa_revision_info out_revision_info
= {
1453 uint32_t out_version
= 0;
1455 if (argc
> 3 || argc
< 2) {
1456 printf("Usage: %s [sid] [info_class]\n", argv
[0]);
1457 return NT_STATUS_OK
;
1460 if (!string_to_sid(&dom_sid
, argv
[1]))
1461 return NT_STATUS_NO_MEMORY
;
1464 info_class
= atoi(argv
[2]);
1466 status
= dcerpc_lsa_open_policy_fallback(b
,
1468 cli
->srv_name_slash
,
1475 if (any_nt_status_not_ok(status
, result
, &status
)) {
1479 status
= dcerpc_lsa_QueryTrustedDomainInfoBySid(b
, mem_ctx
,
1485 if (!NT_STATUS_IS_OK(status
))
1487 if (!NT_STATUS_IS_OK(result
)) {
1492 status
= cli_get_session_key(mem_ctx
, cli
, &session_key
);
1493 if (!NT_STATUS_IS_OK(status
)) {
1494 DEBUG(0, ("Could not retrieve session key: %s\n", nt_errstr(status
)));
1498 display_trust_dom_info(mem_ctx
, info
, info_class
, session_key
);
1501 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
1506 static NTSTATUS
cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client
*cli
,
1507 TALLOC_CTX
*mem_ctx
,
1511 struct policy_handle pol
;
1512 NTSTATUS status
, result
;
1513 uint32_t access_mask
= SEC_FLAG_MAXIMUM_ALLOWED
;
1514 union lsa_TrustedDomainInfo
*info
= NULL
;
1515 enum lsa_TrustDomInfoEnum info_class
= 1;
1516 struct lsa_String trusted_domain
;
1517 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1518 DATA_BLOB session_key
;
1519 union lsa_revision_info out_revision_info
= {
1524 uint32_t out_version
= 0;
1526 if (argc
> 3 || argc
< 2) {
1527 printf("Usage: %s [name] [info_class]\n", argv
[0]);
1528 return NT_STATUS_OK
;
1532 info_class
= atoi(argv
[2]);
1534 status
= dcerpc_lsa_open_policy_fallback(b
,
1536 cli
->srv_name_slash
,
1543 if (any_nt_status_not_ok(status
, result
, &status
)) {
1547 init_lsa_String(&trusted_domain
, argv
[1]);
1549 status
= dcerpc_lsa_QueryTrustedDomainInfoByName(b
, mem_ctx
,
1555 if (!NT_STATUS_IS_OK(status
))
1557 if (!NT_STATUS_IS_OK(result
)) {
1562 status
= cli_get_session_key(mem_ctx
, cli
, &session_key
);
1563 if (!NT_STATUS_IS_OK(status
)) {
1564 DEBUG(0, ("Could not retrieve session key: %s\n", nt_errstr(status
)));
1568 display_trust_dom_info(mem_ctx
, info
, info_class
, session_key
);
1571 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
1576 static NTSTATUS
cmd_lsa_set_trustdominfo(struct rpc_pipe_client
*cli
,
1577 TALLOC_CTX
*mem_ctx
, int argc
,
1580 struct policy_handle pol
, trustdom_pol
;
1581 NTSTATUS status
, result
;
1582 uint32_t access_mask
= SEC_FLAG_MAXIMUM_ALLOWED
;
1583 union lsa_TrustedDomainInfo info
;
1584 struct dom_sid dom_sid
;
1585 enum lsa_TrustDomInfoEnum info_class
= 1;
1586 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1587 union lsa_revision_info out_revision_info
= {
1592 uint32_t out_version
= 0;
1594 if (argc
> 4 || argc
< 3) {
1595 printf("Usage: %s [sid] [info_class] [value]\n", argv
[0]);
1596 return NT_STATUS_OK
;
1599 if (!string_to_sid(&dom_sid
, argv
[1])) {
1600 return NT_STATUS_NO_MEMORY
;
1604 info_class
= atoi(argv
[2]);
1606 switch (info_class
) {
1607 case 13: /* LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES */
1608 info
.enc_types
.enc_types
= atoi(argv
[3]);
1611 return NT_STATUS_INVALID_PARAMETER
;
1614 status
= dcerpc_lsa_open_policy_fallback(b
,
1616 cli
->srv_name_slash
,
1623 if (any_nt_status_not_ok(status
, result
, &status
)) {
1627 status
= dcerpc_lsa_OpenTrustedDomain(b
, mem_ctx
,
1633 if (!NT_STATUS_IS_OK(status
)) {
1636 if (!NT_STATUS_IS_OK(result
)) {
1641 status
= dcerpc_lsa_SetInformationTrustedDomain(b
, mem_ctx
,
1646 if (!NT_STATUS_IS_OK(status
)) {
1649 if (!NT_STATUS_IS_OK(result
)) {
1654 dcerpc_lsa_Close(b
, mem_ctx
, &trustdom_pol
, &result
);
1655 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
1660 static NTSTATUS
cmd_lsa_query_trustdominfo(struct rpc_pipe_client
*cli
,
1661 TALLOC_CTX
*mem_ctx
,
1665 struct policy_handle pol
, trustdom_pol
;
1666 NTSTATUS status
, result
;
1667 uint32_t access_mask
= SEC_FLAG_MAXIMUM_ALLOWED
;
1668 union lsa_TrustedDomainInfo
*info
= NULL
;
1669 struct dom_sid dom_sid
;
1670 enum lsa_TrustDomInfoEnum info_class
= 1;
1671 DATA_BLOB session_key
;
1672 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1673 union lsa_revision_info out_revision_info
= {
1678 uint32_t out_version
= 0;
1680 if (argc
> 3 || argc
< 2) {
1681 printf("Usage: %s [sid] [info_class]\n", argv
[0]);
1682 return NT_STATUS_OK
;
1685 if (!string_to_sid(&dom_sid
, argv
[1]))
1686 return NT_STATUS_NO_MEMORY
;
1690 info_class
= atoi(argv
[2]);
1692 status
= dcerpc_lsa_open_policy_fallback(b
,
1694 cli
->srv_name_slash
,
1701 if (any_nt_status_not_ok(status
, result
, &status
)) {
1705 status
= dcerpc_lsa_OpenTrustedDomain(b
, mem_ctx
,
1711 if (!NT_STATUS_IS_OK(status
))
1713 if (!NT_STATUS_IS_OK(result
)) {
1718 status
= dcerpc_lsa_QueryTrustedDomainInfo(b
, mem_ctx
,
1723 if (!NT_STATUS_IS_OK(status
))
1725 if (!NT_STATUS_IS_OK(result
)) {
1730 status
= cli_get_session_key(mem_ctx
, cli
, &session_key
);
1731 if (!NT_STATUS_IS_OK(status
)) {
1732 DEBUG(0, ("Could not retrieve session key: %s\n", nt_errstr(status
)));
1736 display_trust_dom_info(mem_ctx
, info
, info_class
, session_key
);
1739 dcerpc_lsa_Close(b
, mem_ctx
, &pol
, &result
);
1744 static NTSTATUS
cmd_lsa_get_username(struct rpc_pipe_client
*cli
,
1745 TALLOC_CTX
*mem_ctx
, int argc
,
1748 NTSTATUS status
, result
;
1749 const char *servername
= cli
->desthost
;
1750 struct lsa_String
*account_name
= NULL
;
1751 struct lsa_String
*authority_name
= NULL
;
1752 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1755 printf("Usage: %s servername\n", argv
[0]);
1756 return NT_STATUS_OK
;
1759 status
= dcerpc_lsa_GetUserName(b
, mem_ctx
,
1764 if (!NT_STATUS_IS_OK(status
)) {
1767 if (!NT_STATUS_IS_OK(result
)) {
1774 printf("Account Name: %s, Authority Name: %s\n",
1775 account_name
->string
, authority_name
? authority_name
->string
:
1782 static NTSTATUS
cmd_lsa_add_priv(struct rpc_pipe_client
*cli
,
1783 TALLOC_CTX
*mem_ctx
, int argc
,
1786 struct policy_handle dom_pol
, user_pol
;
1787 NTSTATUS status
, result
;
1788 struct lsa_PrivilegeSet privs
;
1789 struct lsa_LUIDAttribute
*set
= NULL
;
1792 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1793 union lsa_revision_info out_revision_info
= {
1798 uint32_t out_version
= 0;
1803 printf("Usage: %s SID [rights...]\n", argv
[0]);
1804 return NT_STATUS_OK
;
1807 status
= name_to_sid(cli
, mem_ctx
, &sid
, argv
[1]);
1808 if (!NT_STATUS_IS_OK(status
)) {
1812 status
= dcerpc_lsa_open_policy_fallback(b
,
1814 cli
->srv_name_slash
,
1816 SEC_FLAG_MAXIMUM_ALLOWED
,
1821 if (any_nt_status_not_ok(status
, result
, &status
)) {
1825 status
= dcerpc_lsa_OpenAccount(b
, mem_ctx
,
1828 SEC_FLAG_MAXIMUM_ALLOWED
,
1831 if (!NT_STATUS_IS_OK(status
)) {
1834 if (!NT_STATUS_IS_OK(result
)) {
1839 for (i
=2; i
<argc
; i
++) {
1841 struct lsa_String priv_name
;
1842 struct lsa_LUID luid
;
1844 init_lsa_String(&priv_name
, argv
[i
]);
1846 status
= dcerpc_lsa_LookupPrivValue(b
, mem_ctx
,
1851 if (!NT_STATUS_IS_OK(status
)) {
1854 if (!NT_STATUS_IS_OK(result
)) {
1860 set
= talloc_realloc(mem_ctx
, set
,
1861 struct lsa_LUIDAttribute
,
1864 return NT_STATUS_NO_MEMORY
;
1867 set
[privs
.count
-1].luid
= luid
;
1868 set
[privs
.count
-1].attribute
= 0;
1873 status
= dcerpc_lsa_AddPrivilegesToAccount(b
, mem_ctx
,
1877 if (!NT_STATUS_IS_OK(status
)) {
1880 if (!NT_STATUS_IS_OK(result
)) {
1885 dcerpc_lsa_Close(b
, mem_ctx
, &user_pol
, &result
);
1886 dcerpc_lsa_Close(b
, mem_ctx
, &dom_pol
, &result
);
1891 static NTSTATUS
cmd_lsa_del_priv(struct rpc_pipe_client
*cli
,
1892 TALLOC_CTX
*mem_ctx
, int argc
,
1895 struct policy_handle dom_pol
, user_pol
;
1896 NTSTATUS status
, result
;
1897 struct lsa_PrivilegeSet privs
;
1898 struct lsa_LUIDAttribute
*set
= NULL
;
1901 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
1902 union lsa_revision_info out_revision_info
= {
1907 uint32_t out_version
= 0;
1912 printf("Usage: %s SID [rights...]\n", argv
[0]);
1913 return NT_STATUS_OK
;
1916 status
= name_to_sid(cli
, mem_ctx
, &sid
, argv
[1]);
1917 if (!NT_STATUS_IS_OK(status
)) {
1921 status
= dcerpc_lsa_open_policy_fallback(b
,
1923 cli
->srv_name_slash
,
1925 SEC_FLAG_MAXIMUM_ALLOWED
,
1930 if (any_nt_status_not_ok(status
, result
, &status
)) {
1934 status
= dcerpc_lsa_OpenAccount(b
, mem_ctx
,
1937 SEC_FLAG_MAXIMUM_ALLOWED
,
1940 if (!NT_STATUS_IS_OK(status
)) {
1943 if (!NT_STATUS_IS_OK(result
)) {
1948 for (i
=2; i
<argc
; i
++) {
1950 struct lsa_String priv_name
;
1951 struct lsa_LUID luid
;
1953 init_lsa_String(&priv_name
, argv
[i
]);
1955 status
= dcerpc_lsa_LookupPrivValue(b
, mem_ctx
,
1960 if (!NT_STATUS_IS_OK(status
)) {
1963 if (!NT_STATUS_IS_OK(result
)) {
1969 set
= talloc_realloc(mem_ctx
, set
,
1970 struct lsa_LUIDAttribute
,
1973 return NT_STATUS_NO_MEMORY
;
1976 set
[privs
.count
-1].luid
= luid
;
1977 set
[privs
.count
-1].attribute
= 0;
1983 status
= dcerpc_lsa_RemovePrivilegesFromAccount(b
, mem_ctx
,
1988 if (!NT_STATUS_IS_OK(status
)) {
1991 if (!NT_STATUS_IS_OK(result
)) {
1996 dcerpc_lsa_Close(b
, mem_ctx
, &user_pol
, &result
);
1997 dcerpc_lsa_Close(b
, mem_ctx
, &dom_pol
, &result
);
2002 static NTSTATUS
cmd_lsa_create_secret(struct rpc_pipe_client
*cli
,
2003 TALLOC_CTX
*mem_ctx
, int argc
,
2006 NTSTATUS status
, result
;
2007 struct policy_handle handle
, sec_handle
;
2008 struct lsa_String name
;
2009 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
2010 union lsa_revision_info out_revision_info
= {
2015 uint32_t out_version
= 0;
2018 printf("Usage: %s name\n", argv
[0]);
2019 return NT_STATUS_OK
;
2022 status
= dcerpc_lsa_open_policy_fallback(b
,
2024 cli
->srv_name_slash
,
2026 SEC_FLAG_MAXIMUM_ALLOWED
,
2031 if (any_nt_status_not_ok(status
, result
, &status
)) {
2035 init_lsa_String(&name
, argv
[1]);
2037 status
= dcerpc_lsa_CreateSecret(b
, mem_ctx
,
2040 SEC_FLAG_MAXIMUM_ALLOWED
,
2043 if (!NT_STATUS_IS_OK(status
)) {
2046 if (!NT_STATUS_IS_OK(result
)) {
2052 if (is_valid_policy_hnd(&sec_handle
)) {
2053 dcerpc_lsa_Close(b
, mem_ctx
, &sec_handle
, &result
);
2055 if (is_valid_policy_hnd(&handle
)) {
2056 dcerpc_lsa_Close(b
, mem_ctx
, &handle
, &result
);
2062 static NTSTATUS
cmd_lsa_delete_secret(struct rpc_pipe_client
*cli
,
2063 TALLOC_CTX
*mem_ctx
, int argc
,
2066 NTSTATUS status
, result
;
2067 struct policy_handle handle
, sec_handle
;
2068 struct lsa_String name
;
2069 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
2070 union lsa_revision_info out_revision_info
= {
2075 uint32_t out_version
= 0;
2078 printf("Usage: %s name\n", argv
[0]);
2079 return NT_STATUS_OK
;
2082 status
= dcerpc_lsa_open_policy_fallback(b
,
2084 cli
->srv_name_slash
,
2086 SEC_FLAG_MAXIMUM_ALLOWED
,
2091 if (any_nt_status_not_ok(status
, result
, &status
)) {
2095 init_lsa_String(&name
, argv
[1]);
2097 status
= dcerpc_lsa_OpenSecret(b
, mem_ctx
,
2100 SEC_FLAG_MAXIMUM_ALLOWED
,
2103 if (!NT_STATUS_IS_OK(status
)) {
2106 if (!NT_STATUS_IS_OK(result
)) {
2111 status
= dcerpc_lsa_DeleteObject(b
, mem_ctx
,
2114 if (!NT_STATUS_IS_OK(status
)) {
2117 if (!NT_STATUS_IS_OK(result
)) {
2123 if (is_valid_policy_hnd(&sec_handle
)) {
2124 dcerpc_lsa_Close(b
, mem_ctx
, &sec_handle
, &result
);
2126 if (is_valid_policy_hnd(&handle
)) {
2127 dcerpc_lsa_Close(b
, mem_ctx
, &handle
, &result
);
2133 static NTSTATUS
cmd_lsa_query_secret(struct rpc_pipe_client
*cli
,
2134 TALLOC_CTX
*mem_ctx
, int argc
,
2137 NTSTATUS status
, result
;
2138 struct policy_handle handle
, sec_handle
;
2139 struct lsa_String name
;
2140 struct lsa_DATA_BUF_PTR new_val
;
2141 NTTIME new_mtime
= 0;
2142 struct lsa_DATA_BUF_PTR old_val
;
2143 NTTIME old_mtime
= 0;
2144 DATA_BLOB session_key
;
2145 DATA_BLOB new_blob
= data_blob_null
;
2146 DATA_BLOB old_blob
= data_blob_null
;
2147 char *new_secret
, *old_secret
;
2148 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
2149 union lsa_revision_info out_revision_info
= {
2154 uint32_t out_version
= 0;
2157 printf("Usage: %s name\n", argv
[0]);
2158 return NT_STATUS_OK
;
2161 status
= dcerpc_lsa_open_policy_fallback(b
,
2163 cli
->srv_name_slash
,
2165 SEC_FLAG_MAXIMUM_ALLOWED
,
2170 if (any_nt_status_not_ok(status
, result
, &status
)) {
2174 init_lsa_String(&name
, argv
[1]);
2176 status
= dcerpc_lsa_OpenSecret(b
, mem_ctx
,
2179 SEC_FLAG_MAXIMUM_ALLOWED
,
2182 if (!NT_STATUS_IS_OK(status
)) {
2185 if (!NT_STATUS_IS_OK(result
)) {
2190 ZERO_STRUCT(new_val
);
2191 ZERO_STRUCT(old_val
);
2193 status
= dcerpc_lsa_QuerySecret(b
, mem_ctx
,
2200 if (!NT_STATUS_IS_OK(status
)) {
2203 if (!NT_STATUS_IS_OK(result
)) {
2208 status
= cli_get_session_key(mem_ctx
, cli
, &session_key
);
2209 if (!NT_STATUS_IS_OK(status
)) {
2214 new_blob
= data_blob_const(new_val
.buf
->data
, new_val
.buf
->length
);
2217 old_blob
= data_blob_const(old_val
.buf
->data
, old_val
.buf
->length
);
2220 new_secret
= sess_decrypt_string(mem_ctx
, &new_blob
, &session_key
);
2221 old_secret
= sess_decrypt_string(mem_ctx
, &old_blob
, &session_key
);
2223 d_printf("new secret: %s\n", new_secret
);
2226 d_printf("old secret: %s\n", old_secret
);
2230 if (is_valid_policy_hnd(&sec_handle
)) {
2231 dcerpc_lsa_Close(b
, mem_ctx
, &sec_handle
, &result
);
2233 if (is_valid_policy_hnd(&handle
)) {
2234 dcerpc_lsa_Close(b
, mem_ctx
, &handle
, &result
);
2240 static NTSTATUS
cmd_lsa_set_secret(struct rpc_pipe_client
*cli
,
2241 TALLOC_CTX
*mem_ctx
, int argc
,
2244 NTSTATUS status
, result
;
2245 struct policy_handle handle
, sec_handle
;
2246 struct lsa_String name
;
2247 struct lsa_DATA_BUF new_val
;
2248 struct lsa_DATA_BUF old_val
;
2250 DATA_BLOB session_key
;
2251 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
2252 union lsa_revision_info out_revision_info
= {
2257 uint32_t out_version
= 0;
2260 printf("Usage: %s name secret\n", argv
[0]);
2261 return NT_STATUS_OK
;
2264 status
= dcerpc_lsa_open_policy_fallback(b
,
2266 cli
->srv_name_slash
,
2268 SEC_FLAG_MAXIMUM_ALLOWED
,
2273 if (any_nt_status_not_ok(status
, result
, &status
)) {
2277 init_lsa_String(&name
, argv
[1]);
2279 status
= dcerpc_lsa_OpenSecret(b
, mem_ctx
,
2282 SEC_FLAG_MAXIMUM_ALLOWED
,
2285 if (!NT_STATUS_IS_OK(status
)) {
2288 if (!NT_STATUS_IS_OK(result
)) {
2293 ZERO_STRUCT(new_val
);
2294 ZERO_STRUCT(old_val
);
2296 status
= cli_get_session_key(mem_ctx
, cli
, &session_key
);
2297 if (!NT_STATUS_IS_OK(status
)) {
2301 enc_key
= sess_encrypt_string(argv
[2], &session_key
);
2303 new_val
.length
= enc_key
.length
;
2304 new_val
.size
= enc_key
.length
;
2305 new_val
.data
= enc_key
.data
;
2307 status
= dcerpc_lsa_SetSecret(b
, mem_ctx
,
2312 if (!NT_STATUS_IS_OK(status
)) {
2315 if (!NT_STATUS_IS_OK(result
)) {
2321 if (is_valid_policy_hnd(&sec_handle
)) {
2322 dcerpc_lsa_Close(b
, mem_ctx
, &sec_handle
, &result
);
2324 if (is_valid_policy_hnd(&handle
)) {
2325 dcerpc_lsa_Close(b
, mem_ctx
, &handle
, &result
);
2331 static NTSTATUS
cmd_lsa_retrieve_private_data(struct rpc_pipe_client
*cli
,
2332 TALLOC_CTX
*mem_ctx
, int argc
,
2335 NTSTATUS status
, result
;
2336 struct policy_handle handle
;
2337 struct lsa_String name
;
2338 struct lsa_DATA_BUF
*val
;
2339 DATA_BLOB session_key
;
2340 DATA_BLOB blob
= data_blob_null
;
2342 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
2343 union lsa_revision_info out_revision_info
= {
2348 uint32_t out_version
= 0;
2351 printf("Usage: %s name\n", argv
[0]);
2352 return NT_STATUS_OK
;
2355 status
= dcerpc_lsa_open_policy_fallback(b
,
2357 cli
->srv_name_slash
,
2359 SEC_FLAG_MAXIMUM_ALLOWED
,
2364 if (any_nt_status_not_ok(status
, result
, &status
)) {
2368 init_lsa_String(&name
, argv
[1]);
2372 status
= dcerpc_lsa_RetrievePrivateData(b
, mem_ctx
,
2377 if (!NT_STATUS_IS_OK(status
)) {
2380 if (!NT_STATUS_IS_OK(result
)) {
2385 status
= cli_get_session_key(mem_ctx
, cli
, &session_key
);
2386 if (!NT_STATUS_IS_OK(status
)) {
2391 blob
= data_blob_const(val
->data
, val
->length
);
2394 secret
= sess_decrypt_string(mem_ctx
, &blob
, &session_key
);
2396 d_printf("secret: %s\n", secret
);
2400 if (is_valid_policy_hnd(&handle
)) {
2401 dcerpc_lsa_Close(b
, mem_ctx
, &handle
, &result
);
2407 static NTSTATUS
cmd_lsa_store_private_data(struct rpc_pipe_client
*cli
,
2408 TALLOC_CTX
*mem_ctx
, int argc
,
2411 NTSTATUS status
, result
;
2412 struct policy_handle handle
;
2413 struct lsa_String name
;
2414 struct lsa_DATA_BUF val
;
2415 DATA_BLOB session_key
;
2417 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
2418 union lsa_revision_info out_revision_info
= {
2423 uint32_t out_version
= 0;
2426 printf("Usage: %s name secret\n", argv
[0]);
2427 return NT_STATUS_OK
;
2430 status
= dcerpc_lsa_open_policy_fallback(b
,
2432 cli
->srv_name_slash
,
2434 SEC_FLAG_MAXIMUM_ALLOWED
,
2439 if (any_nt_status_not_ok(status
, result
, &status
)) {
2443 init_lsa_String(&name
, argv
[1]);
2447 status
= cli_get_session_key(mem_ctx
, cli
, &session_key
);
2448 if (!NT_STATUS_IS_OK(status
)) {
2452 enc_key
= sess_encrypt_string(argv
[2], &session_key
);
2454 val
.length
= enc_key
.length
;
2455 val
.size
= enc_key
.length
;
2456 val
.data
= enc_key
.data
;
2458 status
= dcerpc_lsa_StorePrivateData(b
, mem_ctx
,
2463 if (!NT_STATUS_IS_OK(status
)) {
2466 if (!NT_STATUS_IS_OK(result
)) {
2472 if (is_valid_policy_hnd(&handle
)) {
2473 dcerpc_lsa_Close(b
, mem_ctx
, &handle
, &result
);
2479 static NTSTATUS
cmd_lsa_create_trusted_domain(struct rpc_pipe_client
*cli
,
2480 TALLOC_CTX
*mem_ctx
, int argc
,
2483 NTSTATUS status
, result
;
2484 struct policy_handle handle
, trustdom_handle
;
2486 struct lsa_DomainInfo info
;
2487 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
2488 union lsa_revision_info out_revision_info
= {
2493 uint32_t out_version
= 0;
2496 printf("Usage: %s name sid\n", argv
[0]);
2497 return NT_STATUS_OK
;
2500 status
= dcerpc_lsa_open_policy_fallback(b
,
2502 cli
->srv_name_slash
,
2504 SEC_FLAG_MAXIMUM_ALLOWED
,
2509 if (any_nt_status_not_ok(status
, result
, &status
)) {
2513 init_lsa_StringLarge(&info
.name
, argv
[1]);
2515 string_to_sid(&sid
, argv
[2]);
2517 status
= dcerpc_lsa_CreateTrustedDomain(b
, mem_ctx
,
2520 SEC_FLAG_MAXIMUM_ALLOWED
,
2523 if (!NT_STATUS_IS_OK(status
)) {
2526 if (!NT_STATUS_IS_OK(result
)) {
2532 if (is_valid_policy_hnd(&trustdom_handle
)) {
2533 dcerpc_lsa_Close(b
, mem_ctx
, &trustdom_handle
, &result
);
2536 if (is_valid_policy_hnd(&handle
)) {
2537 dcerpc_lsa_Close(b
, mem_ctx
, &handle
, &result
);
2543 static NTSTATUS
cmd_lsa_delete_trusted_domain(struct rpc_pipe_client
*cli
,
2544 TALLOC_CTX
*mem_ctx
, int argc
,
2547 NTSTATUS status
, result
;
2548 struct policy_handle handle
, trustdom_handle
;
2549 struct lsa_String name
;
2550 struct dom_sid
*sid
= NULL
;
2551 struct dcerpc_binding_handle
*b
= cli
->binding_handle
;
2552 union lsa_revision_info out_revision_info
= {
2557 uint32_t out_version
= 0;
2560 printf("Usage: %s name\n", argv
[0]);
2561 return NT_STATUS_OK
;
2564 status
= dcerpc_lsa_open_policy_fallback(b
,
2566 cli
->srv_name_slash
,
2568 SEC_FLAG_MAXIMUM_ALLOWED
,
2573 if (any_nt_status_not_ok(status
, result
, &status
)) {
2577 init_lsa_String(&name
, argv
[1]);
2579 status
= dcerpc_lsa_OpenTrustedDomainByName(b
, mem_ctx
,
2582 SEC_FLAG_MAXIMUM_ALLOWED
,
2585 if (NT_STATUS_IS_OK(status
) && NT_STATUS_IS_OK(result
)) {
2590 uint32_t resume_handle
= 0;
2591 struct lsa_DomainList domains
;
2594 status
= dcerpc_lsa_EnumTrustDom(b
, mem_ctx
,
2600 if (!NT_STATUS_IS_OK(status
)) {
2603 if (!NT_STATUS_IS_OK(result
)) {
2608 for (i
=0; i
< domains
.count
; i
++) {
2609 if (strequal(domains
.domains
[i
].name
.string
, argv
[1])) {
2610 sid
= domains
.domains
[i
].sid
;
2616 return NT_STATUS_INVALID_SID
;
2620 status
= dcerpc_lsa_OpenTrustedDomain(b
, mem_ctx
,
2623 SEC_FLAG_MAXIMUM_ALLOWED
,
2626 if (!NT_STATUS_IS_OK(status
)) {
2629 if (!NT_STATUS_IS_OK(result
)) {
2635 status
= dcerpc_lsa_DeleteObject(b
, mem_ctx
,
2638 if (!NT_STATUS_IS_OK(status
)) {
2641 if (!NT_STATUS_IS_OK(result
)) {
2647 if (is_valid_policy_hnd(&trustdom_handle
)) {
2648 dcerpc_lsa_Close(b
, mem_ctx
, &trustdom_handle
, &result
);
2651 if (is_valid_policy_hnd(&handle
)) {
2652 dcerpc_lsa_Close(b
, mem_ctx
, &handle
, &result
);
2659 /* List of commands exported by this module */
2661 struct cmd_set lsarpc_commands
[] = {
2669 .returntype
= RPC_RTYPE_NTSTATUS
,
2670 .ntfn
= cmd_lsa_query_info_policy
,
2672 .table
= &ndr_table_lsarpc
,
2674 .description
= "Query info policy",
2678 .name
= "lookupsids",
2679 .returntype
= RPC_RTYPE_NTSTATUS
,
2680 .ntfn
= cmd_lsa_lookup_sids
,
2682 .table
= &ndr_table_lsarpc
,
2684 .description
= "Convert SIDs to names",
2688 .name
= "lookupsids3",
2689 .returntype
= RPC_RTYPE_NTSTATUS
,
2690 .ntfn
= cmd_lsa_lookup_sids3
,
2692 .table
= &ndr_table_lsarpc
,
2694 .description
= "Convert SIDs to names",
2698 .name
= "lookupsids_level",
2699 .returntype
= RPC_RTYPE_NTSTATUS
,
2700 .ntfn
= cmd_lsa_lookup_sids_level
,
2702 .table
= &ndr_table_lsarpc
,
2704 .description
= "Convert SIDs to names",
2708 .name
= "lookupnames",
2709 .returntype
= RPC_RTYPE_NTSTATUS
,
2710 .ntfn
= cmd_lsa_lookup_names
,
2712 .table
= &ndr_table_lsarpc
,
2714 .description
= "Convert names to SIDs",
2718 .name
= "lookupnames4",
2719 .returntype
= RPC_RTYPE_NTSTATUS
,
2720 .ntfn
= cmd_lsa_lookup_names4
,
2722 .table
= &ndr_table_lsarpc
,
2724 .description
= "Convert names to SIDs",
2728 .name
= "lookupnames_level",
2729 .returntype
= RPC_RTYPE_NTSTATUS
,
2730 .ntfn
= cmd_lsa_lookup_names_level
,
2732 .table
= &ndr_table_lsarpc
,
2734 .description
= "Convert names to SIDs",
2738 .name
= "enumtrust",
2739 .returntype
= RPC_RTYPE_NTSTATUS
,
2740 .ntfn
= cmd_lsa_enum_trust_dom
,
2742 .table
= &ndr_table_lsarpc
,
2744 .description
= "Enumerate trusted domains",
2745 .usage
= "Usage: [preferred max number] [enum context (0)]",
2748 .name
= "enumprivs",
2749 .returntype
= RPC_RTYPE_NTSTATUS
,
2750 .ntfn
= cmd_lsa_enum_privilege
,
2752 .table
= &ndr_table_lsarpc
,
2754 .description
= "Enumerate privileges",
2758 .name
= "getdispname",
2759 .returntype
= RPC_RTYPE_NTSTATUS
,
2760 .ntfn
= cmd_lsa_get_dispname
,
2762 .table
= &ndr_table_lsarpc
,
2764 .description
= "Get the privilege name",
2768 .name
= "lsaenumsid",
2769 .returntype
= RPC_RTYPE_NTSTATUS
,
2770 .ntfn
= cmd_lsa_enum_sids
,
2772 .table
= &ndr_table_lsarpc
,
2774 .description
= "Enumerate the LSA SIDS",
2778 .name
= "lsacreateaccount",
2779 .returntype
= RPC_RTYPE_NTSTATUS
,
2780 .ntfn
= cmd_lsa_create_account
,
2782 .table
= &ndr_table_lsarpc
,
2784 .description
= "Create a new lsa account",
2788 .name
= "lsaenumprivsaccount",
2789 .returntype
= RPC_RTYPE_NTSTATUS
,
2790 .ntfn
= cmd_lsa_enum_privsaccounts
,
2792 .table
= &ndr_table_lsarpc
,
2794 .description
= "Enumerate the privileges of an SID",
2798 .name
= "lsaenumacctrights",
2799 .returntype
= RPC_RTYPE_NTSTATUS
,
2800 .ntfn
= cmd_lsa_enum_acct_rights
,
2802 .table
= &ndr_table_lsarpc
,
2804 .description
= "Enumerate the rights of an SID",
2808 .name
= "lsaaddpriv",
2809 .returntype
= RPC_RTYPE_NTSTATUS
,
2810 .ntfn
= cmd_lsa_add_priv
,
2812 .table
= &ndr_table_lsarpc
,
2814 .description
= "Assign a privilege to a SID",
2818 .name
= "lsadelpriv",
2819 .returntype
= RPC_RTYPE_NTSTATUS
,
2820 .ntfn
= cmd_lsa_del_priv
,
2822 .table
= &ndr_table_lsarpc
,
2824 .description
= "Revoke a privilege from a SID",
2828 .name
= "lsaaddacctrights",
2829 .returntype
= RPC_RTYPE_NTSTATUS
,
2830 .ntfn
= cmd_lsa_add_acct_rights
,
2832 .table
= &ndr_table_lsarpc
,
2834 .description
= "Add rights to an account",
2838 .name
= "lsaremoveacctrights",
2839 .returntype
= RPC_RTYPE_NTSTATUS
,
2840 .ntfn
= cmd_lsa_remove_acct_rights
,
2842 .table
= &ndr_table_lsarpc
,
2844 .description
= "Remove rights from an account",
2848 .name
= "lsalookupprivvalue",
2849 .returntype
= RPC_RTYPE_NTSTATUS
,
2850 .ntfn
= cmd_lsa_lookup_priv_value
,
2852 .table
= &ndr_table_lsarpc
,
2854 .description
= "Get a privilege value given its name",
2858 .name
= "lsaquerysecobj",
2859 .returntype
= RPC_RTYPE_NTSTATUS
,
2860 .ntfn
= cmd_lsa_query_secobj
,
2862 .table
= &ndr_table_lsarpc
,
2864 .description
= "Query LSA security object",
2868 .name
= "lsaquerytrustdominfo",
2869 .returntype
= RPC_RTYPE_NTSTATUS
,
2870 .ntfn
= cmd_lsa_query_trustdominfo
,
2872 .table
= &ndr_table_lsarpc
,
2874 .description
= "Query LSA trusted domains info (given a SID)",
2878 .name
= "lsaquerytrustdominfobyname",
2879 .returntype
= RPC_RTYPE_NTSTATUS
,
2880 .ntfn
= cmd_lsa_query_trustdominfobyname
,
2882 .table
= &ndr_table_lsarpc
,
2884 .description
= "Query LSA trusted domains info (given a name), only works for Windows > 2k",
2888 .name
= "lsaquerytrustdominfobysid",
2889 .returntype
= RPC_RTYPE_NTSTATUS
,
2890 .ntfn
= cmd_lsa_query_trustdominfobysid
,
2892 .table
= &ndr_table_lsarpc
,
2894 .description
= "Query LSA trusted domains info (given a SID)",
2898 .name
= "lsasettrustdominfo",
2899 .returntype
= RPC_RTYPE_NTSTATUS
,
2900 .ntfn
= cmd_lsa_set_trustdominfo
,
2902 .table
= &ndr_table_lsarpc
,
2904 .description
= "Set LSA trusted domain info",
2908 .name
= "getusername",
2909 .returntype
= RPC_RTYPE_NTSTATUS
,
2910 .ntfn
= cmd_lsa_get_username
,
2912 .table
= &ndr_table_lsarpc
,
2914 .description
= "Get username",
2918 .name
= "createsecret",
2919 .returntype
= RPC_RTYPE_NTSTATUS
,
2920 .ntfn
= cmd_lsa_create_secret
,
2922 .table
= &ndr_table_lsarpc
,
2924 .description
= "Create Secret",
2928 .name
= "deletesecret",
2929 .returntype
= RPC_RTYPE_NTSTATUS
,
2930 .ntfn
= cmd_lsa_delete_secret
,
2932 .table
= &ndr_table_lsarpc
,
2934 .description
= "Delete Secret",
2938 .name
= "querysecret",
2939 .returntype
= RPC_RTYPE_NTSTATUS
,
2940 .ntfn
= cmd_lsa_query_secret
,
2942 .table
= &ndr_table_lsarpc
,
2944 .description
= "Query Secret",
2948 .name
= "setsecret",
2949 .returntype
= RPC_RTYPE_NTSTATUS
,
2950 .ntfn
= cmd_lsa_set_secret
,
2952 .table
= &ndr_table_lsarpc
,
2954 .description
= "Set Secret",
2958 .name
= "retrieveprivatedata",
2959 .returntype
= RPC_RTYPE_NTSTATUS
,
2960 .ntfn
= cmd_lsa_retrieve_private_data
,
2962 .table
= &ndr_table_lsarpc
,
2964 .description
= "Retrieve Private Data",
2968 .name
= "storeprivatedata",
2969 .returntype
= RPC_RTYPE_NTSTATUS
,
2970 .ntfn
= cmd_lsa_store_private_data
,
2972 .table
= &ndr_table_lsarpc
,
2974 .description
= "Store Private Data",
2978 .name
= "createtrustdom",
2979 .returntype
= RPC_RTYPE_NTSTATUS
,
2980 .ntfn
= cmd_lsa_create_trusted_domain
,
2982 .table
= &ndr_table_lsarpc
,
2984 .description
= "Create Trusted Domain",
2988 .name
= "deletetrustdom",
2989 .returntype
= RPC_RTYPE_NTSTATUS
,
2990 .ntfn
= cmd_lsa_delete_trusted_domain
,
2992 .table
= &ndr_table_lsarpc
,
2994 .description
= "Delete Trusted Domain",