summaryrefslogtreecommitdiffstats
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
commit42981c819a07dd35296ecc1ee733ea587f69bcce (patch)
treeaf6e0d26a84cc3fac17e8d973a3a6aad3767f39d /examples/VFS
parent9a9e4e92ae079eb906dcc7123df092f4917b5dad (diff)
downloadsamba-42981c819a07dd35296ecc1ee733ea587f69bcce.tar.gz
samba-42981c819a07dd35296ecc1ee733ea587f69bcce.tar.xz
samba-42981c819a07dd35296ecc1ee733ea587f69bcce.zip
Set default recycle directory permissions as 0770. Unlink on rename
fail. Jeremy.
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 4e032bb8133..74d3657895a 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"));