diff options
-rw-r--r-- | source3/rpcclient/cmd_lsarpc.c | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 51b260cceb..194e498122 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -32,7 +32,8 @@ static NTSTATUS cmd_lsa_query_info_policy(struct cli_state *cli, POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; DOM_SID dom_sid; - fstring sid_str, domain_name; + GUID dom_guid; + fstring sid_str, domain_name="", dns_name="", forest_name=""; uint32 info_class = 3; if (argc > 2) { @@ -43,17 +44,31 @@ static NTSTATUS cmd_lsa_query_info_policy(struct cli_state *cli, if (argc == 2) info_class = atoi(argv[1]); - result = cli_lsa_open_policy(cli, mem_ctx, True, + /* Lookup info policy */ + switch (info_class) { + case 12: + result = cli_lsa_open_policy2(cli, mem_ctx, True, + SEC_RIGHTS_MAXIMUM_ALLOWED, + &pol); + + if (!NT_STATUS_IS_OK(result)) + goto done; + result = cli_lsa_query_info_policy2(cli, mem_ctx, &pol, + info_class, domain_name, + dns_name, forest_name, + &dom_guid, &dom_sid); + break; + default: + result = cli_lsa_open_policy(cli, mem_ctx, True, SEC_RIGHTS_MAXIMUM_ALLOWED, &pol); - if (!NT_STATUS_IS_OK(result)) - goto done; - - /* Lookup info policy */ - - result = cli_lsa_query_info_policy(cli, mem_ctx, &pol, info_class, - domain_name, &dom_sid); + if (!NT_STATUS_IS_OK(result)) + goto done; + result = cli_lsa_query_info_policy(cli, mem_ctx, &pol, + info_class, domain_name, + &dom_sid); + } if (!NT_STATUS_IS_OK(result)) goto done; @@ -65,6 +80,22 @@ static NTSTATUS cmd_lsa_query_info_policy(struct cli_state *cli, else printf("could not query info for level %d\n", info_class); + if (dns_name[0]) + printf("domain dns name is %s\n", dns_name); + if (forest_name[0]) + printf("forest name is %s\n", forest_name); + + if (info_class == 12) { + int i; + uint32 *data1 = (uint32 *) dom_guid.info; + uint16 *data2 = (uint16 *) &dom_guid.info[4]; + uint16 *data3 = (uint16 *) &dom_guid.info[6]; + printf("domain GUID is %08x-%04x-%04x", *data1,*data2,*data3); + printf("-%02x%02x-", dom_guid.info[8], dom_guid.info[9]); + for (i=10;i<GUID_SIZE;i++) + printf("%02x", dom_guid.info[i]); + printf("\n"); + } done: return result; } |