summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorVicentiu Ciorbaru <cvicentiu@gmail.com>2011-07-26 13:48:34 +0300
committerMichael Adam <obnox@samba.org>2011-08-22 13:59:27 +0200
commit1a3b88cfb369a9d3ab5545b56b5242489cef6c2d (patch)
tree852102f91965a83243b1317a4d5c5f32386b38b8 /source3/utils
parent689edf8ae1e6a3df60b11a7b1e0c2dcfae2c119a (diff)
downloadsamba-1a3b88cfb369a9d3ab5545b56b5242489cef6c2d.tar.gz
samba-1a3b88cfb369a9d3ab5545b56b5242489cef6c2d.tar.bz2
samba-1a3b88cfb369a9d3ab5545b56b5242489cef6c2d.zip
s3-net: Implemented net rpc conf delparm command
The function makes use of existing code from delincludes. It has the same logic, except it uses the second argument passed to determine which value to delete from the registry. Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc_conf.c79
1 files changed, 77 insertions, 2 deletions
diff --git a/source3/utils/net_rpc_conf.c b/source3/utils/net_rpc_conf.c
index ed2f69bb54..b25faef57b 100644
--- a/source3/utils/net_rpc_conf.c
+++ b/source3/utils/net_rpc_conf.c
@@ -91,6 +91,14 @@ static int rpc_conf_getparm_usage(struct net_context *c, int argc,
return -1;
}
+static int rpc_conf_delparm_usage(struct net_context *c, int argc,
+ const char **argv)
+{
+ d_printf("%s\nnet rpc conf delparm <sharename> <parameter>\n",
+ _("Usage:"));
+ return -1;
+}
+
static int rpc_conf_getincludes_usage(struct net_context *c, int argc,
const char **argv)
{
@@ -1058,6 +1066,72 @@ error:
}
+static NTSTATUS rpc_conf_delparm_internal(struct net_context *c,
+ const struct dom_sid *domain_sid,
+ const char *domain_name,
+ struct cli_state *cli,
+ struct rpc_pipe_client *pipe_hnd,
+ TALLOC_CTX *mem_ctx,
+ int argc,
+ const char **argv )
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ NTSTATUS status = NT_STATUS_OK;
+ WERROR werr = WERR_OK;
+ WERROR _werr;
+
+ struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
+
+ /* key info */
+ struct policy_handle hive_hnd, key_hnd;
+
+
+ ZERO_STRUCT(hive_hnd);
+ ZERO_STRUCT(key_hnd);
+
+
+ if (argc != 2 || c->display_usage) {
+ rpc_conf_delparm_usage(c, argc, argv);
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto error;
+ }
+
+ status = rpc_conf_open_conf(frame,
+ b,
+ REG_KEY_READ,
+ &hive_hnd,
+ &key_hnd,
+ &werr);
+
+ if (!(NT_STATUS_IS_OK(status))) {
+ goto error;
+ }
+
+ if (!(W_ERROR_IS_OK(werr))) {
+ goto error;
+ }
+
+ status = rpc_conf_del_value(frame,
+ b,
+ &key_hnd,
+ argv[0],
+ argv[1],
+ &werr);
+
+error:
+
+ if (!(W_ERROR_IS_OK(werr))) {
+ status = werror_to_ntstatus(werr);
+ }
+
+ dcerpc_winreg_CloseKey(b, frame, &hive_hnd, &_werr);
+ dcerpc_winreg_CloseKey(b, frame, &key_hnd, &_werr);
+
+ TALLOC_FREE(frame);
+ return status;
+
+}
+
static NTSTATUS rpc_conf_getincludes_internal(struct net_context *c,
const struct dom_sid *domain_sid,
const char *domain_name,
@@ -1260,9 +1334,10 @@ static int rpc_conf_getparm(struct net_context *c, int argc,
static int rpc_conf_delparm(struct net_context *c, int argc,
const char **argv)
{
- d_printf("Function not yet implemented\n");
- return 0;
+ return run_rpc_command(c, NULL, &ndr_table_winreg.syntax_id, 0,
+ rpc_conf_delparm_internal, argc, argv );
}
+
static int rpc_conf_getincludes(struct net_context *c, int argc,
const char **argv)
{