s3: store user session key in cli_rpc_pipe_open_noauth().
[kai/samba.git] / source3 / rpc_client / cli_pipe.c
index f0c2f6709efa8a0622fd41fc45737058b4089567..a2d334230dd34df8c86e4c69f93114c167a31554 100644 (file)
@@ -2979,6 +2979,9 @@ NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
 
        auth->user_name = talloc_strdup(auth, cli->user_name);
        auth->domain = talloc_strdup(auth, cli->domain);
+       auth->user_session_key = data_blob_talloc(auth,
+               cli->user_session_key.data,
+               cli->user_session_key.length);
 
        if ((auth->user_name == NULL) || (auth->domain == NULL)) {
                TALLOC_FREE(result);
@@ -3443,6 +3446,10 @@ NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
                                cli->auth->a_u.kerberos_auth->session_key.length);
                        break;
                case PIPE_AUTH_TYPE_NONE:
+                       *session_key = data_blob_talloc(mem_ctx,
+                               cli->auth->user_session_key.data,
+                               cli->auth->user_session_key.length);
+                       break;
                default:
                        return NT_STATUS_NO_USER_SESSION_KEY;
        }