summaryrefslogtreecommitdiff
path: root/examples/VFS
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-23 20:48:45 +0000
committerJeremy Allison <jra@samba.org>2002-03-23 20:48:45 +0000
commit7104dbd245f8c96f3ab90b3f4c44d6adb55ba809 (patch)
tree2c3d5c5d2e89805f188e54f71e5b4d0fd1a73050 /examples/VFS
parent97083568472a52433b00abc7e9f7e1a027ab1064 (diff)
downloadsamba-7104dbd245f8c96f3ab90b3f4c44d6adb55ba809.tar.gz
samba-7104dbd245f8c96f3ab90b3f4c44d6adb55ba809.tar.bz2
samba-7104dbd245f8c96f3ab90b3f4c44d6adb55ba809.zip
Set default recycle directory permissions as 0770. Unlink on rename
fail. Jeremy. (This used to be commit 42981c819a07dd35296ecc1ee733ea587f69bcce)
Diffstat (limited to 'examples/VFS')
-rw-r--r--examples/VFS/recycle.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c
index 4e032bb813..74d3657895 100644
--- a/examples/VFS/recycle.c
+++ b/examples/VFS/recycle.c
@@ -177,13 +177,13 @@ static void recycle_disconnect(struct connection_struct *conn)
static BOOL recycle_XXX_exist(connection_struct *conn, const char *dname, BOOL isdir)
{
- SMB_STRUCT_STAT st;
+ SMB_STRUCT_STAT st;
- if (default_vfs_ops.stat(conn,dname,&st) != 0)
- return(False);
+ if (default_vfs_ops.stat(conn,dname,&st) != 0)
+ return(False);
if (isdir)
- return S_ISDIR(st.st_mode) ? True : False;
+ return S_ISDIR(st.st_mode) ? True : False;
else
return S_ISREG(st.st_mode) ? True : False;
}
@@ -200,9 +200,9 @@ static BOOL recycle_file_exist(connection_struct *conn, const char *fname)
static SMB_OFF_T recycle_get_file_size(connection_struct *conn, const char *fname)
{
- SMB_STRUCT_STAT st;
+ SMB_STRUCT_STAT st;
- if (default_vfs_ops.stat(conn,fname,&st) != 0)
+ if (default_vfs_ops.stat(conn,fname,&st) != 0)
return (SMB_OFF_T)-1;
return(st.st_size);
@@ -219,7 +219,7 @@ static int recycle_unlink(connection_struct *conn, const char *inname)
char *base, *ext;
pstring bin;
int i=1, len, addlen;
- int dir_mask=0700;
+ int dir_mask=0770;
SMB_BIG_UINT dfree,dsize,bsize;
*recycle_bin = '\0';
@@ -274,8 +274,11 @@ static int recycle_unlink(connection_struct *conn, const char *inname)
DEBUG(3, ("recycle bin: move %s -> %s\n", fname, bin));
ret = default_vfs_ops.rename(conn, fname, bin);
- if (ret == -1)
+ if (ret == -1) {
DEBUG(3, ("recycle bin: move error %d (%s)\n", errno, strerror(errno) ));
+ DEBUG(3, ("recycle bin: move failed, purging...\n"));
+ return default_vfs_ops.unlink(conn,fname);
+ }
return ret;
} else {
DEBUG(3, ("recycle bin: move failed, purging...\n"));