The branch, master has been updated
       via  f777ca3 Bug 11818 : obvious missing word When trying to demote a 
dc, 'remove_dc.remove_sysvol_references' is sent 'remote_samdb, dc_name' , it 
expects 'remote_samdb, logger, dc_name'
       via  16ef497 vfs_gpfs: Remove xattr functions
       via  f20aed5 vfs_gpfs: Implement new dos_attributes vfs functions
       via  6a2d97b gpfswrap: Add wrapper for gpfs_set_winattrs
      from  02f4808 ctdb-killtcp: Change default retry interval, batch size and 
attempts

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


- Log -----------------------------------------------------------------
commit f777ca33c677cc6a7f4e52606b83c5002e3e6b71
Author: Rowland Penny <rpe...@samba.org>
Date:   Thu Mar 31 13:24:28 2016 +0100

    Bug 11818 : obvious missing word When trying to demote a dc, 
'remove_dc.remove_sysvol_references' is sent 'remote_samdb, dc_name' , it 
expects 'remote_samdb, logger, dc_name'
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11818
    
    Signed-off-by: Rowland Penny <rpe...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Fri Apr  1 22:54:22 CEST 2016 on sn-devel-144

commit 16ef4973660e15aa3f03057e56557477ece82c09
Author: Christof Schmitt <c...@samba.org>
Date:   Tue Mar 22 22:43:49 2016 -0700

    vfs_gpfs: Remove xattr functions
    
    The xattr functions intercepted only the calls from dosmode. With the
    implementation of the dos_attribute interface, the xattr codepaths never
    get called and can be removed.
    
    Signed-off-by: Christof Schmitt <c...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit f20aed5c17769c09bb3ecce59628ecac7b337b0c
Author: Christof Schmitt <c...@samba.org>
Date:   Tue Mar 22 22:39:11 2016 -0700

    vfs_gpfs: Implement new dos_attributes vfs functions
    
    Signed-off-by: Christof Schmitt <c...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 6a2d97b361ac2e8c31ee643f0e82a86cffcd67bc
Author: Christof Schmitt <c...@samba.org>
Date:   Tue Mar 22 22:38:11 2016 -0700

    gpfswrap: Add wrapper for gpfs_set_winattrs
    
    Signed-off-by: Christof Schmitt <c...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

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

Summary of changes:
 lib/util/gpfswrap.c           |  13 +++
 lib/util/gpfswrap.h           |   1 +
 python/samba/netcmd/domain.py |   2 +-
 source3/modules/vfs_gpfs.c    | 266 +++++++++++++++++++++++-------------------
 4 files changed, 160 insertions(+), 122 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/gpfswrap.c b/lib/util/gpfswrap.c
index 4c74105..0632ee2 100644
--- a/lib/util/gpfswrap.c
+++ b/lib/util/gpfswrap.c
@@ -29,6 +29,8 @@ static int (*gpfs_get_realfilename_path_fn)(char *pathname, 
char *filenamep,
                                            int *len);
 static int (*gpfs_set_winattrs_path_fn)(char *pathname, int flags,
                                        struct gpfs_winattr *attrs);
+static int (*gpfs_set_winattrs_fn)(int fd, int flags,
+                                  struct gpfs_winattr *attrs);
 static int (*gpfs_get_winattrs_path_fn)(char *pathname,
                                        struct gpfs_winattr *attrs);
 static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs);
@@ -63,6 +65,7 @@ int gpfswrap_init(void)
        gpfs_putacl_fn                = dlsym(l, "gpfs_putacl");
        gpfs_get_realfilename_path_fn = dlsym(l, "gpfs_get_realfilename_path");
        gpfs_set_winattrs_path_fn     = dlsym(l, "gpfs_set_winattrs_path");
+       gpfs_set_winattrs_fn          = dlsym(l, "gpfs_set_winattrs");
        gpfs_get_winattrs_path_fn     = dlsym(l, "gpfs_get_winattrs_path");
        gpfs_get_winattrs_fn          = dlsym(l, "gpfs_get_winattrs");
        gpfs_prealloc_fn              = dlsym(l, "gpfs_prealloc");
