Bug 12561 - Recycle bin directly deletes files whose name is extension of repository name
Summary: Recycle bin directly deletes files whose name is extension of repository name
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.6.0rc2
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-05 23:55 UTC by hansmi
Modified: 2021-08-11 20:03 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hansmi 2017-02-05 23:55:12 UTC
When the vfs_recycle object is enabled files whose name is an extension of the recycle bin repository name (i.e. “recycle” and “recycleme”) are not moved to the recycle bin and directly removed instead.

Configuration:
  [public]
  force group = nogroup
  force user = nobody
  guest ok = yes
  guest only = yes
  hide unreadable = yes
  path = /srv/public
  recycle:keeptree = yes
  recycle:repository = recycle
  recycle:touch = yes
  recycle:versions = yes
  vfs objects = recycle
  writeable = yes

Start point on server:
  $ ls -Rl /srv/public
  /srv/public:
  total 4
  drwx------ 2 nobody nogroup 4096 Feb  5 23:39 recycle
  /srv/public/recycle:
  total 0

Upload files from client:
  $ smbclient --user=guest -N '\\server\public'
  smb: \> put /bin/ls recycleme
  putting file /bin/ls as \recycleme
  smb: \> put /bin/ls garbage
  putting file /bin/ls as \garbage
  smb: \> ls recycleme
    recycleme              N   […]
  smb: \> ls garbage
    garbage                N   […]

Layout on server:
  $ ls -Rl /srv/public
  /srv/public:
  total 236
  -rw-r--r-- 1 nobody nogroup 118280 Feb  5 23:42 garbage
  drwx------ 2 nobody nogroup   4096 Feb  5 23:39 recycle
  -rw-r--r-- 1 nobody nogroup 118280 Feb  5 23:40 recycleme
  
  /srv/public/recycle:
  total 0

Delete from client:
  $ smbclient --user=guest -N '\\server\public'
  smb: \> del garbage
  smb: \> del recycleme

Expected on server:
  $ ls -Rl /srv/public
  /srv/public:
  total 4
  drwx------ 2 nobody nogroup 4096 Feb  5 23:45 recycle
  
  /srv/public/recycle:
  total 116
  -rw-r--r-- 1 nobody nogroup 118280 Feb  5 23:42 garbage
  -rw-r--r-- 1 nobody nogroup 118280 Feb  5 23:40 recycleme

*Actual* situation on server:
  $ ls -Rl /srv/public
  /srv/public:
  total 4
  drwx------ 2 nobody nogroup 4096 Feb  5 23:45 recycle
  
  /srv/public/recycle:
  total 116
  -rw-r--r-- 1 nobody nogroup 118280 Feb  5 23:42 garbage

Note how “recycleme” was deleted without being moved to the recycle bin. This was observed in Samba 4.2.14 as distributed in Debian Jessie and confirmed via source code inspection in the v4-6-stable and master branches as of February 6, 2017. I believe the responsible code is at <https://git.samba.org/?p=samba.git;a=blob;f=source3/modules/vfs_recycle.c;hb=refs/tags/samba-4.6.0rc2#l483>.