[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Wed Oct 27 09:32:02 MDT 2010


The branch, master has been updated
       via  24ef932 s3: Make gpfs winattrs work again
      from  5bc2b8f s4-ldb: Added the correct extended check for read access to nTSecurityDescriptor

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


- Log -----------------------------------------------------------------
commit 24ef932a612d75c0e692bd1f17b44db3aba437eb
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 26 11:37:48 2010 -0600

    s3: Make gpfs winattrs work again
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Wed Oct 27 15:32:00 UTC 2010 on sn-devel-104

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

Summary of changes:
 source3/modules/vfs_gpfs.c |   38 +++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 8fbfbdf..694bde7 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -22,6 +22,7 @@
 */
 
 #include "includes.h"
+#include "librpc/gen_ndr/ndr_xattr.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
@@ -926,6 +927,9 @@ static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t
 
 static int gpfs_set_xattr(struct vfs_handle_struct *handle,  const char *path,
                            const char *name, const void *value, size_t size,  int flags){
+	struct xattr_DOSATTRIB dosattrib;
+        enum ndr_err_code ndr_err;
+        DATA_BLOB blob;
         const char *attrstr = value;
         unsigned int dosmode=0;
         struct gpfs_winattr attrs;
@@ -939,11 +943,31 @@ static int gpfs_set_xattr(struct vfs_handle_struct *handle,  const char *path,
 		return SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags);
         }
 
-        if (size < 2 || attrstr[0] != '0' || attrstr[1] != 'x' ||
-                                sscanf(attrstr, "%x", &dosmode) != 1) {
-                        DEBUG(1,("gpfs_set_xattr: Trying to set badly formed DOSATTRIB on file %s - %s\n", path, attrstr));
-                return False;
-        }
+	blob.data = (uint8_t *)attrstr;
+	blob.length = size;
+
+	ndr_err = ndr_pull_struct_blob(&blob, talloc_tos(), &dosattrib,
+			(ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB);
+
+	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+		DEBUG(1, ("gpfs_set_xattr: bad ndr decode "
+			  "from EA on file %s: Error = %s\n",
+			  path, ndr_errstr(ndr_err)));
+		return false;
+	}
+
+	if (dosattrib.version != 3) {
+		DEBUG(1, ("gpfs_set_xattr: expected dosattrib version 3, got "
+			  "%d\n", (int)dosattrib.version));
+		return false;
+	}
+	if (!(dosattrib.info.info3.valid_flags & XATTR_DOSINFO_ATTRIB)) {
+		DEBUG(10, ("gpfs_set_xattr: XATTR_DOSINFO_ATTRIB not "
+			   "valid, ignoring\n"));
+		return true;
+	}
+
+	dosmode = dosattrib.info.info3.attrib;
 
         attrs.winAttrs = 0;
         /*Just map RD_ONLY, ARCHIVE, SYSTEM and HIDDEN. Ignore the others*/
@@ -1009,9 +1033,9 @@ static ssize_t gpfs_get_xattr(struct vfs_handle_struct *handle,  const char *pat
                 dosmode |= FILE_ATTRIBUTE_READONLY;
         }
 
-        snprintf(attrstr, size, "0x%x", dosmode & SAMBA_ATTRIBUTES_MASK);
+        snprintf(attrstr, size, "0x%2.2x", dosmode & SAMBA_ATTRIBUTES_MASK);
         DEBUG(10, ("gpfs_get_xattr: returning %s\n",attrstr));
-        return size;
+        return 4;
 }
 
 static int vfs_gpfs_stat(struct vfs_handle_struct *handle,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list