summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-10-28 14:13:32 +0100
committerGünther Deschner <gd@samba.org>2009-10-30 12:28:48 +0100
commitfbdda195498a9868b9a11a4e0621fadab1ce0963 (patch)
tree8ef7e94de564fa6e2d9da8840c9c09511fc75b8e /source3
parenta98832189a429d7d36eb0decbe66d228061c8cd1 (diff)
downloadsamba-fbdda195498a9868b9a11a4e0621fadab1ce0963.tar.gz
samba-fbdda195498a9868b9a11a4e0621fadab1ce0963.tar.bz2
samba-fbdda195498a9868b9a11a4e0621fadab1ce0963.zip
s3-rpcclient: add createtrustdom command.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/rpcclient/cmd_lsarpc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 752881c221..641b38e340 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -1836,6 +1836,50 @@ static NTSTATUS cmd_lsa_store_private_data(struct rpc_pipe_client *cli,
return status;
}
+static NTSTATUS cmd_lsa_create_trusted_domain(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx, int argc,
+ const char **argv)
+{
+ NTSTATUS status;
+ struct policy_handle handle, trustdom_handle;
+ struct lsa_DomainInfo info;
+
+ if (argc < 3) {
+ printf("Usage: %s name sid\n", argv[0]);
+ return NT_STATUS_OK;
+ }
+
+ status = rpccli_lsa_open_policy2(cli, mem_ctx,
+ true,
+ SEC_FLAG_MAXIMUM_ALLOWED,
+ &handle);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ init_lsa_StringLarge(&info.name, argv[1]);
+ info.sid = string_sid_talloc(mem_ctx, argv[2]);
+
+ status = rpccli_lsa_CreateTrustedDomain(cli, mem_ctx,
+ &handle,
+ &info,
+ SEC_FLAG_MAXIMUM_ALLOWED,
+ &trustdom_handle);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto done;
+ }
+
+ done:
+ if (is_valid_policy_hnd(&trustdom_handle)) {
+ rpccli_lsa_Close(cli, mem_ctx, &trustdom_handle);
+ }
+
+ if (is_valid_policy_hnd(&handle)) {
+ rpccli_lsa_Close(cli, mem_ctx, &handle);
+ }
+
+ return status;
+}
/* List of commands exported by this module */
@@ -1872,6 +1916,7 @@ struct cmd_set lsarpc_commands[] = {
{ "setsecret", RPC_RTYPE_NTSTATUS, cmd_lsa_set_secret, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Set Secret", "" },
{ "retrieveprivatedata", RPC_RTYPE_NTSTATUS, cmd_lsa_retrieve_private_data, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Retrieve Private Data", "" },
{ "storeprivatedata", RPC_RTYPE_NTSTATUS, cmd_lsa_store_private_data, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Store Private Data", "" },
+ { "createtrustdom", RPC_RTYPE_NTSTATUS, cmd_lsa_create_trusted_domain, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Create Trusted Domain", "" },
{ NULL }
};