mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
s3: VFS: vfs_recycle: Change recycle_unlink_internal() to call UNLINKAT().
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
1f8bdb3974
commit
6f0cc51b1f
@ -485,7 +485,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
if(!repository || *(repository) == '\0') {
|
if(!repository || *(repository) == '\0') {
|
||||||
DEBUG(3, ("recycle: repository path not set, purging %s...\n",
|
DEBUG(3, ("recycle: repository path not set, purging %s...\n",
|
||||||
smb_fname_str_dbg(smb_fname)));
|
smb_fname_str_dbg(smb_fname)));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +496,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
if (strncmp(smb_fname->base_name, repository,
|
if (strncmp(smb_fname->base_name, repository,
|
||||||
strlen(repository)) == 0) {
|
strlen(repository)) == 0) {
|
||||||
DEBUG(3, ("recycle: File is within recycling bin, unlinking ...\n"));
|
DEBUG(3, ("recycle: File is within recycling bin, unlinking ...\n"));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +509,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
*
|
*
|
||||||
if(fsize == 0) {
|
if(fsize == 0) {
|
||||||
DEBUG(3, ("recycle: File %s is empty, purging...\n", file_name));
|
DEBUG(3, ("recycle: File %s is empty, purging...\n", file_name));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle,file_name);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
file_name,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -516,14 +525,20 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
if(maxsize > 0 && file_size > maxsize) {
|
if(maxsize > 0 && file_size > maxsize) {
|
||||||
DEBUG(3, ("recycle: File %s exceeds maximum recycle size, "
|
DEBUG(3, ("recycle: File %s exceeds maximum recycle size, "
|
||||||
"purging... \n", smb_fname_str_dbg(smb_fname)));
|
"purging... \n", smb_fname_str_dbg(smb_fname)));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
minsize = recycle_minsize(handle);
|
minsize = recycle_minsize(handle);
|
||||||
if(minsize > 0 && file_size < minsize) {
|
if(minsize > 0 && file_size < minsize) {
|
||||||
DEBUG(3, ("recycle: File %s lowers minimum recycle size, "
|
DEBUG(3, ("recycle: File %s lowers minimum recycle size, "
|
||||||
"purging... \n", smb_fname_str_dbg(smb_fname)));
|
"purging... \n", smb_fname_str_dbg(smb_fname)));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +549,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
DEBUG(5, ("space_avail = %Lu, file_size = %Lu\n", space_avail, file_size));
|
DEBUG(5, ("space_avail = %Lu, file_size = %Lu\n", space_avail, file_size));
|
||||||
if(space_avail < file_size) {
|
if(space_avail < file_size) {
|
||||||
DEBUG(3, ("recycle: Not enough diskspace, purging file %s\n", file_name));
|
DEBUG(3, ("recycle: Not enough diskspace, purging file %s\n", file_name));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, file_name);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
file_name,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -562,13 +580,19 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
|
|
||||||
if (matchparam(recycle_exclude(handle), base)) {
|
if (matchparam(recycle_exclude(handle), base)) {
|
||||||
DEBUG(3, ("recycle: file %s is excluded \n", base));
|
DEBUG(3, ("recycle: file %s is excluded \n", base));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchdirparam(recycle_exclude_dir(handle), path_name)) {
|
if (matchdirparam(recycle_exclude_dir(handle), path_name)) {
|
||||||
DEBUG(3, ("recycle: directory %s is excluded \n", path_name));
|
DEBUG(3, ("recycle: directory %s is excluded \n", path_name));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,7 +614,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
DEBUG(3, ("recycle: Could not create directory, "
|
DEBUG(3, ("recycle: Could not create directory, "
|
||||||
"purging %s...\n",
|
"purging %s...\n",
|
||||||
smb_fname_str_dbg(smb_fname)));
|
smb_fname_str_dbg(smb_fname)));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,7 +633,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
NULL,
|
NULL,
|
||||||
smb_fname->flags);
|
smb_fname->flags);
|
||||||
if (smb_fname_final == NULL) {
|
if (smb_fname_final == NULL) {
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,8 +649,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
if (recycle_versions(handle) == False || matchparam(recycle_noversions(handle), base) == True) {
|
if (recycle_versions(handle) == False || matchparam(recycle_noversions(handle), base) == True) {
|
||||||
DEBUG(3, ("recycle: Removing old file %s from recycle "
|
DEBUG(3, ("recycle: Removing old file %s from recycle "
|
||||||
"bin\n", smb_fname_str_dbg(smb_fname_final)));
|
"bin\n", smb_fname_str_dbg(smb_fname_final)));
|
||||||
if (SMB_VFS_NEXT_UNLINK(handle,
|
if (SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
smb_fname_final) != 0) {
|
dirfsp,
|
||||||
|
smb_fname_final,
|
||||||
|
flags) != 0) {
|
||||||
DEBUG(1, ("recycle: Error deleting old file: %s\n", strerror(errno)));
|
DEBUG(1, ("recycle: Error deleting old file: %s\n", strerror(errno)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -637,7 +669,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
smb_fname_final->base_name = talloc_strdup(smb_fname_final,
|
smb_fname_final->base_name = talloc_strdup(smb_fname_final,
|
||||||
final_name);
|
final_name);
|
||||||
if (smb_fname_final->base_name == NULL) {
|
if (smb_fname_final->base_name == NULL) {
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -654,7 +689,10 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
|
|||||||
"(%s)\n", errno, strerror(errno),
|
"(%s)\n", errno, strerror(errno),
|
||||||
smb_fname_str_dbg(smb_fname),
|
smb_fname_str_dbg(smb_fname),
|
||||||
smb_fname_str_dbg(smb_fname_final)));
|
smb_fname_str_dbg(smb_fname_final)));
|
||||||
rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
rc = SMB_VFS_NEXT_UNLINKAT(handle,
|
||||||
|
dirfsp,
|
||||||
|
smb_fname,
|
||||||
|
flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user