summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/makemap
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-01-12 12:38:06 +0000
committerpeter <peter@FreeBSD.org>1999-01-12 12:38:06 +0000
commit5b758ef6d89ac3abe22adbdc3386c76d72691136 (patch)
tree6c4f3826ab567145a7eba959bc71c7eab01748b1 /contrib/sendmail/makemap
parent6788eff0e6370de72568309d3a8b1891341b0991 (diff)
downloadFreeBSD-src-5b758ef6d89ac3abe22adbdc3386c76d72691136.zip
FreeBSD-src-5b758ef6d89ac3abe22adbdc3386c76d72691136.tar.gz
Merge sendmail 8.9.1 -> 8.9.2 changes into mainline. Some of our changes
were submitted back to sendmail.org (stage 1) and were incorporated.
Diffstat (limited to 'contrib/sendmail/makemap')
-rw-r--r--contrib/sendmail/makemap/makemap.c85
1 files changed, 56 insertions, 29 deletions
diff --git a/contrib/sendmail/makemap/makemap.c b/contrib/sendmail/makemap/makemap.c
index 5891d75..9717a43 100644
--- a/contrib/sendmail/makemap/makemap.c
+++ b/contrib/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 */
OpenPOWER on IntegriCloud