r7542: Patch from Renaud Duhaut <rd@duhaut.com> for a parameter
authorJeremy Allison <jra@samba.org>
Mon, 13 Jun 2005 17:41:52 +0000 (17:41 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:57:12 +0000 (10:57 -0500)
"directory_mode" when creating recycle directories.
Bug #1040.
Jeremy.
(This used to be commit 1c94cbd72d93ff8f17d6e1971ff984fa9581f1ce)

source3/modules/vfs_recycle.c

index 5ff7931c585fe8893733f5a23c02fb159bed052e..6a9914131d74f704fd6391a2f068d72031e6edc4 100644 (file)
@@ -153,6 +153,23 @@ static int recycle_maxsize(vfs_handle_struct *handle)
        return maxsize;
 }
 
+static mode_t recycle_directory_mode(vfs_handle_struct *handle)
+{
+       mode_t dirmode;
+       const char *buff;
+
+       buff = lp_parm_const_string(SNUM(handle->conn), "recycle", "directory_mode", NULL);
+
+       if (buff != NULL ) {
+               sscanf(buff, "%o", (int *)&dirmode);
+       } else {
+               dirmode=S_IRUSR | S_IWUSR | S_IXUSR;
+       }
+
+       DEBUG(10, ("recycle: directory_mode = %o\n", dirmode));
+       return dirmode;
+}
+
 static BOOL recycle_directory_exist(vfs_handle_struct *handle, const char *dname)
 {
        SMB_STRUCT_STAT st;
@@ -213,7 +230,7 @@ static BOOL recycle_create_dir(vfs_handle_struct *handle, const char *dname)
        char *tok_str;
        BOOL ret = False;
 
-       mode = S_IRUSR | S_IWUSR | S_IXUSR;
+       mode = recycle_directory_mode(handle);
 
        tmp_str = SMB_STRDUP(dname);
        ALLOC_CHECK(tmp_str, done);