@@ -140,6 +143,16 @@ int gpfswrap_set_winattrs_path(char *pathname, int flags,
        return gpfs_set_winattrs_path_fn(pathname, flags, attrs);
 }
 
+int gpfswrap_set_winattrs(int fd, int flags, struct gpfs_winattr *attrs)
+{
+       if (gpfs_set_winattrs_fn == NULL) {
+               errno = ENOSYS;
+               return -1;
+       }
+
+       return gpfs_set_winattrs_fn(fd, flags, attrs);
+}
+
 int gpfswrap_get_winattrs_path(char *pathname, struct gpfs_winattr *attrs)
 {
        if (gpfs_get_winattrs_path_fn == NULL) {
diff --git a/lib/util/gpfswrap.h b/lib/util/gpfswrap.h
index 25b1ba8..1c9c64f 100644
--- a/lib/util/gpfswrap.h
+++ b/lib/util/gpfswrap.h
@@ -34,6 +34,7 @@ int gpfswrap_putacl(char *pathname, int flags, void *acl);
 int gpfswrap_get_realfilename_path(char *pathname, char *filenamep, int *len);
 int gpfswrap_set_winattrs_path(char *pathname, int flags,
                               struct gpfs_winattr *attrs);
+int gpfswrap_set_winattrs(int fd, int flags, struct gpfs_winattr *attrs);
 int gpfswrap_get_winattrs_path(char *pathname, struct gpfs_winattr *attrs);
 int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs);
 int gpfswrap_prealloc(int fd, gpfs_off64_t start, gpfs_off64_t bytes);
diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index 6357144..68775ec 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -940,7 +940,7 @@ class cmd_domain_demote(Command):
             else:
                 raise CommandError("Error while sending a removeDsServer of 
%s: " % server_dsa_dn, e)
 
-        remove_dc.remove_sysvol_references(remote_samdb, dc_name)
+        remove_dc.remove_sysvol_references(remote_samdb, logger, dc_name)
 
         # These are objects under the computer account that should be deleted
         for s in ("CN=Enterprise,CN=NTFRS Subscriptions",
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 04d89f4..42a3c72 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -22,7 +22,6 @@
 
 #include "includes.h"
 #include "smbd/smbd.h"
-#include "librpc/gen_ndr/ndr_xattr.h"
 #include "include/smbprofile.h"
 #include "modules/non_posix_acls.h"
 #include "libcli/security/security.h"
@@ -1449,161 +1448,184 @@ static int vfs_gpfs_fchmod(vfs_handle_struct *handle, 
files_struct *fsp, mode_t
                 return rc;
 }
 
-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;
-        unsigned int dosmode=0;
-        struct gpfs_winattr attrs;
-        int ret = 0;
+static uint32_t vfs_gpfs_winattrs_to_dosmode(unsigned int winattrs)
+{
+       uint32_t dosmode = 0;
+
+       if (winattrs & GPFS_WINATTR_ARCHIVE){
+               dosmode |= FILE_ATTRIBUTE_ARCHIVE;
+       }
+       if (winattrs & GPFS_WINATTR_HIDDEN){
+               dosmode |= FILE_ATTRIBUTE_HIDDEN;
+       }
+       if (winattrs & GPFS_WINATTR_SYSTEM){
+               dosmode |= FILE_ATTRIBUTE_SYSTEM;
+       }
+       if (winattrs & GPFS_WINATTR_READONLY){
+               dosmode |= FILE_ATTRIBUTE_READONLY;
+       }
+       if (winattrs & GPFS_WINATTR_SPARSE_FILE) {
+               dosmode |= FILE_ATTRIBUTE_SPARSE;
+       }
+
+       return dosmode;
+}
+
+static unsigned int vfs_gpfs_dosmode_to_winattrs(uint32_t dosmode)
+{
+       unsigned int winattrs = 0;
+
+       if (dosmode & FILE_ATTRIBUTE_ARCHIVE){
+               winattrs |= GPFS_WINATTR_ARCHIVE;
+       }
+       if (dosmode & FILE_ATTRIBUTE_HIDDEN){
+               winattrs |= GPFS_WINATTR_HIDDEN;
+       }
+       if (dosmode & FILE_ATTRIBUTE_SYSTEM){
+               winattrs |= GPFS_WINATTR_SYSTEM;
+       }
+       if (dosmode & FILE_ATTRIBUTE_READONLY){
+               winattrs |= GPFS_WINATTR_READONLY;
+       }
+       if (dosmode & FILE_ATTRIBUTE_SPARSE) {
+               winattrs |= GPFS_WINATTR_SPARSE_FILE;
+       }
+
+       return winattrs;
+}
+
+static NTSTATUS vfs_gpfs_get_dos_attributes(struct vfs_handle_struct *handle,
+                                           struct smb_filename *smb_fname,
+                                           uint32_t *dosmode)
+{
        struct gpfs_config_data *config;
+       struct gpfs_winattr attrs = { };
+       int ret;
 
        SMB_VFS_HANDLE_GET_DATA(handle, config,
                                struct gpfs_config_data,
-                               return -1);
+                               return NT_STATUS_INTERNAL_ERROR);
 
        if (!config->winattr) {
-               DEBUG(10, ("gpfs_set_xattr:name is %s -> next\n",name));
-               return SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags);
+               return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
+                                                      smb_fname, dosmode);
        }
 
-        DEBUG(10, ("gpfs_set_xattr: %s \n",path));
-
-        /* Only handle DOS Attributes */
-        if (strcmp(name,SAMBA_XATTR_DOS_ATTRIB) != 0){
-               DEBUG(5, ("gpfs_set_xattr:name is %s\n",name));
-               return SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags);
-        }
+       ret = gpfswrap_get_winattrs_path(smb_fname->base_name, &attrs);
+       if (ret == -1 && errno == ENOSYS) {
+               return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, smb_fname,
+                                                      dosmode);
+       }
 
