s3:auth: Pass mem_ctx to init_guest_session_info()
authorAndreas Schneider <asn@samba.org>
Tue, 13 Feb 2018 11:09:12 +0000 (12:09 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 20 Feb 2018 20:55:13 +0000 (21:55 +0100)
Use a mem_ctx which gets freed if possible.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/auth/auth_util.c
source3/auth/proto.h
source3/smbd/server.c
source3/torture/vfstest.c

index 377d56d048822fc02fed3a705a4aeb726f327b7f..c81432d277d67235a446d2ef78acfa8bb259e0de 100644 (file)
@@ -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,
index ca851c21d4b2e206afd7309c99f7765ead022ea8..6d6f789d8b676bcbe52355c2d7846deaf138b8f2 100644 (file)
@@ -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);
index 99baf9d519d40f2b3082571af99e71c5279fe42e..d80ea7311bd697b81fe8efab3c4db895b6cf8ed7 100644 (file)
@@ -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;
        }
index f156def46471dfd2760056d61a7af480e1f71640..17c19012384af3f3ea54346d397a2ed5f15bba4c 100644 (file)
@@ -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) {