Module Name:    src
Committed By:   reinoud
Date:           Mon Jul  8 08:21:13 UTC 2013

Modified Files:
        src/sys/fs/udf: udf_vnops.c

Log Message:
Clarify the sticky-bit check


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/fs/udf/udf_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.83 src/sys/fs/udf/udf_vnops.c:1.84
--- src/sys/fs/udf/udf_vnops.c:1.83	Sun Jul  7 20:16:22 2013
+++ src/sys/fs/udf/udf_vnops.c	Mon Jul  8 08:21:12 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.83 2013/07/07 20:16:22 reinoud Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.84 2013/07/08 08:21:12 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.83 2013/07/07 20:16:22 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.84 2013/07/08 08:21:12 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -792,7 +792,7 @@ udf_lookup(void *v)
 	if (error)
 		goto out;
 
-	/* check the permissions */
+	/* check permissions */
 	if (islastcn && (cnp->cn_nameiop == DELETE ||
 			 cnp->cn_nameiop == RENAME)  ) {
 		error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred);
@@ -801,10 +801,14 @@ udf_lookup(void *v)
 			goto out;
 		}
 
-		/* get node attributes */
+		/*
+		 * Check if the directory has its sticky bit set. If so, ask
+		 * for clearance since only the owner of a file or directory
+		 * can remove/rename from taht directory.
+		 */
 		mode = udf_getaccessmode(dir_node);
-		udf_getownership(dir_node, &d_uid, &d_gid);
 		if ((mode & S_ISTXT) != 0) {
+			udf_getownership(dir_node, &d_uid, &d_gid);
 			error = kauth_authorize_vnode(cnp->cn_cred,
 			    KAUTH_VNODE_DELETE, res_node->vnode,
 			    dir_node->vnode, genfs_can_sticky(cnp->cn_cred,

Reply via email to