diff options
Diffstat (limited to 'makemap')
| -rwxr-xr-x | makemap/Build | 4 | ||||
| -rw-r--r-- | makemap/makemap.0 | 2 | ||||
| -rw-r--r-- | makemap/makemap.8 | 6 | ||||
| -rw-r--r-- | makemap/makemap.c | 106 |
4 files changed, 61 insertions, 57 deletions
diff --git a/makemap/Build b/makemap/Build index 3bb6e8539529..591b7128694b 100755 --- a/makemap/Build +++ b/makemap/Build @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 1999 Sendmail, Inc. and its suppliers. +# Copyright (c) 1999 Proofpoint, Inc. and its suppliers. # All rights reserved. # # By using this file, you agree to the terms and conditions set @@ -8,6 +8,6 @@ # the sendmail distribution. # # -# $Id: Build,v 8.4 1999/03/02 02:33:50 peterh Exp $ +# $Id: Build,v 8.5 2013/11/22 20:51:52 ca Exp $ exec ../devtools/bin/Build $* diff --git a/makemap/makemap.0 b/makemap/makemap.0 index 5e30b72014e8..892b04d1a8c0 100644 --- a/makemap/makemap.0 +++ b/makemap/makemap.0 @@ -87,4 +87,4 @@ HHIISSTTOORRYY - $Date: 2008/05/02 23:07:48 $ MAKEMAP(8) + $Date: 2013/11/22 20:51:52 $ MAKEMAP(8) diff --git a/makemap/makemap.8 b/makemap/makemap.8 index ca8a949de863..60352b037d6d 100644 --- a/makemap/makemap.8 +++ b/makemap/makemap.8 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers. +.\" Copyright (c) 1998-2002 Proofpoint, Inc. and its suppliers. .\" All rights reserved. .\" Copyright (c) 1988, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -8,9 +8,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: makemap.8,v 8.31 2008/05/02 23:07:48 ca Exp $ +.\" $Id: makemap.8,v 8.32 2013/11/22 20:51:52 ca Exp $ .\" -.TH MAKEMAP 8 "$Date: 2008/05/02 23:07:48 $" +.TH MAKEMAP 8 "$Date: 2013/11/22 20:51:52 $" .SH NAME makemap \- create database maps for sendmail diff --git a/makemap/makemap.c b/makemap/makemap.c index f494ba03e2ec..ae8774584d66 100644 --- a/makemap/makemap.c +++ b/makemap/makemap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2002, 2004, 2008 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2002, 2004, 2008 Proofpoint, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1992 Eric P. Allman. All rights reserved. * Copyright (c) 1992, 1993 @@ -14,13 +14,13 @@ #include <sm/gen.h> SM_IDSTR(copyright, -"@(#) Copyright (c) 1998-2002, 2004 Sendmail, Inc. and its suppliers.\n\ +"@(#) Copyright (c) 1998-2002, 2004 Proofpoint, Inc. and its suppliers.\n\ All rights reserved.\n\ Copyright (c) 1992 Eric P. Allman. All rights reserved.\n\ Copyright (c) 1992, 1993\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.181 2013/03/12 15:24:51 ca Exp $") +SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.183 2013/11/22 20:51:52 ca Exp $") #include <sys/types.h> @@ -234,67 +234,71 @@ main(argc, argv) } #if HASFCHOWN - /* Find TrustedUser value in sendmail.cf */ - if ((cfp = sm_io_open(SmFtStdio, SM_TIME_DEFAULT, cfile, SM_IO_RDONLY, - NULL)) == NULL) + if (!unmake && geteuid() == 0) { - sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "makemap: %s: %s\n", - cfile, sm_errstring(errno)); - exit(EX_NOINPUT); - } - while (sm_io_fgets(cfp, SM_TIME_DEFAULT, buf, sizeof(buf)) >= 0) - { - register char *b; + /* Find TrustedUser value in sendmail.cf */ + if ((cfp = sm_io_open(SmFtStdio, SM_TIME_DEFAULT, cfile, + SM_IO_RDONLY, NULL)) == NULL) + { + sm_io_fprintf(smioerr, SM_TIME_DEFAULT, + "makemap: %s: %s\n", + cfile, sm_errstring(errno)); + exit(EX_NOINPUT); + } + while (sm_io_fgets(cfp, SM_TIME_DEFAULT, buf, sizeof(buf)) >= 0) + { + register char *b; - if ((b = strchr(buf, '\n')) != NULL) - *b = '\0'; + if ((b = strchr(buf, '\n')) != NULL) + *b = '\0'; - b = buf; - switch (*b++) - { - case 'O': /* option */ - if (strncasecmp(b, " TrustedUser", 12) == 0 && - !(isascii(b[12]) && isalnum(b[12]))) + b = buf; + switch (*b++) { - b = strchr(b, '='); - if (b == NULL) - continue; - while (isascii(*++b) && isspace(*b)) - continue; - if (isascii(*b) && isdigit(*b)) - TrustedUid = atoi(b); - else + case 'O': /* option */ + if (strncasecmp(b, " TrustedUser", 12) == 0 && + !(isascii(b[12]) && isalnum(b[12]))) { - TrustedUid = 0; - pw = getpwnam(b); - if (pw == NULL) - (void) sm_io_fprintf(smioerr, - SM_TIME_DEFAULT, - "TrustedUser: unknown user %s\n", b); + b = strchr(b, '='); + if (b == NULL) + continue; + while (isascii(*++b) && isspace(*b)) + continue; + if (isascii(*b) && isdigit(*b)) + TrustedUid = atoi(b); else - TrustedUid = pw->pw_uid; - } + { + TrustedUid = 0; + pw = getpwnam(b); + if (pw == NULL) + (void) sm_io_fprintf(smioerr, + SM_TIME_DEFAULT, + "TrustedUser: unknown user %s\n", b); + else + TrustedUid = pw->pw_uid; + } # ifdef UID_MAX - if (TrustedUid > UID_MAX) - { - (void) sm_io_fprintf(smioerr, - SM_TIME_DEFAULT, - "TrustedUser: uid value (%ld) > UID_MAX (%ld)", - (long) TrustedUid, - (long) UID_MAX); - TrustedUid = 0; - } + if (TrustedUid > UID_MAX) + { + (void) sm_io_fprintf(smioerr, + SM_TIME_DEFAULT, + "TrustedUser: uid value (%ld) > UID_MAX (%ld)", + (long) TrustedUid, + (long) UID_MAX); + TrustedUid = 0; + } # endif /* UID_MAX */ - break; - } + break; + } - default: - continue; + default: + continue; + } } + (void) sm_io_close(cfp, SM_TIME_DEFAULT); } - (void) sm_io_close(cfp, SM_TIME_DEFAULT); #endif /* HASFCHOWN */ if (!params.smdbp_allow_dup && !allowreplace) |
