diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-08-01 01:01:42 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-08-01 01:01:42 +0000 |
commit | 4a708c64cc0677e84c4b8e77b54d0199042254c4 (patch) | |
tree | bbcf5f1289fd8feb0ba87851c79d7eb67dfdf7e6 /gnu/usr.sbin/sendmail/libsmutil | |
parent | 8879a3e7434a6e93c5f42406c82b3dce8d9f277c (diff) |
update to sendmail 8.11.5
Diffstat (limited to 'gnu/usr.sbin/sendmail/libsmutil')
-rw-r--r-- | gnu/usr.sbin/sendmail/libsmutil/safefile.c | 83 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libsmutil/snprintf.c | 8 |
2 files changed, 6 insertions, 85 deletions
diff --git a/gnu/usr.sbin/sendmail/libsmutil/safefile.c b/gnu/usr.sbin/sendmail/libsmutil/safefile.c index 531a0eed610..de2b155653c 100644 --- a/gnu/usr.sbin/sendmail/libsmutil/safefile.c +++ b/gnu/usr.sbin/sendmail/libsmutil/safefile.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Sendmail: safefile.c,v 8.81.4.7 2000/09/01 21:09:23 ca Exp $"; +static char id[] = "@(#)$Sendmail: safefile.c,v 8.81.4.10 2001/07/20 04:19:36 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -660,10 +660,6 @@ safedirpath(fn, uid, gid, user, flags, level, offset) ** Same as open. */ -#ifndef O_ACCMODE -# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) -#endif /* ! O_ACCMODE */ - int safeopen(fn, omode, cmode, sff) char *fn; @@ -735,81 +731,6 @@ safeopen(fn, omode, cmode, sff) return fd; } /* -** SAFEFOPEN -- do a file open with extra checking -** -** Parameters: -** fn -- the file name to open. -** omode -- the open-style mode flags. -** cmode -- the create-style mode flags. -** sff -- safefile flags. -** -** Returns: -** Same as fopen. -*/ - -FILE * -safefopen(fn, omode, cmode, sff) - char *fn; - int omode; - int cmode; - long sff; -{ - int fd; - int save_errno; - FILE *fp; - char *fmode; - - switch (omode & O_ACCMODE) - { - case O_RDONLY: - fmode = "r"; - break; - - case O_WRONLY: - if (bitset(O_APPEND, omode)) - fmode = "a"; - else - fmode = "w"; - break; - - case O_RDWR: - if (bitset(O_TRUNC, omode)) - fmode = "w+"; - else if (bitset(O_APPEND, omode)) - fmode = "a+"; - else - fmode = "r+"; - break; - - default: - syserr("554 5.3.5 safefopen: unknown omode %o", omode); - fmode = "x"; - } - fd = safeopen(fn, omode, cmode, sff); - if (fd < 0) - { - save_errno = errno; - if (tTd(44, 10)) - dprintf("safefopen: safeopen failed: %s\n", - errstring(errno)); - errno = save_errno; - return NULL; - } - fp = fdopen(fd, fmode); - if (fp != NULL) - return fp; - - save_errno = errno; - if (tTd(44, 10)) - { - dprintf("safefopen: fdopen(%s, %s) failed: omode=%x, sff=%lx, err=%s\n", - fn, fmode, omode, sff, errstring(errno)); - } - (void) close(fd); - errno = save_errno; - return NULL; -} -/* ** FILECHANGED -- check to see if file changed after being opened ** ** Parameters: diff --git a/gnu/usr.sbin/sendmail/libsmutil/snprintf.c b/gnu/usr.sbin/sendmail/libsmutil/snprintf.c index e62c4a83e25..0aaeb668ff2 100644 --- a/gnu/usr.sbin/sendmail/libsmutil/snprintf.c +++ b/gnu/usr.sbin/sendmail/libsmutil/snprintf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Sendmail: snprintf.c,v 8.27.16.2 2000/09/17 17:04:24 gshapiro Exp $"; +static char id[] = "@(#)$Sendmail: snprintf.c,v 8.27.16.4 2001/07/20 04:19:37 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -86,10 +86,10 @@ sm_vsnprintf(str, count, fmt, args) sm_dopr( str, fmt, args ); if (count > 0) DoprEnd[0] = 0; - if (SnprfOverflow && tTd(57, 2)) + if (SnprfOverflow > 0 && tTd(57, 2)) dprintf("\nvsnprintf overflow, len = %ld, str = %s", (long) count, shortenstring(str, MAXSHORTSTR)); - return strlen(str); + return strlen(str) + SnprfOverflow; } /* |