summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-08-12 13:41:52 +0000
committerJim McDonough <jmcd@samba.org>2002-08-12 13:41:52 +0000
commit28bf5e5f2d935671ff1d06c6efe2d8ff3bfafdae (patch)
treed01d78352d9bfa3cd7729a6ee6c03dc3804bca26
parentae6cb0fb31c51c2e0beeda016e75d711a518b140 (diff)
downloadsamba-28bf5e5f2d935671ff1d06c6efe2d8ff3bfafdae.tar.gz
samba-28bf5e5f2d935671ff1d06c6efe2d8ff3bfafdae.tar.bz2
samba-28bf5e5f2d935671ff1d06c6efe2d8ff3bfafdae.zip
Add lsaqueryinfo2, but keep under "lsaquery" command. It will autoselect
which lsaqueryinfo to do based in infoclass. Currently 12 is the only one that causes a queryinfo2. (This used to be commit f4ec2d52a7b093da701d68906cce6de197f182be)
-rw-r--r--source3/rpcclient/cmd_lsarpc.c49
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;
}