OpenBSD CVS

CVS log for src/bin/chmod/chmod.c


[BACK] Up to [local] / src / bin / chmod

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.43 / (download) - annotate - [select for diffs], Sun Sep 16 02:44:06 2018 UTC (5 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, HEAD
Changes since 1.42: +5 -7 lines
Diff to previous 1.42 (colored)

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups.  OK tb@

Revision 1.42 / (download) - annotate - [select for diffs], Sun May 28 08:03:36 2017 UTC (7 years ago) by awolk
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.41: +6 -4 lines
Diff to previous 1.41 (colored)

chown: Remove SUPPORT_DOT ifdef - it's on by default for 22 years

The old syntax was deprecated 25 years ago when the utility was
first standardised in IEEE Std 1003.2-1992 ("POSIX.2"). There was
no POSIX version of chown with the dot separator.

Let's stop pretending that it will ever go away.

OK jung@, deraadt@, jmc@

Revision 1.41 / (download) - annotate - [select for diffs], Fri Feb 17 10:14:12 2017 UTC (7 years, 3 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.40: +4 -2 lines
Diff to previous 1.40 (colored)

In chmod's symbolic mode without -h and -R flags, a missing FTS_COMFOLLOW
flag to fts_open led to the following behavior: the symlink's permissions
were read, changed according to the command line, and transferred to the
target file.  chflags had a similar problem while chmod was unaffected.
Regression introduced in r1.33.  Reported by Christopher Wellons, thanks!

ok guenther

Revision 1.40 / (download) - annotate - [select for diffs], Wed Oct 19 18:20:25 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +4 -7 lines
Diff to previous 1.39 (colored)

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Dec 31 23:38:16 2015 UTC (8 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.38: +5 -9 lines
Diff to previous 1.38 (colored)

Document the -h option for chmod and chflags, rewording the chgrp(1) and
chown(8) manpages to be consistent and clearer about it as well.

Revision 1.38 / (download) - annotate - [select for diffs], Fri Oct 9 01:37:06 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

Change all tame callers to namechange to pledge(2).

Revision 1.37 / (download) - annotate - [select for diffs], Sat Oct 3 15:00:13 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.36: +1 -4 lines
Diff to previous 1.36 (colored)

oops!  cannot tame the chmod case, because the kernel drops the
setuid/setgid bits.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Oct 3 05:05:06 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.35: +7 -1 lines
Diff to previous 1.35 (colored)

the chmod & chflags codepaths can use tame "stdio rpath fattr".  the
chown codepath obviously cannot use tame -- once tame is activated
the kernel prohibits changing uid/gid on a fd/file.
ok guenther

Revision 1.35 / (download) - annotate - [select for diffs], Sat Oct 3 03:30:04 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +2 -3 lines
Diff to previous 1.34 (colored)

KNF

Revision 1.34 / (download) - annotate - [select for diffs], Thu Jun 25 02:04:08 2015 UTC (8 years, 11 months ago) by uebayasi
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

Put fts_close() where missing.

Not bugs in short-lived commands that call exit() -> _exit() immediately,
but for idempotency.

Originally found in ls(1) by Valgrind.  Changes for other commands are
from deraadt@.  Reviewed by me, tested in snapshots.

OK deraadt@

Revision 1.33 / (download) - annotate - [select for diffs], Sat Dec 13 20:59:24 2014 UTC (9 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.32: +43 -34 lines
Diff to previous 1.32 (colored)

Correct the handling of symbolic links by chmod/chgrp/chown/chflags,
making them more resistant to TOCTOU race conditions too.

ok tobias@

Revision 1.32 / (download) - annotate - [select for diffs], Sat Dec 13 10:26:48 2014 UTC (9 years, 6 months ago) by tobias
Branch: MAIN
Changes since 1.31: +10 -8 lines
Diff to previous 1.31 (colored)

Properly validate ranges:

- avoid out of boundary access on very short program names
- fix compiler warning when converting values between 0 and INT_MAX

ok deraadt, millert

Revision 1.31 / (download) - annotate - [select for diffs], Mon Oct 6 17:37:34 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +13 -9 lines
Diff to previous 1.30 (colored)

In case of invalid syntax like "chmod -Pr -w tf" (trailing mode letter
in a group of option letters), do not silently ignore the syntax error
and do something undefined, but instead error out properly.
Found because miod@ said "read the code" (not to me, though).

ok doug@

Revision 1.30 / (download) - annotate - [select for diffs], Wed May 21 06:23:01 2014 UTC (10 years ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Use errc/warnc to simplify code.

ok jca@ krw@

Revision 1.29 / (download) - annotate - [select for diffs], Sun Mar 16 18:38:30 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.28: +1 -5 lines
Diff to previous 1.28 (colored)

lint is dead (long live the lint!), so stop using it as a cpp conditional
(namespace pollution!) or talking about its opinion on code.

ok krw@

Revision 1.28 / (download) - annotate - [select for diffs], Tue Dec 4 02:24:46 2012 UTC (11 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

remove some unnecessary sys/param.h inclusions

Revision 1.27 / (download) - annotate - [select for diffs], Wed Mar 9 12:32:02 2011 UTC (13 years, 3 months ago) by okan
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

zap from usage() as well; reminded by jmc@

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jan 12 19:30:53 2010 UTC (14 years, 5 months ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

sync comment with reality, -f won't be documented.

as discussed with jmc@, otto@ and millert@
ok otto@ millert@

Revision 1.25 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:20 2009 UTC (14 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.24: +1 -15 lines
Diff to previous 1.24 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.24 / (download) - annotate - [select for diffs], Wed Jan 21 16:05:39 2009 UTC (15 years, 4 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.23: +7 -3 lines
Diff to previous 1.23 (colored)

fix the synopsis for chown(8)

Revision 1.23 / (download) - annotate - [select for diffs], Tue Apr 25 15:41:07 2006 UTC (18 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.22: +7 -5 lines
Diff to previous 1.22 (colored)

various small lint cleanups; ok otto

Revision 1.22 / (download) - annotate - [select for diffs], Wed Jan 25 06:13:27 2006 UTC (18 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.21: +16 -15 lines
Diff to previous 1.21 (colored)

some warning reduction

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jan 25 05:59:42 2006 UTC (18 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.20: +45 -36 lines
Diff to previous 1.20 (colored)

an old diff from tech to convert to using strtonum and some other misc
cleanup. from ray at cyth net

Revision 1.20 / (download) - annotate - [select for diffs], Tue Nov 29 20:32:22 2005 UTC (18 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.19: +6 -7 lines
Diff to previous 1.19 (colored)

kill unused var found by lint. ok deraadt@

Revision 1.19 / (download) - annotate - [select for diffs], Sat Oct 15 08:57:21 2005 UTC (18 years, 8 months ago) by jmc
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

sync usage();

Revision 1.18 / (download) - annotate - [select for diffs], Thu Jul 1 18:25:47 2004 UTC (19 years, 11 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

setmode(3) returns void *, not mode_t *.  ok millert@

Revision 1.17 / (download) - annotate - [select for diffs], Mon Feb 16 22:12:02 2004 UTC (20 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.16: +16 -8 lines
Diff to previous 1.16 (colored)

If the user does "chown foo.bar" check to see if foo.bar is a username
before picking it apart into a username.group pair.  OK deraadt@

Revision 1.16 / (download) - annotate - [select for diffs], Mon Jun 2 23:32:06 2003 UTC (21 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.15: +3 -7 lines
Diff to previous 1.15 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.15 / (download) - annotate - [select for diffs], Sun Jun 1 23:50:02 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (colored)

Undo a misguided attempt to fix speling errors from long ago.  UCB
copyrights say "acknowledgement", not "acknowledgment".  You cannot
just go changing the text of a license willy-nilly.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Jul 4 04:26:39 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.13: +8 -11 lines
Diff to previous 1.13 (colored)

ansi

Revision 1.13 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:06 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.12: +5 -5 lines
Diff to previous 1.12 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.7.10.1 / (download) - annotate - [select for diffs], Fri Oct 6 20:21:00 2000 UTC (23 years, 8 months ago) by jason
Branch: OPENBSD_2_7
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored) next main 1.8 (colored)

Pull in patch from current:
Fix (millert):
warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant).  These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).

Revision 1.12 / (download) - annotate - [select for diffs], Mon Jul 31 19:02:38 2000 UTC (23 years, 10 months ago) by ericj
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

make -h option work again, it was left out on the getopt string

Revision 1.11 / (download) - annotate - [select for diffs], Wed Jul 19 19:42:31 2000 UTC (23 years, 10 months ago) by mickey
Branch: MAIN
Changes since 1.10: +44 -11 lines
Diff to previous 1.10 (colored)

merge chflags(1) into chmod.
also, use new strtofflags, avoid ls/stat_flags.c usage.
millert@ ok

Revision 1.10 / (download) - annotate - [select for diffs], Fri Jun 30 16:00:03 2000 UTC (23 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant).  These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jun 9 17:50:16 2000 UTC (24 years ago) by mickey
Branch: MAIN
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (colored)

oops

Revision 1.8 / (download) - annotate - [select for diffs], Fri Jun 9 16:26:51 2000 UTC (24 years ago) by mickey
Branch: MAIN
Changes since 1.7: +123 -28 lines
Diff to previous 1.7 (colored)

merge chown/chgrp into chmod.
provide symlinks from old location for the time being.

Revision 1.7 / (download) - annotate - [select for diffs], Sat Nov 8 23:26:39 1997 UTC (26 years, 7 months ago) by todd
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3
Branch point for: OPENBSD_2_7
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

spelling

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jun 28 14:45:43 1997 UTC (26 years, 11 months ago) by grr
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.5: +3 -2 lines
Diff to previous 1.5 (colored)

somebody added setlocale() w/o locale.h

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jun 27 18:37:05 1997 UTC (26 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +5 -2 lines
Diff to previous 1.4 (colored)

setlocale; kleink

Revision 1.4 / (download) - annotate - [select for diffs], Sat Dec 14 12:17:37 1996 UTC (27 years, 6 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.3: +6 -3 lines
Diff to previous 1.3 (colored)

-Wall'ing.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Aug 2 12:40:50 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.2: +2 -3 lines
Diff to previous 1.2 (colored)

zap getopt() case of -?, come on, it is the default!

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jun 23 14:19:07 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)

update rcsid

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:37:01 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:37:01 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.