svn commit: samba r5615 - in trunk/source/smbd: .

jra at samba.org jra at samba.org
Wed Mar 2 03:41:35 GMT 2005


Author: jra
Date: 2005-03-02 03:41:35 +0000 (Wed, 02 Mar 2005)
New Revision: 5615

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5615

Log:
Forgot about the sticky bit on directories (commonly set on /tmp). If this is set
then only the owner or root can delete a file. We now use
the same algorithm to check file delete.
Jeremy.

Modified:
   trunk/source/smbd/posix_acls.c


Changeset:
Modified: trunk/source/smbd/posix_acls.c
===================================================================
--- trunk/source/smbd/posix_acls.c	2005-03-02 03:24:40 UTC (rev 5614)
+++ trunk/source/smbd/posix_acls.c	2005-03-02 03:41:35 UTC (rev 5615)
@@ -3903,10 +3903,26 @@
 	if (current_user.uid == sbuf.st_uid) {
 		return (sbuf.st_mode & S_IWUSR) ? True : False;
 	}
+
+#ifdef S_ISVTX
+	/* sticky bit means delete only by owner or root. */
+	if (sbuf.st_mode & S_ISVTX) {
+		SMB_STRUCT_STAT sbuf_file;  
+		if(SMB_VFS_STAT(conn, fname, &sbuf_file) != 0) {
+			return False;
+		}
+		if (current_user.uid == sbuf_file.st_uid) {
+			return True;
+		}
+		return False;
+	}
+#endif
+
 	/* Check group ownership. */
 	ret = check_posix_acl_group_write(conn, dname, &sbuf);
 	if (ret == 0 || ret == 1) {
 		return ret ? True : False;
 	}
+
 	return (sbuf.st_mode & S_IWOTH) ? True : False;
 }



More information about the samba-cvs mailing list