aboutsummaryrefslogtreecommitdiff
path: root/bin/ls
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1997-06-02 06:24:52 +0000
committerJulian Elischer <julian@FreeBSD.org>1997-06-02 06:24:52 +0000
commit50dab48a5b79db0d1d10e5d8a3527763cb1cae63 (patch)
tree271fc558356e392a58d9249d3b3eba7d3ff6ffc1 /bin/ls
parente4676ba603826ca933e03f6d4154cf8e1ea88c3c (diff)
downloadsrc-50dab48a5b79db0d1d10e5d8a3527763cb1cae63.tar.gz
src-50dab48a5b79db0d1d10e5d8a3527763cb1cae63.zip
Submitted by: Whistle Communications (archie Cobbs)
These changes add the ability to specify that a UFS file/directory cannot be unlinked. This is basically a scaled back version of the IMMUTABLE flag. The reason is to allow an administrator to create a directory hierarchy that a group of users can arbitrarily add/delete files from, but that the hierarchy itself is safe from removal by them. If the NOUNLINK definition is set to 0 then this results in no change to what happens normally. (and results in identical binary (in the kernel)). It can be proven that if this bit is never set by the admin, no new behaviour is introduced.. Several "good idea" comments from reviewers plus one grumble about creeping featurism. This code is in production in 2.2 based systems
Notes
Notes: svn path=/head/; revision=26360
Diffstat (limited to 'bin/ls')
-rw-r--r--bin/ls/stat_flags.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/ls/stat_flags.c b/bin/ls/stat_flags.c
index f0092fed9c49..b1e70628e527 100644
--- a/bin/ls/stat_flags.c
+++ b/bin/ls/stat_flags.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: stat_flags.c,v 1.5 1997/02/22 14:04:02 peter Exp $
*/
#ifndef lint
@@ -69,6 +69,8 @@ flags_to_string(flags, def)
SAPPEND("uappnd");
if (flags & UF_IMMUTABLE)
SAPPEND("uchg");
+ if (flags & UF_NOUNLINK)
+ SAPPEND("uunlnk");
if (flags & UF_NODUMP)
SAPPEND("nodump");
if (flags & UF_OPAQUE)
@@ -79,6 +81,8 @@ flags_to_string(flags, def)
SAPPEND("arch");
if (flags & SF_IMMUTABLE)
SAPPEND("schg");
+ if (flags & SF_NOUNLINK)
+ SAPPEND("sunlnk");
return (prefix == NULL && def != NULL ? def : string);
}
@@ -139,6 +143,8 @@ string_to_flags(stringp, setp, clrp)
TEST(p, "schg", SF_IMMUTABLE);
TEST(p, "schange", SF_IMMUTABLE);
TEST(p, "simmutable", SF_IMMUTABLE);
+ TEST(p, "sunlnk", SF_NOUNLINK);
+ TEST(p, "sunlink", SF_NOUNLINK);
return (1);
case 'u':
TEST(p, "uappnd", UF_APPEND);
@@ -146,6 +152,8 @@ string_to_flags(stringp, setp, clrp)
TEST(p, "uchg", UF_IMMUTABLE);
TEST(p, "uchange", UF_IMMUTABLE);
TEST(p, "uimmutable", UF_IMMUTABLE);
+ TEST(p, "uunlnk", UF_NOUNLINK);
+ TEST(p, "uunlink", UF_NOUNLINK);
/* FALLTHROUGH */
default:
return (1);