}
-NTSTATUS auth_ntlmssp_server_info(TALLOC_CTX *mem_ctx,
- struct auth_ntlmssp_state *auth_ntlmssp_state,
- struct auth_serversupplied_info **_server_info)
+NTSTATUS auth_ntlmssp_steal_server_info(TALLOC_CTX *mem_ctx,
+ struct auth_ntlmssp_state *auth_ntlmssp_state,
+ struct auth_serversupplied_info **server_info)
{
- struct auth_serversupplied_info *server_info = auth_ntlmssp_state->server_info;
- data_blob_free(&server_info->user_session_key);
- server_info->user_session_key =
+ /* Free the current server_info user_session_key and reset it from the
+ * current ntlmssp_state session_key */
+ data_blob_free(&auth_ntlmssp_state->server_info->user_session_key);
+ auth_ntlmssp_state->server_info->user_session_key =
data_blob_talloc(
- server_info,
+ auth_ntlmssp_state->server_info,
auth_ntlmssp_state->ntlmssp_state->session_key.data,
auth_ntlmssp_state->ntlmssp_state->session_key.length);
- if (auth_ntlmssp_state->ntlmssp_state->session_key.length && !server_info->user_session_key.data) {
- *_server_info = NULL;
+ if (auth_ntlmssp_state->ntlmssp_state->session_key.length &&
+ !auth_ntlmssp_state->server_info->user_session_key.data) {
+ *server_info = NULL;
return NT_STATUS_NO_MEMORY;
}
- auth_ntlmssp_state->server_info = NULL;
- *_server_info = talloc_steal(mem_ctx, server_info);
+ /* Steal server_info away from auth_ntlmssp_state */
+ *server_info = talloc_move(mem_ctx, &auth_ntlmssp_state->server_info);
return NT_STATUS_OK;
}
/* The following definitions come from auth/auth_ntlmssp.c */
-NTSTATUS auth_ntlmssp_server_info(TALLOC_CTX *mem_ctx,
- struct auth_ntlmssp_state *auth_ntlmssp_state,
- struct auth_serversupplied_info **_server_info);
+NTSTATUS auth_ntlmssp_steal_server_info(TALLOC_CTX *mem_ctx,
+ struct auth_ntlmssp_state *auth_ntlmssp_state,
+ struct auth_serversupplied_info **server_info);
struct ntlmssp_state *auth_ntlmssp_get_ntlmssp_state(struct auth_ntlmssp_state *auth_ntlmssp_state);
const char *auth_ntlmssp_get_username(struct auth_ntlmssp_state *auth_ntlmssp_state);
const char *auth_ntlmssp_get_domain(struct auth_ntlmssp_state *auth_ntlmssp_state);
TALLOC_FREE(p->server_info);
- status = auth_ntlmssp_server_info(p, a, &p->server_info);
+ status = auth_ntlmssp_steal_server_info(p, a, &p->server_info);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("auth_ntlmssp_server_info failed to obtain the server info for authenticated user: %s\n",
nt_errstr(status)));
struct smbd_server_connection *sconn = req->sconn;
if (NT_STATUS_IS_OK(nt_status)) {
- nt_status = auth_ntlmssp_server_info(talloc_tos(), (*auth_ntlmssp_state), &server_info);
+ nt_status = auth_ntlmssp_steal_server_info(talloc_tos(),
+ (*auth_ntlmssp_state), &server_info);
} else {
/* Note that this server_info won't have a session
* key. But for map to guest, that's exactly the right
NTSTATUS status)
{
if (NT_STATUS_IS_OK(status)) {
- status = auth_ntlmssp_server_info(session,
+ status = auth_ntlmssp_steal_server_info(session,
session->auth_ntlmssp_state,
&session->server_info);
} else {