Refactoring: net_sh_run uses ndr_syntax_id instead of pipe_idx
authorVolker Lendecke <vl@samba.org>
Sun, 20 Jul 2008 16:40:31 +0000 (18:40 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 21 Jul 2008 12:36:28 +0000 (14:36 +0200)
(This used to be commit 85c8363d5179e7053adc05e8abce2fb26cf9b968)

source3/utils/net.h
source3/utils/net_rpc.c
source3/utils/net_rpc_rights.c
source3/utils/net_rpc_sh_acct.c
source3/utils/net_rpc_shell.c

index 941172a8c18a3ef1afcd93b6a9b6c3112345493e..01a76a0db1299c7547a85d202d12543686756333 100644 (file)
@@ -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,
index 8c8cc2e955eb78e4fbaba22ec8ae0ae75ad0fa68..5989fd4cf1c9c0f2b6dcf7be1dab73a60ac07e2f 100644 (file)
@@ -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 }
index 81045c6a7d912744c4981503635aa6585876cca3..2bc5efe3cf6066a53c9d2d7c3a92ce092db4e319 100644 (file)
@@ -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 }
index ba2a8e28a022ceedfd287b29f7bc86f9a8110b27..977e1e2a0a7d6ca98cc84a8fa58a53af03b96b4a 100644 (file)
@@ -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 }
        };
index 6abdb03c48d02ac882bcd21bdedccd78542c5de0..c6051dc97685cbc2301e1774098f3c7e6d0f82e9 100644 (file)
@@ -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,