-       blob.data = discard_const_p(uint8_t, value);
-       blob.length = size;
+       if (ret == -1) {
+               DBG_WARNING("Getting winattrs failed for %s: %s\n",
+                           smb_fname->base_name, strerror(errno));
+               return map_nt_error_from_unix(errno);
+       }
 
-       ndr_err = ndr_pull_struct_blob(&blob, talloc_tos(), &dosattrib,
-                       (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB);
+       *dosmode |= vfs_gpfs_winattrs_to_dosmode(attrs.winAttrs);
 
-       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;
-       }
+       return NT_STATUS_OK;
+}
 
-       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;
-       }
+static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle,
+                                            struct files_struct *fsp,
+                                            uint32_t *dosmode)
+{
+       struct gpfs_config_data *config;
+       struct gpfs_winattr attrs = { };
+       int ret;
 
-       dosmode = dosattrib.info.info3.attrib;
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return NT_STATUS_INTERNAL_ERROR);
 
-        attrs.winAttrs = 0;
-        /*Just map RD_ONLY, ARCHIVE, SYSTEM HIDDEN and SPARSE. Ignore the 
others*/
-        if (dosmode & FILE_ATTRIBUTE_ARCHIVE){
-                attrs.winAttrs |= GPFS_WINATTR_ARCHIVE;
-        }
-        if (dosmode & FILE_ATTRIBUTE_HIDDEN){
-                        attrs.winAttrs |= GPFS_WINATTR_HIDDEN;
-                }
-        if (dosmode & FILE_ATTRIBUTE_SYSTEM){
-                        attrs.winAttrs |= GPFS_WINATTR_SYSTEM;
-                }
-        if (dosmode & FILE_ATTRIBUTE_READONLY){
-                        attrs.winAttrs |= GPFS_WINATTR_READONLY;
-        }
-        if (dosmode & FILE_ATTRIBUTE_SPARSE) {
-               attrs.winAttrs |= GPFS_WINATTR_SPARSE_FILE;
+       if (!config->winattr) {
+               return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, dosmode);
        }
 
