summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-04-14 01:17:05 +0000
committerTim Potter <tpot@samba.org>2003-04-14 01:17:05 +0000
commitcb621ec3a61fdd699150b6597888a7bfe864f901 (patch)
tree95337d0207fcd0289ff78957c0aeee0cb9c33cb4 /source3/rpcclient
parent78e5d097e328fdb4c60dd98eac386621006a2044 (diff)
downloadsamba-cb621ec3a61fdd699150b6597888a7bfe864f901.tar.gz
samba-cb621ec3a61fdd699150b6597888a7bfe864f901.tar.bz2
samba-cb621ec3a61fdd699150b6597888a7bfe864f901.zip
Merge of samr lookup domain rpc client call from HEAD.
(This used to be commit 5b1807dddf0e4fb9fcaedcfe6f67dfd78fe117bb)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_samr.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 866381456b..e2232f0da7 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1487,6 +1487,49 @@ static NTSTATUS cmd_samr_get_dom_pwinfo(struct cli_state *cli,
return result;
}
+/* Look up domain name */
+
+static NTSTATUS cmd_samr_lookup_domain(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
+{
+ POLICY_HND connect_pol, domain_pol;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;
+ fstring domain_name,sid_string;
+ DOM_SID sid;
+
+ if (argc != 2) {
+ printf("Usage: %s domain_name\n", argv[0]);
+ return NT_STATUS_OK;
+ }
+
+ sscanf(argv[1], "%s", domain_name);
+
+ result = try_samr_connects(cli, mem_ctx, access_mask, &connect_pol);
+
+ if (!NT_STATUS_IS_OK(result))
+ goto done;
+
+ result = cli_samr_open_domain(cli, mem_ctx, &connect_pol,
+ access_mask, &domain_sid, &domain_pol);
+
+ if (!NT_STATUS_IS_OK(result))
+ goto done;
+
+ result = cli_samr_lookup_domain(
+ cli, mem_ctx, &connect_pol, domain_name, &sid);
+
+ sid_to_string(sid_string,&sid);
+
+ if (NT_STATUS_IS_OK(result))
+ printf("SAMR_LOOKUP_DOMAIN: Domain Name: %s Domain SID: %s\n",
+ domain_name,sid_string);
+
+done:
+ return result;
+}
+
/* List of commands exported by this module */
@@ -1513,5 +1556,6 @@ struct cmd_set samr_commands[] = {
{ "samquerysecobj", RPC_RTYPE_NTSTATUS, cmd_samr_query_sec_obj, NULL, PI_SAMR, "Query SAMR security object", "" },
{ "getdompwinfo", RPC_RTYPE_NTSTATUS, cmd_samr_get_dom_pwinfo, NULL, PI_SAMR, "Retrieve domain password info", "" },
+ { "lookupdomain", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_domain, NULL, PI_SAMR, "Lookup Domain Name", "" },
{ NULL }
};