[Bug 1795772] Re: rmdir on non-empty samba directory fails silently

Karl Stenerud karl.stenerud at canonical.com
Wed Oct 3 17:50:21 UTC 2018


** Description changed:

+ samba
+ 
+ [Impact]
+ 
+ The samba client doesn't check the result of rmdir, returning success
+ when the directory is not empty. This results in clients reporting
+ successful directory removal when in fact the directory was not removed.
+ 
+ This bug affects anything that uses the samba client, including file
+ managers, mount, and gvfs.
+ 
+ 
+ [Test Case]
+ 
+ # lxc launch ubuntu-daily:cosmic sambatest
+ # lxc exec sambatest bash
+ 
+ Inside container:
+ 
+ # apt update
+ # apt dist-upgrade -y
+ # apt install -y samba samba-client
+ # mkdir -p /tmp/shared/testdir/testsubdir
+ # chown -R nobody:nogroup /tmp/shared
+ # printf "%s" "[global]
+     workgroup = WORKGROUP
+     server role = standalone server
+     security = user
+     map to guest = Bad User
+     guest ok = yes
+     guest only = yes
+     guest account = nobody
+ [shared]
+     path = /tmp/shared
+     writable = yes
+     browsable = yes
+     guest ok = yes
+ " | tee "/etc/samba/smb.conf" >/dev/null
+ # service smbd restart
+ 
+ # CLI_FORCE_INTERACTIVE=yes smbclient -U " "%" " //localhost/shared <<EOF
+ rmdir testdir
+ quit
+ EOF
+ 
+ * Should get NT_STATUS_DIRECTORY_NOT_EMPTY
+ 
+ [Upstream Report and Fix]
+ 
+ https://bugzilla.samba.org/show_bug.cgi?id=13204
+ 
+ https://attachments.samba.org/attachment.cgi?id=14408
+ 
+ 
+ [Regression Potential]
+ 
+ If the fix is implemented incorrectly, clients may receive false error
+ messages, and report failure even on success when removing directories.
+ 
+ 
+ [Original Description]
+ 
  When you delete a non-empty directory in Nautilus or Nemo, the Folder-
  Icon disappears and stays away but when you refresh the current
  directory or navigate back there it reappears. No error message at all.
  This bug is very annoying in two ways:
  
  1) When you only have smb access to the share you have to delete all
  files and directories in sub, subsub and subsubsubdirecories by hand to
  actually delete a directory.
  
  2) You don't get warned that the delete operation failed. In our case
  this produced a horrible mess in our shares before we recognized what
  was going wrong.
  
  You can find many people complaining in various forums. I found bug
  reports in bugtrackers of Nemo, Nautilus and Gnome but the root seems to
  be this (upstream fixed) bug in samba:
  
  https://bugzilla.samba.org/show_bug.cgi?id=13204
  
  Please cherry pick the fix into current version of samba.
  
  Thanks a lot for your help!

** Description changed:

- samba
- 
  [Impact]
  
  The samba client doesn't check the result of rmdir, returning success
  when the directory is not empty. This results in clients reporting
  successful directory removal when in fact the directory was not removed.
  
  This bug affects anything that uses the samba client, including file
  managers, mount, and gvfs.
- 
  
  [Test Case]
  
  # lxc launch ubuntu-daily:cosmic sambatest
  # lxc exec sambatest bash
  
  Inside container:
  
  # apt update
  # apt dist-upgrade -y
  # apt install -y samba samba-client
  # mkdir -p /tmp/shared/testdir/testsubdir
  # chown -R nobody:nogroup /tmp/shared
  # printf "%s" "[global]
-     workgroup = WORKGROUP
-     server role = standalone server
-     security = user
-     map to guest = Bad User
-     guest ok = yes
-     guest only = yes
-     guest account = nobody
+     workgroup = WORKGROUP
+     server role = standalone server
+     security = user
+     map to guest = Bad User
+     guest ok = yes
+     guest only = yes
+     guest account = nobody
  [shared]
