diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-01-01 20:34:09 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-01-01 20:34:09 +0000 |
commit | eee2b4eb53e92b81e49de60573e674a396e7fabf (patch) | |
tree | 275b5f6fa0ac9e556790ec96876d3af0af4feaee /usr.sbin/sendmail/makemap/makemap.c | |
parent | 73ee31937b7b4ae7257f3dc1da71e8072d535784 (diff) |
sendmail 8.9.2
Diffstat (limited to 'usr.sbin/sendmail/makemap/makemap.c')
-rw-r--r-- | usr.sbin/sendmail/makemap/makemap.c | 85 |
1 files changed, 56 insertions, 29 deletions
diff --git a/usr.sbin/sendmail/makemap/makemap.c b/usr.sbin/sendmail/makemap/makemap.c index 53b5865606a..aaaba32a57a 100644 --- a/usr.sbin/sendmail/makemap/makemap.c +++ b/usr.sbin/sendmail/makemap/makemap.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)makemap.c 8.62 (Berkeley) 6/24/98"; +static char sccsid[] = "@(#)makemap.c 8.71 (Berkeley) 11/29/1998"; #endif /* not lint */ #include <sys/types.h> @@ -57,10 +57,10 @@ uid_t RunAsUid; uid_t RunAsGid; char *RunAsUserName; int Verbose = 2; -bool DontInitGroups = TRUE; +bool DontInitGroups = FALSE; long DontBlameSendmail = DBS_SAFE; u_char tTdvect[100]; -uid_t TrustedFileUid = 0; +uid_t TrustedUid = 0; #define BUFSIZE 1024 @@ -79,16 +79,20 @@ main(argc, argv) bool foldcase = TRUE; int exitstat; int opt; - char *typename; - char *mapname; - char *ext; + char *typename = NULL; + char *mapname = NULL; + char *ext = NULL; int lineno; int st; int mode; - int putflags; + int putflags = 0; +#ifdef NEWDB long dbcachesize = 1024 * 1024; +#endif enum type type; +#if !O_EXLOCK int fd; +#endif int sff = SFF_ROOTOK|SFF_REGONLY; struct passwd *pw; union @@ -116,7 +120,7 @@ main(argc, argv) #ifdef NDBM char pbuf[MAXNAME]; #endif -#if _FFR_TRUSTED_FILE_OWNER +#if _FFR_TRUSTED_USER FILE *cfp; char buf[MAXLINE]; #endif @@ -145,7 +149,7 @@ main(argc, argv) RunAsUserName = RealUserName = rnamebuf; #if _FFR_NEW_MAKEMAP_FLAGS -#define OPTIONS "C:Nc:dforsv" +#define OPTIONS "C:Nc:dflorsv" #else #define OPTIONS "C:Ndforsv" #endif @@ -163,7 +167,9 @@ main(argc, argv) #if _FFR_NEW_MAKEMAP_FLAGS case 'c': +# ifdef NEWDB dbcachesize = atol(optarg); +# endif break; #endif @@ -175,6 +181,19 @@ main(argc, argv) foldcase = FALSE; break; +#if _FFR_NEW_MAKEMAP_FLAGS + case 'l': +# ifdef NDBM + printf("dbm\n"); +# endif +# ifdef NEWDB + printf("hash\n"); + printf("btree\n"); +# endif + exit(EX_OK); + break; +#endif + case 'o': notrunc = TRUE; break; @@ -232,7 +251,7 @@ main(argc, argv) type = T_UNKNOWN; } -#if _FFR_TRUSTED_FILE_OWNER +#if _FFR_TRUSTED_USER if ((cfp = fopen(cfile, "r")) == NULL) { fprintf(stderr, "mailstats: "); @@ -250,8 +269,8 @@ main(argc, argv) switch (*b++) { case 'O': /* option */ - if (strncasecmp(b, " TrustedFileOwner", 17) == 0 && - !(isascii(b[17]) && isalnum(b[17]))) + if (strncasecmp(b, " TrustedUser", 12) == 0 && + !(isascii(b[12]) && isalnum(b[12]))) { b = strchr(b, '='); if (b == NULL) @@ -259,26 +278,26 @@ main(argc, argv) while (isascii(*++b) && isspace(*b)) continue; if (isascii(*b) && isdigit(*b)) - TrustedFileUid = atoi(b); + TrustedUid = atoi(b); else { register struct passwd *pw; - TrustedFileUid = 0; + TrustedUid = 0; pw = getpwnam(b); if (pw == NULL) fprintf(stderr, - "TrustedFileOwner: unknown user %s", b); + "TrustedUser: unknown user %s\n", b); else - TrustedFileUid = pw->pw_uid; + TrustedUid = pw->pw_uid; } # ifdef UID_MAX - if (TrustedFileUid > UID_MAX) + if (TrustedUid > UID_MAX) { - syserr("TrustedFileOwner: uid value (%ld) > UID_MAX (%ld)", - TrustedFileUid, UID_MAX); - TrustedFileUid = 0; + syserr("TrustedUser: uid value (%ld) > UID_MAX (%ld)", + TrustedUid, UID_MAX); + TrustedUid = 0; } # endif break; @@ -296,7 +315,7 @@ main(argc, argv) case T_ERR: #if _FFR_NEW_MAKEMAP_FLAGS fprintf(stderr, - "Usage: %s [-N] [-c cachesize] [-d] [-f] [-o] [-r] [-s] [-v] type mapname\n", + "Usage: %s [-N] [-c cachesize] [-d] [-f] [-l] [-o] [-r] [-s] [-v] type mapname\n", progname); #else fprintf(stderr, "Usage: %s [-N] [-d] [-f] [-o] [-r] [-s] [-v] type mapname\n", progname); @@ -505,16 +524,18 @@ main(argc, argv) dbm_close(dbp.dbm); exit(EX_CANTCREAT); } - if (geteuid() == 0 && TrustedFileUid != 0) +#if _FFR_TRUSTED_USER + if (geteuid() == 0 && TrustedUid != 0) { - if (fchown(dbm_dirfno(dbp.dbm), TrustedFileUid, -1) < 0 || - fchown(dbm_pagfno(dbp.dbm), TrustedFileUid, -1) < 0) + if (fchown(dbm_dirfno(dbp.dbm), TrustedUid, -1) < 0 || + fchown(dbm_pagfno(dbp.dbm), TrustedUid, -1) < 0) { fprintf(stderr, "WARNING: ownership change on %s failed: %s", mapname, errstring(errno)); } } +#endif break; #endif @@ -569,15 +590,17 @@ main(argc, argv) exit(EX_CANTCREAT); } (void) (*dbp.db->sync)(dbp.db, 0); - if (geteuid() == 0 && TrustedFileUid != 0) +#if _FFR_TRUSTED_USER + if (geteuid() == 0 && TrustedUid != 0) { - if (fchown(fd, TrustedFileUid, -1) < 0) + if (fchown(fd, TrustedUid, -1) < 0) { fprintf(stderr, "WARNING: ownership change on %s failed: %s", mapname, errstring(errno)); } } +#endif } break; @@ -628,15 +651,17 @@ main(argc, argv) exit(EX_CANTCREAT); } (void) (*dbp.db->sync)(dbp.db, 0); - if (geteuid() == 0 && TrustedFileUid != 0) +#if _FFR_TRUSTED_USER + if (geteuid() == 0 && TrustedUid != 0) { - if (fchown(fd, TrustedFileUid, -1) < 0) + if (fchown(fd, TrustedUid, -1) < 0) { fprintf(stderr, "WARNING: ownership change on %s failed: %s", mapname, errstring(errno)); } } +#endif } break; #endif @@ -936,10 +961,12 @@ const char * errstring(err) int err; { +#if !HASSTRERROR static char errstr[64]; -#if !HASSTRERROR && !defined(ERRLIST_PREDEFINED) +# if !defined(ERRLIST_PREDEFINED) extern char *sys_errlist[]; extern int sys_nerr; +# endif #endif /* handle pseudo-errors internal to sendmail */ |