summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-06-13 18:45:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:57:13 -0500
commitc52e7fdf78db56aa994d2bd9c2613ccef7679986 (patch)
tree52deea5270122ebd3f4608a5521d481165d01fd7
parent1a60c450dd83166fb1a1a8e83c2dc57e2e77b2cc (diff)
downloadsamba-c52e7fdf78db56aa994d2bd9c2613ccef7679986.tar.gz
samba-c52e7fdf78db56aa994d2bd9c2613ccef7679986.tar.bz2
samba-c52e7fdf78db56aa994d2bd9c2613ccef7679986.zip
r7544: Fix for bug #2196 from Denis Sbragion <d.sbragion@infotecna.it>.
Allow absolute path (system wide) recycle bin. Jeremy. (This used to be commit 451fbbf1d603cb99b0c9f0d39de9ad71a6a12833)
-rw-r--r--source3/modules/vfs_recycle.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 6a9914131d..770dc2f40a 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -222,7 +222,7 @@ static SMB_OFF_T recycle_get_file_size(vfs_handle_struct *handle, const char *fn
**/
static BOOL recycle_create_dir(vfs_handle_struct *handle, const char *dname)
{
- int len;
+ size_t len;
mode_t mode;
char *new_dir = NULL;
char *tmp_str = NULL;
@@ -240,6 +240,10 @@ static BOOL recycle_create_dir(vfs_handle_struct *handle, const char *dname)
new_dir = (char *)SMB_MALLOC(len + 1);
ALLOC_CHECK(new_dir, done);
*new_dir = '\0';
+ if (dname[0] == '/') {
+ /* Absolute path. */
+ safe_strcat(new_dir,"/",len);
+ }
/* Create directory tree if neccessary */
for(token = strtok(tok_str, "/"); token; token = strtok(NULL, "/")) {
@@ -353,7 +357,8 @@ static int recycle_unlink(vfs_handle_struct *handle, connection_struct *conn, co
repository = alloc_sub_conn(conn, recycle_repository(handle));
ALLOC_CHECK(repository, done);
/* shouldn't we allow absolute path names here? --metze */
- trim_char(repository, '/', '/');
+ /* Yes :-). JRA. */
+ trim_char(repository, '\0', '/');
if(!repository || *(repository) == '\0') {
DEBUG(3, ("recycle: repository path not set, purging %s...\n", file_name));
@@ -379,7 +384,7 @@ static int recycle_unlink(vfs_handle_struct *handle, connection_struct *conn, co
}
*/
- /* FIXME: this is wrong, we should check the hole size of the recycle bin is
+ /* FIXME: this is wrong, we should check the whole size of the recycle bin is
* not greater then maxsize, not the size of the single file, also it is better
* to remove older files
*/