diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-09-26 01:43:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:15 -0500 |
commit | 6bea5bea4ccd4eb45b9cd4dd1e16538b14e2180e (patch) | |
tree | bd8c95a07360dcf1363cbf49a46db6304893fc63 /source4/auth/auth_util.c | |
parent | 9cafc0d07ed339b511abf0f6fd41c289d2815974 (diff) | |
download | samba-6bea5bea4ccd4eb45b9cd4dd1e16538b14e2180e.tar.gz samba-6bea5bea4ccd4eb45b9cd4dd1e16538b14e2180e.tar.bz2 samba-6bea5bea4ccd4eb45b9cd4dd1e16538b14e2180e.zip |
r2643: convert more of the auth subsyystem to the new talloc methods. This
also fixes a memory leak found with --leak-check.
(This used to be commit f19201ea274f0a542314c61c4af676197bf154ad)
Diffstat (limited to 'source4/auth/auth_util.c')
-rw-r--r-- | source4/auth/auth_util.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/source4/auth/auth_util.c b/source4/auth/auth_util.c index 3c77faefe1..ab725249c7 100644 --- a/source4/auth/auth_util.c +++ b/source4/auth/auth_util.c @@ -402,15 +402,12 @@ NTSTATUS create_nt_user_token(TALLOC_CTX *mem_ctx, NTSTATUS make_server_info(struct auth_serversupplied_info **server_info, const char *username) { - TALLOC_CTX *mem_ctx = talloc_init("auth subsystem: server_info for %s", username); - *server_info = talloc_p(mem_ctx, struct auth_serversupplied_info); + *server_info = talloc_p(NULL, struct auth_serversupplied_info); if (!*server_info) { DEBUG(0,("make_server_info: malloc failed!\n")); - talloc_destroy(mem_ctx); return NT_STATUS_NO_MEMORY; } ZERO_STRUCTP(*server_info); - (*server_info)->mem_ctx = mem_ctx; return NT_STATUS_OK; } @@ -431,8 +428,8 @@ NTSTATUS make_server_info_guest(struct auth_serversupplied_info **server_info) (*server_info)->guest = True; - (*server_info)->user_sid = dom_sid_parse_talloc((*server_info)->mem_ctx, SID_ANONYMOUS); - (*server_info)->primary_group_sid = dom_sid_parse_talloc((*server_info)->mem_ctx, SID_BUILTIN_GUESTS); + (*server_info)->user_sid = dom_sid_parse_talloc((*server_info), SID_ANONYMOUS); + (*server_info)->primary_group_sid = dom_sid_parse_talloc((*server_info), SID_BUILTIN_GUESTS); (*server_info)->n_domain_groups = 0; (*server_info)->domain_groups = NULL; @@ -495,8 +492,8 @@ void free_user_info(struct auth_usersupplied_info **user_info) void free_server_info(struct auth_serversupplied_info **server_info) { DEBUG(5,("attempting to free a server_info structure\n")); - if (!*server_info) { - talloc_destroy((*server_info)->mem_ctx); + if (*server_info) { + talloc_free(*server_info); } *server_info = NULL; } @@ -530,15 +527,12 @@ NTSTATUS make_session_info(struct auth_serversupplied_info *server_info, { NTSTATUS nt_status; - *session_info = talloc_p(server_info->mem_ctx, struct auth_session_info); + *session_info = talloc_p(server_info, struct auth_session_info); if (!*session_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 */ (*session_info)->server_info = server_info; /* unless set otherwise, the session key is the user session @@ -546,7 +540,7 @@ NTSTATUS make_session_info(struct auth_serversupplied_info *server_info, (*session_info)->session_key = server_info->user_session_key; - nt_status = create_nt_user_token((*session_info)->mem_ctx, + nt_status = create_nt_user_token((*session_info), server_info->user_sid, server_info->primary_group_sid, server_info->n_domain_groups, @@ -567,7 +561,7 @@ void free_session_info(struct auth_session_info **session_info) if (*session_info) { (*session_info)->refcount--; if ((*session_info)->refcount <= 0) { - talloc_destroy((*session_info)->mem_ctx); + talloc_free((*session_info)); } } *session_info = NULL; |