The branch, v3-6-test has been updated
       via  70107fc vfs_fake_perms: Fix bug 9775, segfault for "artificial" 
conn_structs
      from  60a2fb5 Optimization suggested by Volker. Don't do a stat system 
call on normal read path.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 70107fc911570bbbc1cd613e9c594f5481e5685e
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Apr 9 21:43:28 2013 +0200

    vfs_fake_perms: Fix bug 9775, segfault for "artificial" conn_structs

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

Summary of changes:
 source3/modules/vfs_fake_perms.c |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_fake_perms.c b/source3/modules/vfs_fake_perms.c
index ade2407..9956a3d 100644
--- a/source3/modules/vfs_fake_perms.c
+++ b/source3/modules/vfs_fake_perms.c
@@ -29,6 +29,8 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
 
+extern struct current_user current_user;
+
 static int fake_perms_stat(vfs_handle_struct *handle,
                           struct smb_filename *smb_fname)
 {
@@ -41,8 +43,18 @@ static int fake_perms_stat(vfs_handle_struct *handle,
                } else {
                        smb_fname->st.st_ex_mode = S_IRWXU;
                }
-               smb_fname->st.st_ex_uid = handle->conn->session_info->utok.uid;
-               smb_fname->st.st_ex_gid = handle->conn->session_info->utok.gid;
+               if (handle->conn->session_info != NULL) {
+                       smb_fname->st.st_ex_uid =
+                               handle->conn->session_info->utok.uid;
+                       smb_fname->st.st_ex_gid =
+                               handle->conn->session_info->utok.gid;
+               } else {
+                       /*
+                        * Sucks, but current_user is the best we can do here.
+                        */
+                       smb_fname->st.st_ex_uid = current_user.ut.uid;
+                       smb_fname->st.st_ex_gid = current_user.ut.gid;
+               }
        }
 
        return ret;
@@ -59,8 +71,18 @@ static int fake_perms_fstat(vfs_handle_struct *handle, 
files_struct *fsp, SMB_ST
                } else {
                        sbuf->st_ex_mode = S_IRWXU;
                }
-               sbuf->st_ex_uid = handle->conn->session_info->utok.uid;
-               sbuf->st_ex_gid = handle->conn->session_info->utok.gid;
+               if (handle->conn->session_info != NULL) {
+                       sbuf->st_ex_uid =
+                               handle->conn->session_info->utok.uid;
+                       sbuf->st_ex_gid =
+                               handle->conn->session_info->utok.gid;
+               } else {
+                       /*
+                        * Sucks, but current_user is the best we can do here.
+                        */
+                       sbuf->st_ex_uid = current_user.ut.uid;
+                       sbuf->st_ex_gid = current_user.ut.gid;
+               }
        }
        return ret;
 }


-- 
Samba Shared Repository

Reply via email to