+       ret = gpfswrap_get_winattrs(fsp->fh->fd, &attrs);
+       if (ret == -1 && errno == ENOSYS) {
+               return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, dosmode);
+       }
 
-       ret = gpfswrap_set_winattrs_path(discard_const_p(char, path),
-                                        GPFS_WINATTR_SET_ATTRS, &attrs);
-        if ( ret == -1){
-               if (errno == ENOSYS) {
-                       return SMB_VFS_NEXT_SETXATTR(handle, path, name, value,
-                                                    size, flags);
-               }
+       if (ret == -1) {
+               DBG_WARNING("Getting winattrs failed for %s: %s\n",
+                           fsp->fsp_name->base_name, strerror(errno));
+               return map_nt_error_from_unix(errno);
+       }
 
-                DEBUG(1, ("gpfs_set_xattr:Set GPFS attributes failed 
%d\n",ret));
-                return -1;
-        }
+       *dosmode |= vfs_gpfs_winattrs_to_dosmode(attrs.winAttrs);
 
-        DEBUG(10, ("gpfs_set_xattr:Set attributes: 0x%x\n",attrs.winAttrs));
-        return 0;
+       return NT_STATUS_OK;
 }
 
-static ssize_t gpfs_get_xattr(struct vfs_handle_struct *handle,  const char 
*path,
-                              const char *name, void *value, size_t size){
-        char *attrstr = value;
-        unsigned int dosmode = 0;
-        struct gpfs_winattr attrs;
-        int ret = 0;
+static NTSTATUS vfs_gpfs_set_dos_attributes(struct vfs_handle_struct *handle,
+                                          const struct smb_filename *smb_fname,
+                                          uint32_t dosmode)
+{
        struct gpfs_config_data *config;
+       struct gpfs_winattr attrs = { };
+       int ret;
 
        SMB_VFS_HANDLE_GET_DATA(handle, config,
                                struct gpfs_config_data,
-                               return -1);
+                               return NT_STATUS_INTERNAL_ERROR);
 
        if (!config->winattr) {
-               DEBUG(10, ("gpfs_get_xattr:name is %s -> next\n",name));
-               return SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size);
+               return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
+                                                      smb_fname, dosmode);
        }
 
-        DEBUG(10, ("gpfs_get_xattr: %s \n",path));
+       attrs.winAttrs = vfs_gpfs_dosmode_to_winattrs(dosmode);
+       ret = gpfswrap_set_winattrs_path(smb_fname->base_name,
+                                        GPFS_WINATTR_SET_ATTRS, &attrs);
 
-        /* Only handle DOS Attributes */
-        if (strcmp(name,SAMBA_XATTR_DOS_ATTRIB) != 0){
-               DEBUG(5, ("gpfs_get_xattr:name is %s\n",name));
-                return SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size);
-        }
+       if (ret == -1 && errno == ENOSYS) {
+               return SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
+                                                      smb_fname, dosmode);
+       }
 
-       ret = gpfswrap_get_winattrs_path(discard_const_p(char, path), &attrs);
-        if ( ret == -1){
-               int dbg_lvl;
+       if (ret == -1) {
+               DBG_WARNING("Setting winattrs failed for %s: %s\n",
+                           smb_fname->base_name, strerror(errno));
+               return map_nt_error_from_unix(errno);
+       }
 
-               if (errno == ENOSYS) {
-                       return SMB_VFS_NEXT_GETXATTR(handle, path, name, value,
-                                                    size);
-               }
+       return NT_STATUS_OK;
+}
 
