Subject: pkg/12387: Sharity-Light patch to delete dotfiles (based on pkg/10143)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jmcneill@invisible.yi.org>
List: netbsd-bugs
Date: 03/12/2001 06:52:11
>Number:         12387
>Category:       pkg
>Synopsis:       Deleting dotfiles returns 'Permission denied' with shlight shares
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 12 02:53:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jared D. McNeill
>Release:        NetBSD 1.5.1_ALPHA appx. Mar 1, 2001 <NetBSD-current source date>
>Organization:
>Environment:
System: NetBSD sun.invisible.ca 1.5.1_ALPHA NetBSD 1.5.1_ALPHA (SUN) #0: Thu Mar 1 22:05:02 AST 2001 jmcneill@sun.invisible.ca:/usr/src/sys/arch/i386/compile/SUN i386


>Description:
	It is impossible to remove dotfiles on shares mounted with shlight.
>How-To-Repeat:
	Mount an SMB share:
	sun:~# shlight //blackhole/music /mnt -W INVISIBLE -U jmcneill -C
	Password:
	Using port 64390 for NFS.

	From here, touch a dotfile (touch /mnt/.me) and try to remove it
	(rm /mnt/.me) and you will get permission denied.
>Fix:

patch-ac:

$NetBSD$

--- proc.c.orig Mon Mar 12 06:37:22 2001
+++ proc.c      Mon Mar 12 06:39:09 2001
@@ -867,12 +867,13 @@
         char *p;
         char *buf = server->packet;
         int result;
+        const word o_attr = aSYSTEM | aHIDDEN;

         smb_lock_server(server);

  retry:
         p = smb_setup_header(server, SMBunlink, 1, 2 + len);
-        WSET(buf, smb_vwv0, 0);
+        WSET(buf, smb_vwv0, o_attr);
         smb_encode_ascii(p, path, len);

         if ((result = smb_request_ok(server, SMBunlink, 0, 0)) < 0) {
>Release-Note:
>Audit-Trail:
>Unformatted: