Bug 2978 - I made a patch of recycle box
I made a patch of recycle box
Status: NEW
Product: Samba 3.0
Classification: Unclassified
Component: Upgrade
3.0.14a
All All
: P3 normal
: none
Assigned To: Samba Bugzilla Account
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-11 06:09 UTC by Reinin Oyama
Modified: 2007-01-26 16:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Reinin Oyama 2005-08-11 06:09:14 UTC
Samba3.X.X's vfs recycle is very incovenient!
Because .recycle directory mode:0700 cannot change. 
And can use .recycle box only one user.
This is a BUG of specification!
So I made a patch to add smb.conf's option,
recycle:mkdirmode = XXXX
If XXXX is 0770, same group member can share .recycle box.
To apply this patch, In samaba-3.X.X/source directory and do
patch -p0 < patchfilename.
The patch is following.

--- modules/vfs_recycle.c.org	2005-08-11 18:14:55.160258671 +0900
+++ modules/vfs_recycle.c	2005-08-11 18:14:10.636702067 +0900
@@ -29,6 +29,8 @@
 
 static int vfs_recycle_debug_level = DBGC_VFS;
 
+static mode_t mkdirmode;
+
 #undef DBGC_CLASS
 #define DBGC_CLASS vfs_recycle_debug_level
  
@@ -179,6 +181,23 @@
 	return False;
 }
 
+#define MAXMODESTR 8
+static void recycle_mkdirmode(vfs_handle_struct *handle)
+{
+	char modestr[MAXMODESTR];
+	const char *tmp_str = NULL;
+	unsigned int tmp_int;
+
+	snprintf(modestr,MAXMODESTR,"%o",S_IRUSR|S_IWUSR|S_IXUSR);
+	tmp_str = lp_parm_const_string(SNUM(handle->conn), "recycle", "mkdirmode",
modestr);
+	sscanf(tmp_str,"%o",&tmp_int);
+	mkdirmode = (mode_t) tmp_int;
+
+	DEBUG(10, ("recycle: mkdirmode = %d\n", mkdirmode));
+
+	return;
+}
+
 /**
  * Return file size
  * @param conn connection
@@ -206,14 +225,12 @@
 static BOOL recycle_create_dir(vfs_handle_struct *handle, const char *dname)
 {
 	int len;
-	mode_t mode;
 	char *new_dir = NULL;
 	char *tmp_str = NULL;
 	char *token;
 	char *tok_str;
 	BOOL ret = False;
 
-	mode = S_IRUSR | S_IWUSR | S_IXUSR;
 
 	tmp_str = SMB_STRDUP(dname);
 	ALLOC_CHECK(tmp_str, done);
@@ -231,7 +248,7 @@
 			DEBUG(10, ("recycle: dir %s already exists\n", new_dir));
 		else {
 			DEBUG(5, ("recycle: creating new dir %s\n", new_dir));
-			if (SMB_VFS_NEXT_MKDIR(handle, handle->conn, new_dir, mode) != 0) {
+			if (SMB_VFS_NEXT_MKDIR(handle, handle->conn, new_dir, mkdirmode) != 0) {
 				DEBUG(1,("recycle: mkdir failed for %s with error: %s\n", new_dir,
strerror(errno)));
 				ret = False;
 				goto done;
@@ -373,6 +390,9 @@
 		goto done;
 	}
 
+	/* add mkdir mode */
+	recycle_mkdirmode(handle);
+
 	/* FIXME: this is wrong: moving files with rename does not change the disk space
 	 * allocation
 	 *
Comment 1 Renaud Duhaut 2007-01-26 16:12:47 UTC
This feature is present since samba 3.0.20 (see https://bugzilla.samba.org/show_bug.cgi?id=1040)
Have a nice day.