-     path = /tmp/shared
-     writable = yes
-     browsable = yes
-     guest ok = yes
+     path = /tmp/shared
+     writable = yes
+     browsable = yes
+     guest ok = yes
  " | tee "/etc/samba/smb.conf" >/dev/null
  # service smbd restart
  
  # CLI_FORCE_INTERACTIVE=yes smbclient -U " "%" " //localhost/shared <<EOF
  rmdir testdir
  quit
  EOF
  
  * Should get NT_STATUS_DIRECTORY_NOT_EMPTY
  
  [Upstream Report and Fix]
  
  https://bugzilla.samba.org/show_bug.cgi?id=13204
  
  https://attachments.samba.org/attachment.cgi?id=14408
  
- 
  [Regression Potential]
  
  If the fix is implemented incorrectly, clients may receive false error
  messages, and report failure even on success when removing directories.
- 
  
  [Original Description]
  
  When you delete a non-empty directory in Nautilus or Nemo, the Folder-
  Icon disappears and stays away but when you refresh the current
  directory or navigate back there it reappears. No error message at all.
  This bug is very annoying in two ways:
  
  1) When you only have smb access to the share you have to delete all
  files and directories in sub, subsub and subsubsubdirecories by hand to
  actually delete a directory.
  
  2) You don't get warned that the delete operation failed. In our case
  this produced a horrible mess in our shares before we recognized what
  was going wrong.
  
  You can find many people complaining in various forums. I found bug
  reports in bugtrackers of Nemo, Nautilus and Gnome but the root seems to
  be this (upstream fixed) bug in samba:
  
  https://bugzilla.samba.org/show_bug.cgi?id=13204
  
  Please cherry pick the fix into current version of samba.
  
  Thanks a lot for your help!

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to samba in Ubuntu.
https://bugs.launchpad.net/bugs/1795772

Title:
  rmdir on non-empty samba directory fails silently

Status in samba:
  Unknown
Status in samba package in Ubuntu:
  Confirmed
Status in samba source package in Bionic:
  Confirmed

Bug description:
  [Impact]

  The samba client doesn't check the result of rmdir, returning success
  when the directory is not empty. This results in clients reporting
  successful directory removal when in fact the directory was not
  removed.

  This bug affects anything that uses the samba client, including file
  managers, mount, and gvfs.

  [Test Case]

  # lxc launch ubuntu-daily:cosmic sambatest
  # lxc exec sambatest bash

  Inside container:

  # apt update
  # apt dist-upgrade -y
  # apt install -y samba samba-client
  # mkdir -p /tmp/shared/testdir/testsubdir
  # chown -R nobody:nogroup /tmp/shared
  # printf "%s" "[global]
      workgroup = WORKGROUP
      server role = standalone server
      security = user
      map to guest = Bad User
      guest ok = yes
      guest only = yes
      guest account = nobody
  [shared]
      path = /tmp/shared
      writable = yes
      browsable = yes
      guest ok = yes
  " | tee "/etc/samba/smb.conf" >/dev/null
  # service smbd restart

  # CLI_FORCE_INTERACTIVE=yes smbclient -U " "%" " //localhost/shared <<EOF
  rmdir testdir
  quit
  EOF

  * Should get NT_STATUS_DIRECTORY_NOT_EMPTY

  [Upstream Report and Fix]

  https://bugzilla.samba.org/show_bug.cgi?id=13204

  https://attachments.samba.org/attachment.cgi?id=14408

  [Regression Potential]

  If the fix is implemented incorrectly, clients may receive false error
  messages, and report failure even on success when removing
  directories.

  [Original Description]

  When you delete a non-empty directory in Nautilus or Nemo, the Folder-
  Icon disappears and stays away but when you refresh the current
  directory or navigate back there it reappears. No error message at
  all. This bug is very annoying in two ways:

  1) When you only have smb access to the share you have to delete all
  files and directories in sub, subsub and subsubsubdirecories by hand
  to actually delete a directory.

  2) You don't get warned that the delete operation failed. In our case
  this produced a horrible mess in our shares before we recognized what
  was going wrong.

  You can find many people complaining in various forums. I found bug
  reports in bugtrackers of Nemo, Nautilus and Gnome but the root seems
  to be this (upstream fixed) bug in samba:

  https://bugzilla.samba.org/show_bug.cgi?id=13204

  Please cherry pick the fix into current version of samba.

  Thanks a lot for your help!

To manage notifications about this bug go to:
https://bugs.launchpad.net/samba/+bug/1795772/+subscriptions



More information about the foundations-bugs mailing list