s3:rpc_server: move gensec_update() out of auth_generic_server_authtype_start*()
[samba.git] / source3 / rpc_server / srv_pipe.c
index 251f8991a600c53e4ca7778fbe08ac2b75b39fea..39f5fb49ec3c0e011a5c6ad4b7ac60bcf49af05a 100644 (file)
@@ -527,23 +527,16 @@ static bool pipe_auth_generic_bind(struct pipes_struct *p,
        status = auth_generic_server_authtype_start(p,
                                                    auth_info->auth_type,
                                                    auth_info->auth_level,
-                                                   &auth_info->credentials,
-                                                   response,
                                                    p->remote_address,
                                                    p->local_address,
                                                    service_description,
                                                    &gensec_security);
-       if (!NT_STATUS_IS_OK(status) &&
-           !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED))
-       {
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, (__location__ ": auth_generic_server_authtype_start[%u/%u] failed: %s\n",
                          auth_info->auth_type, auth_info->auth_level, nt_errstr(status)));
                return false;
        }
 
-       /* Make sure data is bound to the memctx, to be freed the caller */
-       talloc_steal(mem_ctx, response->data);
-
        p->auth.auth_ctx = gensec_security;
        p->auth.auth_type = auth_info->auth_type;
        p->auth.auth_level = auth_info->auth_level;
@@ -560,6 +553,19 @@ static bool pipe_auth_generic_bind(struct pipes_struct *p,
                                    GENSEC_FEATURE_SIGN_PKT_HEADER);
        }
 
+       status = auth_generic_server_step(gensec_security, mem_ctx,
+                                         &auth_info->credentials,
+                                         response);
+       if (!NT_STATUS_IS_OK(status) &&
+           !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED))
+       {
+               DEBUG(2, (__location__ ": "
+                         "auth_generic_server_step[%u/%u] failed: %s\n",
+                         auth_info->auth_type, auth_info->auth_level,
+                         nt_errstr(status)));
+               return false;
+       }
+
        if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
                return true;
        }