net: now that "net rpc user" uses netapi calls exclusivly, net rpc shell needs
[kai/samba.git] / source3 / utils / net_rpc_shell.c
index dee7a9f9c7ed5e0a61e793f074c0e065b936dd45..3aaed1ed1814f239f87984f1c93c7da4f828e293 100644 (file)
@@ -78,8 +78,9 @@ static NTSTATUS net_sh_run(struct net_context *c,
                return NT_STATUS_NO_MEMORY;
        }
 
-       pipe_hnd = cli_rpc_pipe_open_noauth(ctx->cli, cmd->pipe_idx, &status);
-       if (pipe_hnd == NULL) {
+       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",
                          nt_errstr(status));
                return status;
@@ -187,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,
@@ -216,6 +217,15 @@ int net_rpc_shell(struct net_context *c, int argc, const char **argv)
                return -1;
        }
 
+       if (libnetapi_init(&c->netapi_ctx) != 0) {
+               return -1;
+       }
+       libnetapi_set_username(c->netapi_ctx, c->opt_user_name);
+       libnetapi_set_password(c->netapi_ctx, c->opt_password);
+       if (c->opt_kerberos) {
+               libnetapi_set_use_kerberos(c->netapi_ctx);
+       }
+
        ctx = TALLOC_P(NULL, struct rpc_sh_ctx);
        if (ctx == NULL) {
                d_fprintf(stderr, "talloc failed\n");