vfs_catia: add chmod()
authorRalph Boehme <rb@sernet.de>
Mon, 10 Mar 2014 16:14:38 +0000 (17:14 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 11 Mar 2014 12:39:17 +0000 (13:39 +0100)
Clients using UNIX extensions need chmod() to go through catia.

Signed-off-by: Ralph Boehme <rb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Mar 11 13:39:17 CET 2014 on sn-devel-104

source3/modules/vfs_catia.c

index 1a37dd2363a882201c128a18f7d9e52977b1d2d6..6743dfe996a840848144807c06b992f1881a7087 100644 (file)
@@ -549,6 +549,25 @@ static int catia_lchown(vfs_handle_struct *handle,
        return ret;
 }
 
+static int catia_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+{
+       char *name = NULL;
+       NTSTATUS status;
+       int ret;
+
+       status = catia_string_replace_allocate(handle->conn, path,
+                                       &name, vfs_translate_to_unix);
+       if (!NT_STATUS_IS_OK(status)) {
+               errno = map_errno_from_nt_status(status);
+               return -1;
+       }
+
+       ret = SMB_VFS_NEXT_CHMOD(handle, name, mode);
+       TALLOC_FREE(name);
+
+       return ret;
+}
+
 static int catia_rmdir(vfs_handle_struct *handle,
                       const char *path)
 {
@@ -917,6 +936,7 @@ static struct vfs_fn_pointers vfs_catia_fns = {
        .unlink_fn = catia_unlink,
        .chown_fn = catia_chown,
        .lchown_fn = catia_lchown,
+       .chmod_fn = catia_chmod,
        .chdir_fn = catia_chdir,
        .ntimes_fn = catia_ntimes,
        .realpath_fn = catia_realpath,