[PATCH] vfs_catia: add chmod()

Ralph Böhme rb at sernet.de
Mon Mar 10 11:02:08 MDT 2014


Hi

attached is a small patch that adds chmod() to the catia VFS module.

Review appreciated. Thanks!
-Ralph

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de

**************************************************************
SerNet auf der CeBIT: 10. - 14. März 2014, Halle 6, Stand G10
Das Neueste rund um SAMBA, verinice, Firewalls und Linux!
Kostenlose Tickets anfordern per Mail an cebit at sernet.de.
**************************************************************
-------------- next part --------------
>From ded4acacd6bb34b24f8fd97dce8a7d47dcf8f151 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <rb at sernet.de>
Date: Mon, 10 Mar 2014 17:14:38 +0100
Subject: [PATCH 4/5] vfs_catia: add chmod()

Clients using UNIX extensions need chmod() to go through catia.

Signed-off-by: Ralph Boehme <rb at sernet.de>
---
 source3/modules/vfs_catia.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 1a37dd2..6743dfe 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -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,
-- 
1.8.5.3



More information about the samba-technical mailing list