-               if (errno != EPERM && errno != EACCES) {
-                       dbg_lvl = 1;
-               } else {
-                       dbg_lvl = 5;
-               }
-               DEBUG(dbg_lvl, ("gpfs_get_xattr: Get GPFS attributes failed: "
-                             "%d (%s)\n", ret, strerror(errno)));
-                return -1;
-        }
+static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
+                                            struct files_struct *fsp,
+                                            uint32_t dosmode)
+{
+       struct gpfs_config_data *config;
+       struct gpfs_winattr attrs = { };
+       int ret;
 
-        DEBUG(10, ("gpfs_get_xattr:Got attributes: 0x%x\n",attrs.winAttrs));
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return NT_STATUS_INTERNAL_ERROR);
 
-        /*Just map RD_ONLY, ARCHIVE, SYSTEM, HIDDEN and SPARSE. Ignore the 
others*/
-        if (attrs.winAttrs & GPFS_WINATTR_ARCHIVE){
-                dosmode |= FILE_ATTRIBUTE_ARCHIVE;
-        }
-        if (attrs.winAttrs & GPFS_WINATTR_HIDDEN){
-                dosmode |= FILE_ATTRIBUTE_HIDDEN;
-        }
-        if (attrs.winAttrs & GPFS_WINATTR_SYSTEM){
-                dosmode |= FILE_ATTRIBUTE_SYSTEM;
-        }
-        if (attrs.winAttrs & GPFS_WINATTR_READONLY){
-                dosmode |= FILE_ATTRIBUTE_READONLY;
-        }
-        if (attrs.winAttrs & GPFS_WINATTR_SPARSE_FILE) {
-               dosmode |= FILE_ATTRIBUTE_SPARSE;
+       if (!config->winattr) {
+               return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle, fsp, dosmode);
+       }
+
+       attrs.winAttrs = vfs_gpfs_dosmode_to_winattrs(dosmode);
+       ret = gpfswrap_set_winattrs(fsp->fh->fd,
+                                   GPFS_WINATTR_SET_ATTRS, &attrs);
+
+       if (ret == -1 && errno == ENOSYS) {
+               return SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle, fsp, dosmode);
+       }
+
+       if (ret == -1) {
+               DBG_WARNING("Setting winattrs failed for %s: %s\n",
+                           fsp->fsp_name->base_name, strerror(errno));
+               return map_nt_error_from_unix(errno);
        }
 
-        snprintf(attrstr, size, "0x%2.2x",
-                (unsigned int)(dosmode & SAMBA_ATTRIBUTES_MASK));
-        DEBUG(10, ("gpfs_get_xattr: returning %s\n",attrstr));
-        return 4;
+       return NT_STATUS_OK;
 }
 
 #if defined(HAVE_FSTATAT)
@@ -2485,6 +2507,10 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
        .kernel_flock_fn = vfs_gpfs_kernel_flock,
        .linux_setlease_fn = vfs_gpfs_setlease,
        .get_real_filename_fn = vfs_gpfs_get_real_filename,
+       .get_dos_attributes_fn = vfs_gpfs_get_dos_attributes,
+       .fget_dos_attributes_fn = vfs_gpfs_fget_dos_attributes,
+       .set_dos_attributes_fn = vfs_gpfs_set_dos_attributes,
+       .fset_dos_attributes_fn = vfs_gpfs_fset_dos_attributes,
        .fget_nt_acl_fn = gpfsacl_fget_nt_acl,
        .get_nt_acl_fn = gpfsacl_get_nt_acl,
        .fset_nt_acl_fn = gpfsacl_fset_nt_acl,
@@ -2498,8 +2524,6 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
        .chmod_fn = vfs_gpfs_chmod,
        .fchmod_fn = vfs_gpfs_fchmod,
        .close_fn = vfs_gpfs_close,
-       .setxattr_fn = gpfs_set_xattr,
-       .getxattr_fn = gpfs_get_xattr,
        .stat_fn = vfs_gpfs_stat,
        .fstat_fn = vfs_gpfs_fstat,
        .lstat_fn = vfs_gpfs_lstat,


-- 
Samba Shared Repository

Reply via email to