summaryrefslogtreecommitdiff
path: root/source4/auth/auth_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/auth/auth_util.c')
-rw-r--r--source4/auth/auth_util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/auth/auth_util.c b/source4/auth/auth_util.c
index 097f504538..06947999b3 100644
--- a/source4/auth/auth_util.c
+++ b/source4/auth/auth_util.c
@@ -590,6 +590,7 @@ NTSTATUS make_session_info(struct auth_serversupplied_info *server_info,
return NT_STATUS_NO_MEMORY;
}
+ (*session_info)->refcount = 1;
(*session_info)->mem_ctx = server_info->mem_ctx;
server_info->mem_ctx = NULL; /* make sure not to accidentily destory it,
and this information is now constant */
@@ -611,6 +612,22 @@ NTSTATUS make_session_info(struct auth_serversupplied_info *server_info,
return nt_status;
}
+/***************************************************************************
+ Clear out a server_info struct that has been allocated
+***************************************************************************/
+
+void free_session_info(struct auth_session_info **session_info)
+{
+ DEBUG(5,("attempting to free a session_info structure\n"));
+ if (!*session_info) {
+ (*session_info)->refcount--;
+ if ((*session_info)->refcount <= 0) {
+ talloc_destroy((*session_info)->mem_ctx);
+ }
+ }
+ *session_info = NULL;
+}
+
/**
* Squash an NT_STATUS in line with security requirements.
* In an attempt to avoid giving the whole game away when users