diff options
author | Andreas Schneider <asn@samba.org> | 2018-02-13 12:09:12 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-02-20 21:55:13 +0100 |
commit | 7f47cec2343ca7658460cc14fa613fdd2611677a (patch) | |
tree | 3dcd8c21da3a093e43444b22c0039847120864cb /source3 | |
parent | b2aec11c76904bf6a8f67f0634cce5e443e77d8b (diff) | |
download | samba-7f47cec2343ca7658460cc14fa613fdd2611677a.tar.gz |
s3:auth: Pass mem_ctx to init_guest_session_info()
Use a mem_ctx which gets freed if possible.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/auth/auth_util.c | 9 | ||||
-rw-r--r-- | source3/auth/proto.h | 2 | ||||
-rw-r--r-- | source3/smbd/server.c | 2 | ||||
-rw-r--r-- | source3/torture/vfstest.c | 2 |
4 files changed, 10 insertions, 5 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 377d56d0488..c81432d277d 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -1136,12 +1136,17 @@ static struct auth_session_info *guest_info = NULL; static struct auth_serversupplied_info *guest_server_info = NULL; -bool init_guest_info(void) +bool init_guest_session_info(TALLOC_CTX *mem_ctx) { + NTSTATUS status; + if (guest_info != NULL) return true; - return NT_STATUS_IS_OK(make_new_session_info_guest(NULL, &guest_info, &guest_server_info)); + status = make_new_session_info_guest(mem_ctx, + &guest_info, + &guest_server_info); + return NT_STATUS_IS_OK(status); } NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx, diff --git a/source3/auth/proto.h b/source3/auth/proto.h index ca851c21d4b..6d6f789d8b6 100644 --- a/source3/auth/proto.h +++ b/source3/auth/proto.h @@ -240,7 +240,7 @@ NTSTATUS make_session_info_from_username(TALLOC_CTX *mem_ctx, struct auth_session_info **session_info); struct auth_session_info *copy_session_info(TALLOC_CTX *mem_ctx, const struct auth_session_info *src); -bool init_guest_info(void); +bool init_guest_session_info(TALLOC_CTX *mem_ctx); NTSTATUS init_system_session_info(void); bool session_info_set_session_key(struct auth_session_info *info, DATA_BLOB session_key); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 99baf9d519d..d80ea7311bd 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1991,7 +1991,7 @@ extern void build_options(bool screen); return -1; } - if (!init_guest_info()) { + if (!init_guest_session_info(NULL)) { DEBUG(0,("ERROR: failed to setup guest info.\n")); return -1; } diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index f156def4647..17c19012384 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -525,7 +525,7 @@ int main(int argc, const char *argv[]) /* some basic initialization stuff */ sec_init(); - init_guest_info(); + init_guest_session_info(frame); locking_init(); vfs = talloc_zero(NULL, struct vfs_state); if (vfs == NULL) { |