1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-03 06:45:37 -08:00
Commit Graph

43 Commits

Author SHA1 Message Date
guenther
5b133f3f27 Delete obsolete /* ARGSUSED */ lint comments.
ok miod@ millert@
2023-03-08 04:43:04 +00:00
deraadt
b7041c0781 For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant.  Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk.  They could all be 0xdeafbeef.
ok millert
2021-10-24 21:24:15 +00:00
deraadt
3aaa63eb46 When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
2019-06-28 13:34:58 +00:00
millert
d6fbb2f1dc Replace the local getname() and getuserid() functions with calls
to user_from_uid(3) and uid_from_user(3).  This requires sprinkling
const in a few places to match the return value of user_from_uid(3).
OK tb@
2018-09-16 02:38:57 +00:00
mmcc
cd9ca5b765 Modernize allocation by:
* removing unneeded casts of void* return values
 * replacing varied and creative error messages with the allocation
   function's name
 * replacing errx() with err() so that the errno string is reported

ok beck@, jung@, millert@
2015-10-16 17:56:07 +00:00
guenther
7c77b57de5 Prefer mkostemp(O_CLOEXEC) over mkstemp()+fcntl(F_SETFD)
Prefer fopen("re") over fopen("r")+fcntl(F_SETFD)

ok otto@ millert@
2014-10-26 20:38:13 +00:00
guenther
5ad04d3516 Use errc/warnc to simplify code.
Also, in 'ftp', always put the error message last, after the hostname/ipaddr.

ok jsing@ krw@ millert@
2014-05-20 01:25:23 +00:00
okan
085f113bcb ctype and other sign extension fixes.
with deraadt and millert, ok millert
2014-01-17 18:42:30 +00:00
okan
b779915b23 use FD_CLOEXEC instead of 1; from David Hill
ok otto
2013-04-29 00:28:23 +00:00
miod
691235adb9 Avoid using NULL in non-pointer contexts: use 0 for integer values and '\0'
for chars.
2011-04-06 11:36:23 +00:00
deraadt
043fbe51c1 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
2009-10-27 23:59:19 +00:00
deraadt
2a18766075 delint; millert ok 2004-05-10 15:25:51 +00:00
millert
b026b41694 Get rid of the ancient "clobber" command. It was really only for debugging
purposes.  Noticed and OK by deraadt@
2004-05-10 12:10:50 +00:00
avsm
ca9f5f35f7 dont compare int to NULL, millert@ ok 2003-10-24 20:30:02 +00:00
tedu
3f32cc62a7 better realloc. ok deraadt jose 2003-10-13 00:46:08 +00:00
millert
f75387cb26 Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.
2003-06-03 02:56:05 +00:00
millert
d984daca2d o kill strcpy()
o check return values of malloc and friends
o use strdup() when sensible
2001-11-21 20:41:55 +00:00
millert
4a9caef215 o ANSIfy
o Style nits
o Use const to silent stupid -Wall warnings
o strnc{py,at} -> strlc{py,at}
o Use strpbrk() instead of homegrown anyof()
o Use NULL instead of #defines with 0 cast to a pointer
This still could use a proper audit
2001-11-21 15:26:39 +00:00
millert
7f56ba93ca Major signal overhaul. We no longer longjmp all over the place.
Instead, routines responsible to gathering user input (or in some
cases outputting data) catch the signals and set flags as needed.
Because of this some handlers are install without the SA_RESTART
flag so syscalls are not restarted and we can check the flag.  All
signal handlers are now safe.

