From d86ff599892608cf739c96e8add9b6ff9f9e5e43 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jul 2008 18:40:31 +0200 Subject: Refactoring: net_sh_run uses ndr_syntax_id instead of pipe_idx (This used to be commit 85c8363d5179e7053adc05e8abce2fb26cf9b968) --- source3/utils/net.h | 2 +- source3/utils/net_rpc.c | 34 +++++++++++++++++----------------- source3/utils/net_rpc_rights.c | 6 +++--- source3/utils/net_rpc_sh_acct.c | 16 ++++++++-------- source3/utils/net_rpc_shell.c | 5 ++--- 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/source3/utils/net.h b/source3/utils/net.h index 941172a8c1..01a76a0db1 100644 --- a/source3/utils/net.h +++ b/source3/utils/net.h @@ -115,7 +115,7 @@ struct rpc_sh_cmd { struct rpc_sh_cmd *(*sub)(struct net_context *c, TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx); - int pipe_idx; + const struct ndr_syntax_id *interface; NTSTATUS (*fn)(struct net_context *c, TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 8c8cc2e955..5989fd4cf1 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -1592,34 +1592,34 @@ struct rpc_sh_cmd *net_rpc_user_edit_cmds(struct net_context *c, { static struct rpc_sh_cmd cmds[] = { - { "fullname", NULL, PI_SAMR, rpc_sh_user_str_edit, + { "fullname", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit, "Show/Set a user's full name" }, - { "homedir", NULL, PI_SAMR, rpc_sh_user_str_edit, + { "homedir", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit, "Show/Set a user's home directory" }, - { "homedrive", NULL, PI_SAMR, rpc_sh_user_str_edit, + { "homedrive", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit, "Show/Set a user's home drive" }, - { "logonscript", NULL, PI_SAMR, rpc_sh_user_str_edit, + { "logonscript", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit, "Show/Set a user's logon script" }, - { "profilepath", NULL, PI_SAMR, rpc_sh_user_str_edit, + { "profilepath", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit, "Show/Set a user's profile path" }, - { "description", NULL, PI_SAMR, rpc_sh_user_str_edit, + { "description", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_str_edit, "Show/Set a user's description" }, - { "disabled", NULL, PI_SAMR, rpc_sh_user_flag_edit, + { "disabled", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_flag_edit, "Show/Set whether a user is disabled" }, - { "autolock", NULL, PI_SAMR, rpc_sh_user_flag_edit, + { "autolock", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_flag_edit, "Show/Set whether a user locked out" }, - { "pwnotreq", NULL, PI_SAMR, rpc_sh_user_flag_edit, + { "pwnotreq", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_flag_edit, "Show/Set whether a user does not need a password" }, - { "pwnoexp", NULL, PI_SAMR, rpc_sh_user_flag_edit, + { "pwnoexp", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_flag_edit, "Show/Set whether a user's password does not expire" }, { NULL, NULL, 0, NULL, NULL } @@ -1634,13 +1634,13 @@ struct rpc_sh_cmd *net_rpc_user_cmds(struct net_context *c, { static struct rpc_sh_cmd cmds[] = { - { "list", NULL, PI_SAMR, rpc_sh_user_list, + { "list", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_list, "List available users" }, - { "info", NULL, PI_SAMR, rpc_sh_user_info, + { "info", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_info, "List the domain groups a user is member of" }, - { "show", NULL, PI_SAMR, rpc_sh_user_show, + { "show", NULL, &ndr_table_samr.syntax_id, rpc_sh_user_show, "Show info about a user" }, { "edit", net_rpc_user_edit_cmds, 0, NULL, @@ -5119,16 +5119,16 @@ struct rpc_sh_cmd *net_rpc_share_cmds(struct net_context *c, TALLOC_CTX *mem_ctx { static struct rpc_sh_cmd cmds[] = { - { "list", NULL, PI_SRVSVC, rpc_sh_share_list, + { "list", NULL, &ndr_table_srvsvc.syntax_id, rpc_sh_share_list, "List available shares" }, - { "add", NULL, PI_SRVSVC, rpc_sh_share_add, + { "add", NULL, &ndr_table_srvsvc.syntax_id, rpc_sh_share_add, "Add a share" }, - { "delete", NULL, PI_SRVSVC, rpc_sh_share_delete, + { "delete", NULL, &ndr_table_srvsvc.syntax_id, rpc_sh_share_delete, "Delete a share" }, - { "info", NULL, PI_SRVSVC, rpc_sh_share_info, + { "info", NULL, &ndr_table_srvsvc.syntax_id, rpc_sh_share_info, "Get information about a share" }, { NULL, NULL, 0, NULL, NULL } diff --git a/source3/utils/net_rpc_rights.c b/source3/utils/net_rpc_rights.c index 81045c6a7d..2bc5efe3cf 100644 --- a/source3/utils/net_rpc_rights.c +++ b/source3/utils/net_rpc_rights.c @@ -691,13 +691,13 @@ struct rpc_sh_cmd *net_rpc_rights_cmds(struct net_context *c, TALLOC_CTX *mem_ct { static struct rpc_sh_cmd cmds[] = { - { "list", NULL, PI_LSARPC, rpc_sh_rights_list, + { "list", NULL, &ndr_table_lsarpc.syntax_id, rpc_sh_rights_list, "View available or assigned privileges" }, - { "grant", NULL, PI_LSARPC, rpc_sh_rights_grant, + { "grant", NULL, &ndr_table_lsarpc.syntax_id, rpc_sh_rights_grant, "Assign privilege[s]" }, - { "revoke", NULL, PI_LSARPC, rpc_sh_rights_revoke, + { "revoke", NULL, &ndr_table_lsarpc.syntax_id, rpc_sh_rights_revoke, "Revoke privilege[s]" }, { NULL, NULL, 0, NULL, NULL } diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index ba2a8e28a0..977e1e2a0a 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -429,22 +429,22 @@ struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx) { static struct rpc_sh_cmd cmds[9] = { - { "show", NULL, PI_SAMR, rpc_sh_acct_pol_show, + { "show", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_pol_show, "Show current account policy settings" }, - { "badpw", NULL, PI_SAMR, rpc_sh_acct_set_badpw, + { "badpw", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_badpw, "Set bad password count before lockout" }, - { "lockduration", NULL, PI_SAMR, rpc_sh_acct_set_lockduration, + { "lockduration", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_lockduration, "Set account lockout duration" }, - { "resetduration", NULL, PI_SAMR, + { "resetduration", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_resetduration, "Set bad password count reset duration" }, - { "minpwage", NULL, PI_SAMR, rpc_sh_acct_set_minpwage, + { "minpwage", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_minpwage, "Set minimum password age" }, - { "maxpwage", NULL, PI_SAMR, rpc_sh_acct_set_maxpwage, + { "maxpwage", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_maxpwage, "Set maximum password age" }, - { "minpwlen", NULL, PI_SAMR, rpc_sh_acct_set_minpwlen, + { "minpwlen", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_minpwlen, "Set minimum password length" }, - { "pwhistlen", NULL, PI_SAMR, rpc_sh_acct_set_pwhistlen, + { "pwhistlen", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_pwhistlen, "Set the password history length" }, { NULL, NULL, 0, NULL, NULL } }; diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c index 6abdb03c48..c6051dc976 100644 --- a/source3/utils/net_rpc_shell.c +++ b/source3/utils/net_rpc_shell.c @@ -78,8 +78,7 @@ static NTSTATUS net_sh_run(struct net_context *c, return NT_STATUS_NO_MEMORY; } - status = cli_rpc_pipe_open_noauth(ctx->cli, - cli_get_iface(cmd->pipe_idx), + status = cli_rpc_pipe_open_noauth(ctx->cli, cmd->interface, &pipe_hnd); if (!NT_STATUS_IS_OK(status)) { d_fprintf(stderr, "Could not open pipe: %s\n", @@ -189,7 +188,7 @@ static bool net_sh_process(struct net_context *c, static struct rpc_sh_cmd sh_cmds[6] = { - { "info", NULL, PI_SAMR, rpc_sh_info, + { "info", NULL, &ndr_table_samr.syntax_id, rpc_sh_info, "Print information about the domain connected to" }, { "rights", net_rpc_rights_cmds, 0, NULL, -- cgit