[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Apr 9 16:13:03 MDT 2013


The branch, master has been updated
       via  69b3d19 vfs_fake_perms: Fix bug 9775, segfault for "artificial" conn_structs
       via  ce2fb2d vfs_fake_perms: Slightly streamline code
       via  60c2953 vfs_fake_perms: Slightly streamline code
      from  a308db6 s3-netlogon: enumerate UPN suffixes from PASSDB when available

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


- Log -----------------------------------------------------------------
commit 69b3d1944501f65427fbd12e4ddd3b66e67deedd
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 9 21:18:34 2013 +0200

    vfs_fake_perms: Fix bug 9775, segfault for "artificial" conn_structs
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Apr 10 00:12:06 CEST 2013 on sn-devel-104

commit ce2fb2d019b6f8304b81e2d4d68bdac31edcf025
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 9 21:07:23 2013 +0200

    vfs_fake_perms: Slightly streamline code
    
    Don't initialize a variable directly set
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 60c2953a9d5fa12494a8a767c30913398affe453
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 9 21:07:23 2013 +0200

    vfs_fake_perms: Slightly streamline code
    
    Do an early error return
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 source3/modules/vfs_fake_perms.c |   66 +++++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_fake_perms.c b/source3/modules/vfs_fake_perms.c
index 4cda7ea..8eb6e3c 100644
--- a/source3/modules/vfs_fake_perms.c
+++ b/source3/modules/vfs_fake_perms.c
@@ -32,17 +32,32 @@
 static int fake_perms_stat(vfs_handle_struct *handle,
 			   struct smb_filename *smb_fname)
 {
-	int ret = -1;
+	int ret;
 
 	ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
-	if (ret == 0) {
-		if (S_ISDIR(smb_fname->st.st_ex_mode)) {
-			smb_fname->st.st_ex_mode = S_IFDIR | S_IRWXU;
-		} else {
-			smb_fname->st.st_ex_mode = S_IRWXU;
-		}
-		smb_fname->st.st_ex_uid = handle->conn->session_info->unix_token->uid;
-		smb_fname->st.st_ex_gid = handle->conn->session_info->unix_token->gid;
+	if (ret != 0) {
+		return ret;
+	}
+
+	if (S_ISDIR(smb_fname->st.st_ex_mode)) {
+		smb_fname->st.st_ex_mode = S_IFDIR | S_IRWXU;
+	} else {
+		smb_fname->st.st_ex_mode = S_IRWXU;
+	}
+
+	if (handle->conn->session_info != NULL) {
+		struct security_unix_token *utok;
+
+		utok = handle->conn->session_info->unix_token;
+		smb_fname->st.st_ex_uid = utok->uid;
+		smb_fname->st.st_ex_gid = utok->gid;
+	} else {
+		/*
+		 * We have an artificial connection for dfs for example. It
+		 * sucks, but the current uid/gid is the best we have.
+		 */
+		smb_fname->st.st_ex_uid = geteuid();
+		smb_fname->st.st_ex_gid = getegid();
 	}
 
 	return ret;
@@ -50,18 +65,33 @@ static int fake_perms_stat(vfs_handle_struct *handle,
 
 static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
-	int ret = -1;
+	int ret;
 
 	ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
-	if (ret == 0) {
-		if (S_ISDIR(sbuf->st_ex_mode)) {
-			sbuf->st_ex_mode = S_IFDIR | S_IRWXU;
-		} else {
-			sbuf->st_ex_mode = S_IRWXU;
-		}
-		sbuf->st_ex_uid = handle->conn->session_info->unix_token->uid;
-		sbuf->st_ex_gid = handle->conn->session_info->unix_token->gid;
+	if (ret != 0) {
+		return ret;
 	}
+
+	if (S_ISDIR(sbuf->st_ex_mode)) {
+		sbuf->st_ex_mode = S_IFDIR | S_IRWXU;
+	} else {
+		sbuf->st_ex_mode = S_IRWXU;
+	}
+	if (handle->conn->session_info != NULL) {
+		struct security_unix_token *utok;
+
+		utok = handle->conn->session_info->unix_token;
+		sbuf->st_ex_uid = utok->uid;
+		sbuf->st_ex_gid = utok->gid;
+	} else {
+		/*
+		 * We have an artificial connection for dfs for example. It
+		 * sucks, but the current uid/gid is the best we have.
+		 */
+		sbuf->st_ex_uid = geteuid();
+		sbuf->st_ex_gid = getegid();
+	}
+
 	return ret;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list