The branch, master has been updated
       via  92a0a56 vfs:glusterfs: preallocate result for glfs_realpath
       via  b9436f5 s3:util_cmdline: make struct user_auth_info private to 
util_cmdline.c
       via  30013ef s3:libsmb: make use of proper allocated struct 
user_auth_info in SMBC_opendir_ctx()
       via  87c3ff0 s3:libsmb: make use of get_cmdline_auth_info_* helper 
functions in get_ipc_connect()
       via  5cb394a s3:lib/netapi: make use of 
set_cmdline_auth_info_signing_state_raw()
       via  a0792eb s3:util_cmdline: add 
set_cmdline_auth_info_signing_state_raw() helper function
      from  ad60b8c s3: selftest: Add test for orphan 'lost-XXX' directories in 
streams_depot.

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


- Log -----------------------------------------------------------------
commit 92a0a56c3852726e0812d260e043957c879aefa4
Author: Michael Adam <ob...@samba.org>
Date:   Fri Oct 21 00:15:06 2016 +0200

    vfs:glusterfs: preallocate result for glfs_realpath
    
    This makes us independent of the allocation
    method used inside glfs_realpath.
    
    Signed-off-by: Michael Adam <ob...@samba.org>
    Reviewed-by: Ira Cooper <i...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Sat Oct 22 00:28:41 CEST 2016 on sn-devel-144

commit b9436f5348213cc2a1b7fd670854bed4e21c5ea9
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Oct 21 10:23:21 2016 +0200

    s3:util_cmdline: make struct user_auth_info private to util_cmdline.c
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 30013efe39a736af6cc0143158c90401925ba48e
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Oct 21 10:17:59 2016 +0200

    s3:libsmb: make use of proper allocated struct user_auth_info in 
SMBC_opendir_ctx()
    
    We should avoid to dereference struct user_auth_info.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 87c3ff0f3bc2d7d162107ae65ec81ade36be6c66
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Oct 21 10:17:59 2016 +0200

    s3:libsmb: make use of get_cmdline_auth_info_* helper functions in 
get_ipc_connect()
    
    We should avoid to dereference struct user_auth_info.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 5cb394a288722e8135ffad46e65725a3a6cfb2d9
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Oct 21 10:17:04 2016 +0200

    s3:lib/netapi: make use of set_cmdline_auth_info_signing_state_raw()
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit a0792eba6c474f11ec8307c00d4e39ebf81e25da
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Oct 21 10:16:26 2016 +0200

    s3:util_cmdline: add set_cmdline_auth_info_signing_state_raw() helper 
function
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

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

Summary of changes:
 source3/include/auth_info.h     | 16 +++-------------
 source3/lib/netapi/cm.c         |  2 +-
 source3/lib/util_cmdline.c      | 20 ++++++++++++++++++++
 source3/libsmb/cliconnect.c     |  6 +++---
 source3/libsmb/libsmb_dir.c     | 17 ++++++-----------
 source3/modules/vfs_glusterfs.c | 15 ++++++++++++++-
 6 files changed, 47 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/auth_info.h b/source3/include/auth_info.h
index d8d8317..04ac422 100644
--- a/source3/include/auth_info.h
+++ b/source3/include/auth_info.h
@@ -20,19 +20,7 @@
 #ifndef _AUTH_INFO_H
 #define _AUTH_INFO_H
 
-struct user_auth_info {
-       char *username;
-       char *domain;
-       char *password;
-       bool got_pass;
-       bool use_kerberos;
-       int signing_state;
-       bool smb_encrypt;
-       bool use_machine_account;
-       bool fallback_after_kerberos;
-       bool use_ccache;
-       bool use_pw_nt_hash;
-};
+struct user_auth_info;
 
 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
 const char *get_cmdline_auth_info_username(const struct user_auth_info 
*auth_info);
@@ -46,6 +34,8 @@ void set_cmdline_auth_info_password(struct user_auth_info 
*auth_info,
 const char *get_cmdline_auth_info_password(const struct user_auth_info 
*auth_info);
 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
                                         const char *arg);
+void set_cmdline_auth_info_signing_state_raw(struct user_auth_info *auth_info,
+                                            int signing_state);
 int get_cmdline_auth_info_signing_state(const struct user_auth_info 
*auth_info);
 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
                                      bool b);
diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c
index 7e16b4d..2649422 100644
--- a/source3/lib/netapi/cm.c
+++ b/source3/lib/netapi/cm.c
@@ -88,7 +88,7 @@ static WERROR libnetapi_open_ipc_connection(struct 
libnetapi_ctx *ctx,
        if (!auth_info) {
                return WERR_NOT_ENOUGH_MEMORY;
        }
-       auth_info->signing_state = SMB_SIGNING_IPC_DEFAULT;
+       set_cmdline_auth_info_signing_state_raw(auth_info, 
SMB_SIGNING_IPC_DEFAULT);
        set_cmdline_auth_info_use_kerberos(auth_info, ctx->use_kerberos);
        set_cmdline_auth_info_username(auth_info, ctx->username);
        if (ctx->password) {
diff --git a/source3/lib/util_cmdline.c b/source3/lib/util_cmdline.c
index 3ef1d09..68ba7aa 100644
--- a/source3/lib/util_cmdline.c
+++ b/source3/lib/util_cmdline.c
@@ -30,6 +30,20 @@
   Used mainly in client tools.
 ****************************************************************************/
 
+struct user_auth_info {
+       char *username;
+       char *domain;
+       char *password;
+       bool got_pass;
+       bool use_kerberos;
+       int signing_state;
+       bool smb_encrypt;
+       bool use_machine_account;
+       bool fallback_after_kerberos;
+       bool use_ccache;
+       bool use_pw_nt_hash;
+};
+
 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx)
 {
        struct user_auth_info *result;
@@ -162,6 +176,12 @@ bool set_cmdline_auth_info_signing_state(struct 
user_auth_info *auth_info,
        return true;
 }
 
+void set_cmdline_auth_info_signing_state_raw(struct user_auth_info *auth_info,
+                                            int signing_state)
+{
+       auth_info->signing_state = signing_state;
+}
+
 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info)
 {
        return auth_info->signing_state;
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index e6deb9d..e15f676 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -3673,14 +3673,14 @@ struct cli_state *get_ipc_connect(char *server,
        NTSTATUS nt_status;
        uint32_t flags = CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK;
 
-       if (user_info->use_kerberos) {
+       if (get_cmdline_auth_info_use_kerberos(user_info)) {
                flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
        }
 
        nt_status = cli_full_connection(&cli, NULL, server, server_ss, 0, 
"IPC$", "IPC", 
-                                       user_info->username ? 
user_info->username : "",
+                                       
get_cmdline_auth_info_username(user_info),
                                        lp_workgroup(),
-                                       user_info->password ? 
user_info->password : "",
+                                       
get_cmdline_auth_info_password(user_info),
                                        flags,
                                        SMB_SIGNING_DEFAULT);
 
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 714a97c..dd37a24 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -464,7 +464,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
                 int max_lmb_count;
                 struct sockaddr_storage *ip_list;
                 struct sockaddr_storage server_addr;
-                struct user_auth_info u_info;
+                struct user_auth_info *u_info;
                NTSTATUS status;
 
                if (share[0] != (char)0 || path[0] != (char)0) {
@@ -483,17 +483,12 @@ SMBC_opendir_ctx(SMBCCTX *context,
                                  ? INT_MAX
                                  : smbc_getOptionBrowseMaxLmbCount(context));
 
-               memset(&u_info, '\0', sizeof(u_info));
-               u_info.username = talloc_strdup(frame,user);
-               u_info.password = talloc_strdup(frame,password);
-               if (!u_info.username || !u_info.password) {
-                       if (dir) {
-                               SAFE_FREE(dir->fname);
-                               SAFE_FREE(dir);
-                       }
-                       TALLOC_FREE(frame);
+               u_info = user_auth_info_init(frame);
+               if (u_info == NULL) {
                        return NULL;
                }
+               set_cmdline_auth_info_username(u_info, user);
+               set_cmdline_auth_info_password(u_info, password);
 
                /*
                  * We have server and share and path empty but options
@@ -550,7 +545,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
 
                         cli = get_ipc_connect_master_ip(talloc_tos(),
                                                        &ip_list[i],
-                                                        &u_info,
+                                                        u_info,
                                                        &wg_ptr);
                        /* cli == NULL is the master browser refused to talk or
                           could not be found */
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 3e15ce6..1c9be2d 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -1140,7 +1140,20 @@ static int vfs_gluster_fallocate(struct 
vfs_handle_struct *handle,
 static char *vfs_gluster_realpath(struct vfs_handle_struct *handle,
                                  const char *path)
 {
-       return glfs_realpath(handle->data, path, 0);
+       char *result = NULL;
+       char *resolved_path = SMB_MALLOC_ARRAY(char, PATH_MAX+1);
+
+       if (resolved_path == NULL) {
+               errno = ENOMEM;
+               return NULL;
+       }
+
+       result = glfs_realpath(handle->data, path, resolved_path);
+       if (result == NULL) {
+               SAFE_FREE(resolved_path);
+       }
+
+       return result;
 }
 
 static bool vfs_gluster_lock(struct vfs_handle_struct *handle,


-- 
Samba Shared Repository

Reply via email to