This should make the flow of control a bit more grokable but the
code is still ugly.
2001-11-20 20:50:00 +00:00
deraadt
2cefec3ea6 properly bail out of incfile(); millert ok 2001-11-17 19:10:25 +00:00
millert
e6aad4087c Remove evil #ifdef __GNUC__ garbage to avoid longjmp clobbering and
use volatile instead.
2001-06-23 23:04:21 +00:00
millert
ca8b07b07c Changes from Don Beusee:
o escape From line with a leading '>' when needed
o only print To: address and Subject lines if actually present
o new variable 'allnet' to treat user@foo and user@bar as the same "user"
o folders command now takes an optional argument like ls.
o new "pipe" (|) command to pipe the message through an arbitrary command
o make header display format the same as SunOS 4.1.3 /usr/ucb/mail
o tilde commands work regardless of interactive mode.
o fix "read: Interrupted system call" error by retrying if EINTR
o expanded help file
Changes by me:
o read the help file via the PAGER as it is now more than 24 lines long
2001-01-16 05:36:08 +00:00
deraadt
fc0f86e9d6 printf with % for the prompt 2000-07-06 06:24:21 +00:00
millert
b638aa9471 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).
2000-06-30 16:00:03 +00:00
millert
aa9e54ca73 When incorporating new messages, clear the "new" count before the
inc so the count of new messages is useful afterwards.  This makes
mail behave more like the SunOS version in this respect.
2000-04-25 16:42:22 +00:00
millert
9dff7e513a Fix comments in .mailrc where there is no space after the hash (#). Noted by pjanzen@foatdi.harvard.edu 1998-09-08 14:59:12 +00:00
millert
9f0d12ce82 back out some signal changes that can cause mail to hang when quitting due to SIGCHLD blockage 1998-06-12 18:07:54 +00:00
millert
4f2f823f8b Never remove a mail spool, as we may not have proper prics, just truncate. Also block signals in a few critical areas 1998-05-04 05:37:47 +00:00
millert
36999bed05 NetBSD changes (mostly comsmetic):
replace panic() with calls to err()/errx()
    use S_IS* instead of doing by hand with S_IF*.
    Use TIMESPEC_TO_TIMEVAL() and gettimeofday instead of time(2)
    Use _POSIX_VDISABLE, not 0
    Kill register
1997-11-14 00:23:41 +00:00
millert
e069db6b92 Make istrcpy() take a size (not length) field, now called istrncpy().
Change some strcpy() -> strncpy() out of paranoia.
1997-07-30 07:19:29 +00:00
millert
41f015886d Fix one possible oflow (not exploitable) and do a wee bit of KNF.
Much more remains to be done.
1997-07-30 06:32:38 +00:00
millert
0ecc72fcb7 tempnam(3) goes bye bye. 1997-07-24 17:27:09 +00:00
millert
1db7fd3124 Replace 3 tempnam()'s with mkstemp. The two left look tricky. 1997-07-24 16:23:36 +00:00
millert
ba6cd416c9 incfile() needs to lock the mail spool so it doesn't get partial messages.
Noticed by Theo.
1997-07-22 19:13:25 +00:00
millert
59de9fc346 Release signals when we get an error condition in incfile(). 1997-07-22 06:46:20 +00:00
millert
c318c72bec NOSTR -> NULL
Use sigsetjmp/siglongjmp instead of sigjmp/longjmp for portability.
1997-07-14 00:24:24 +00:00
millert
f0e43013ae bcopy() -> memcpy() and fix some casts. 1997-07-13 23:53:56 +00:00
millert
db59c1a606 Merge in NetBSD and 4.4BSD-lite2 changes as well as some of my own.
- handle long lines safely (from NetBSD)
 - use puts/fputs and putchar/putc when it makes sense
 - use err/errx and warn/warnx when it makes sense
 - make return() and sizeof() style consisten
 - some more buffer safety
1997-07-13 21:21:08 +00:00
deraadt
c32a32501b overflows abound 1997-05-30 08:51:32 +00:00
millert
180acc8f08 r?index -> strr?chr 1997-01-17 07:10:42 +00:00
deraadt
7eb34045c5 from christos;
- Fix PR/105: Implement dot locking protocol and check return value of flock.
- Fix PR/2247: Don't call unknown users "ubluit". Issue an error message.
- Fix/add prototypes.
- Fix warnings.
- Use POSIX signal mask calls.
1996-06-11 12:53:31 +00:00
niklas
4f4c46ca88 From NetBSD: merge of 960317 1996-03-27 19:32:19 +00:00
deraadt
df930be708 initial import of NetBSD tree 1995-10-18 08:37:01 +00:00