The branch, master has been updated
       via  6f9c6d3 s3:auth: Pass mem_ctx to init_system_session_info()
       via  7f47cec s3:auth: Pass mem_ctx to init_guest_session_info()
       via  b2aec11 s3:auth: Pass a mem_ctx to make_new_session_info_guest()
       via  9abe972 tldap: Dump unnecessary includes
      from  a6eac8f smbspool: Improve URI handling code

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6f9c6d369f4aa4a5c861f51041dd663e81e2ec4e
Author: Andreas Schneider <[email protected]>
Date:   Tue Feb 13 12:12:06 2018 +0100

    s3:auth: Pass mem_ctx to init_system_session_info()
    
    We have a stackframe we can use for the lifetime of the session.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Wed Feb 21 02:46:40 CET 2018 on sn-devel-144

commit 7f47cec2343ca7658460cc14fa613fdd2611677a
Author: Andreas Schneider <[email protected]>
Date:   Tue Feb 13 12:09:12 2018 +0100

    s3:auth: Pass mem_ctx to init_guest_session_info()
    
    Use a mem_ctx which gets freed if possible.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit b2aec11c76904bf6a8f67f0634cce5e443e77d8b
Author: Andreas Schneider <[email protected]>
Date:   Tue Feb 13 12:05:29 2018 +0100

    s3:auth: Pass a mem_ctx to make_new_session_info_guest()
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 9abe97285b7e1de25bf1c1f4fde8fd481a31a6bb
Author: Volker Lendecke <[email protected]>
Date:   Thu Feb 15 12:30:23 2018 +0100

    tldap: Dump unnecessary includes
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/auth/auth_util.c    | 36 +++++++++++++++++++++++-------------
 source3/auth/proto.h        |  4 ++--
 source3/lib/tldap_util.c    |  2 --
 source3/smbd/server.c       |  4 ++--
 source3/torture/vfstest.c   |  2 +-
 source3/winbindd/winbindd.c |  2 +-
 6 files changed, 29 insertions(+), 21 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index f543b33..4b20261 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -798,8 +798,12 @@ static NTSTATUS get_guest_info3(TALLOC_CTX *mem_ctx,
  left as-is for now.
 ***************************************************************************/
 
-static NTSTATUS make_new_session_info_guest(struct auth_session_info 
**session_info, struct auth_serversupplied_info **server_info)
+static NTSTATUS make_new_session_info_guest(TALLOC_CTX *mem_ctx,
+               struct auth_session_info **_session_info,
+               struct auth_serversupplied_info **_server_info)
 {
+       struct auth_session_info *session_info = NULL;
+       struct auth_serversupplied_info *server_info = NULL;
        const char *guest_account = lp_guest_account();
        const char *domain = lp_netbios_name();
        struct netr_SamInfo3 info3;
@@ -823,7 +827,7 @@ static NTSTATUS make_new_session_info_guest(struct 
auth_session_info **session_i
        status = make_server_info_info3(tmp_ctx,
                                        guest_account,
                                        domain,
-                                       server_info,
+                                       &server_info,
                                        &info3);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("make_server_info_info3 failed with %s\n",
@@ -831,25 +835,26 @@ static NTSTATUS make_new_session_info_guest(struct 
auth_session_info **session_i
                goto done;
        }
 
-       (*server_info)->guest = true;
+       server_info->guest = true;
 
        /* This should not be done here (we should produce a server
         * info, and later construct a session info from it), but for
         * now this does not change the previous behavior */
-       status = create_local_token(tmp_ctx, *server_info, NULL,
-                                   
(*server_info)->info3->base.account_name.string,
-                                   session_info);
+       status = create_local_token(tmp_ctx, server_info, NULL,
+                                   
server_info->info3->base.account_name.string,
+                                   &session_info);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("create_local_token failed: %s\n",
                          nt_errstr(status)));
                goto done;
        }
-       talloc_steal(NULL, *session_info);
-       talloc_steal(NULL, *server_info);
 
        /* annoying, but the Guest really does have a session key, and it is
           all zeros! */
-       (*session_info)->session_key = data_blob_talloc_zero(NULL, 16);
+       session_info->session_key = data_blob_talloc_zero(session_info, 16);
+
+       *_session_info = talloc_move(mem_ctx, &session_info);
+       *_server_info = talloc_move(mem_ctx, &server_info);
 
        status = NT_STATUS_OK;
 done:
@@ -1131,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(&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,
@@ -1159,12 +1169,12 @@ NTSTATUS make_session_info_guest(TALLOC_CTX *mem_ctx,
 
 static struct auth_session_info *system_info = NULL;
 
-NTSTATUS init_system_session_info(void)
+NTSTATUS init_system_session_info(TALLOC_CTX *mem_ctx)
 {
        if (system_info != NULL)
                return NT_STATUS_OK;
 
-       return make_new_session_info_system(NULL, &system_info);
+       return make_new_session_info_system(mem_ctx, &system_info);
 }
 
 NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx,
diff --git a/source3/auth/proto.h b/source3/auth/proto.h
index ca851c2..bdefeaf 100644
--- a/source3/auth/proto.h
+++ b/source3/auth/proto.h
@@ -240,8 +240,8 @@ 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);
-NTSTATUS init_system_session_info(void);
+bool init_guest_session_info(TALLOC_CTX *mem_ctx);
+NTSTATUS init_system_session_info(TALLOC_CTX *mem_ctx);
 bool session_info_set_session_key(struct auth_session_info *info,
                                 DATA_BLOB session_key);
 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c
index 89f812b..508c6c0 100644
--- a/source3/lib/tldap_util.c
+++ b/source3/lib/tldap_util.c
@@ -22,8 +22,6 @@
 #include "tldap_util.h"
 #include "../libcli/security/security.h"
 #include "../lib/util/asn1.h"
-#include "../librpc/ndr/libndr.h"
-#include "lib/util/base64.h"
 
 bool tldap_entry_values(struct tldap_message *msg, const char *attribute,
                        DATA_BLOB **values, int *num_values)
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 99baf9d..e7e297f 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1984,14 +1984,14 @@ extern void build_options(bool screen);
                exit_daemon("ERROR: failed to load share info db.", EACCES);
        }
 
-       status = init_system_session_info();
+       status = init_system_session_info(NULL);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("ERROR: failed to setup system user info: %s.\n",
                          nt_errstr(status)));
                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 f156def..17c1901 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) {
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 6e3df1f..9611f73 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1768,7 +1768,7 @@ int main(int argc, const char **argv)
                exit(1);
        }
 
-       status = init_system_session_info();
+       status = init_system_session_info(NULL);
        if (!NT_STATUS_IS_OK(status)) {
                exit_daemon("Winbindd failed to setup system user info", 
map_errno_from_nt_status(status));
        }


-- 
Samba Shared Repository

Reply via email to