diff options
| author | marks <none@none> | 2008-07-08 07:44:26 -0700 |
|---|---|---|
| committer | marks <none@none> | 2008-07-08 07:44:26 -0700 |
| commit | b249c65cf0a7400e86a36ddab5c3fce085809859 (patch) | |
| tree | 5c649bfc3fc16f49a50f69634412314e847c2a0d /usr/src/cmd/chgrp | |
| parent | d7ef2af2da2686a3f757fc147f78f6b2b4176988 (diff) | |
| download | illumos-joyent-b249c65cf0a7400e86a36ddab5c3fce085809859.tar.gz | |
PSARC/2008/342 Further SID support
6677411 chmod when faced with deleting more than one acl in one go will only remove the first ACL
6677801 *chmod* Could be more efficient when deleting ACLs
6682126 *chmod* reports invalid user when it means invalid group
6682138 *chmod* Recursive setting of inherit ACLs reports errors for all files.
6682943 Request for aliases to simplify setting ACL permissions
6699852 ZFS should allow storing inheritance flags in file ACLs
6703748 ZFS allows deletes on a readonly file system
6710731 chown(1)/chgrp(1) SID support
6710735 tar/cpio ACL/SID support
6714392 want more SID support
Diffstat (limited to 'usr/src/cmd/chgrp')
| -rw-r--r-- | usr/src/cmd/chgrp/Makefile | 9 | ||||
| -rw-r--r-- | usr/src/cmd/chgrp/chgrp.c | 29 |
2 files changed, 26 insertions, 12 deletions
diff --git a/usr/src/cmd/chgrp/Makefile b/usr/src/cmd/chgrp/Makefile index 64534c28f2..cac25266b7 100644 --- a/usr/src/cmd/chgrp/Makefile +++ b/usr/src/cmd/chgrp/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -22,7 +21,7 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -36,7 +35,7 @@ include ../Makefile.cmd $(XPG4) := CFLAGS += -DXPG4 CPPFLAGS += -D_FILE_OFFSET_BITS=64 -LDLIBS += -lcmdutils +LDLIBS += -lcmdutils -lsec .KEEP_STATE: diff --git a/usr/src/cmd/chgrp/chgrp.c b/usr/src/cmd/chgrp/chgrp.c index 41089443fa..a1fe7fefbf 100644 --- a/usr/src/cmd/chgrp/chgrp.c +++ b/usr/src/cmd/chgrp/chgrp.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -43,6 +43,8 @@ /* * chgrp [-fhR] gid file ... * chgrp -R [-f] [-H|-L|-P] gid file ... + * chgrp -s [-fhR] groupsid file ... + * chgrp -s -R [-f] [-H|-L|-P] groupsid file ... */ #include <stdio.h> @@ -58,6 +60,7 @@ #include <libcmdutils.h> #include <errno.h> #include <strings.h> +#include <aclutils.h> static struct group *gr; static struct stat stbuf; @@ -68,7 +71,8 @@ static int hflag = 0, rflag = 0, Hflag = 0, Lflag = 0, - Pflag = 0; + Pflag = 0, + sflag = 0; static int status = 0; /* total number of errors received */ static avl_tree_t *tree; /* search tree to store inode data */ @@ -145,7 +149,7 @@ main(int argc, char *argv[]) #endif (void) textdomain(TEXT_DOMAIN); - while ((c = getopt(argc, argv, "RhfHLP")) != EOF) + while ((c = getopt(argc, argv, "RhfHLPs")) != EOF) switch (c) { case 'R': rflag++; @@ -175,6 +179,9 @@ main(int argc, char *argv[]) Hflag = Lflag = 0; Pflag++; break; + case 's': + sflag++; + break; default: usage(); } @@ -192,13 +199,19 @@ main(int argc, char *argv[]) usage(); } - if ((gr = getgrnam(argv[0])) != NULL) { + if (sflag) { + if (sid_to_id(argv[0], B_FALSE, &gid)) { + (void) fprintf(stderr, gettext( + "chgrp: invalid group sid %s\n"), argv[0]); + exit(2); + } + } else if ((gr = getgrnam(argv[0])) != NULL) { gid = gr->gr_gid; } else { if (isnumber(argv[0])) { errno = 0; /* gid is an int */ - gid = (gid_t)strtol(argv[0], NULL, 10); + gid = (gid_t)strtoul(argv[0], NULL, 10); if (errno != 0) { if (errno == ERANGE) { (void) fprintf(stderr, gettext( @@ -213,7 +226,7 @@ main(int argc, char *argv[]) } else { (void) fprintf(stderr, "chgrp: "); (void) fprintf(stderr, gettext("unknown group: %s\n"), - argv[0]); + argv[0]); exit(2); } } @@ -539,6 +552,8 @@ usage(void) (void) fprintf(stderr, gettext( "usage:\n" "\tchgrp [-fhR] group file ...\n" - "\tchgrp -R [-f] [-H|-L|-P] group file ...\n")); + "\tchgrp -R [-f] [-H|-L|-P] group file ...\n" + "\tchgrp -s [-fhR] groupsid file ...\n" + "\tchgrp -s -R [-f] [-H|-L|-P] groupsid file ...\n")); exit(2); } |
