summaryrefslogtreecommitdiff
path: root/usr.sbin/sendmail/makemap
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-12-14 21:17:55 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-12-14 21:17:55 +0000
commit608a01ad15ff5ab89386edfd559332580581c47d (patch)
tree0247c82ab4d95ed523c3f3ecf6cf792a84cb635e /usr.sbin/sendmail/makemap
parent454743c06055e0f6c7c4532bdc9b81aeab85126c (diff)
Update to Sendmail 8.8.4, plus recent patches, plus OpenBSD support.
Also include entire example configuration subset. Includes smrsh (using /usr/libexec/sm.bin). Of the top of my head, the only things I removed from the distribution were contrib/mail.local.linux, src/Makefiles, all the *.0 and *.ps files. Our praliases man page replaces the distributed one, ours is better.
Diffstat (limited to 'usr.sbin/sendmail/makemap')
-rw-r--r--usr.sbin/sendmail/makemap/Makefile3
-rw-r--r--usr.sbin/sendmail/makemap/Makefile.dist85
-rw-r--r--usr.sbin/sendmail/makemap/makemap.c54
3 files changed, 133 insertions, 9 deletions
diff --git a/usr.sbin/sendmail/makemap/Makefile b/usr.sbin/sendmail/makemap/Makefile
index a8592fec10a..94f11f9c061 100644
--- a/usr.sbin/sendmail/makemap/Makefile
+++ b/usr.sbin/sendmail/makemap/Makefile
@@ -1,8 +1,9 @@
+# $OpenBSD: Makefile,v 1.2 1996/12/14 21:16:49 downsj Exp $
# @(#)Makefile 8.1 (Berkeley) 6/7/93
PROG= makemap
MAN= makemap.8
-CFLAGS+=-I${.CURDIR}/../src -DNDBM -DNEWDB
+CFLAGS+=-I${.CURDIR}/../src -DNEWDB
.include "../../Makefile.inc"
.include <bsd.prog.mk>
diff --git a/usr.sbin/sendmail/makemap/Makefile.dist b/usr.sbin/sendmail/makemap/Makefile.dist
new file mode 100644
index 00000000000..a812b585494
--- /dev/null
+++ b/usr.sbin/sendmail/makemap/Makefile.dist
@@ -0,0 +1,85 @@
+#
+# This Makefile is designed to work on the old "make" program. It does
+# not use the obj subdirectory. It also does not install documentation
+# automatically -- think of it as a quick start for sites that have the
+# old make program (I recommend that you get and port the new make if you
+# are going to be doing any signficant work on sendmail).
+#
+# @(#)Makefile.dist 8.4 (Berkeley) 9/1/95
+#
+
+# use O=-O (usual) or O=-g (debugging)
+O= -O
+
+# location of sendmail source directory
+SRCDIR= ../src
+
+# define the database mechanisms available for map & alias lookups:
+# -DNDBM -- use new DBM
+# -DNEWDB -- use new Berkeley DB
+# The really old (V7) DBM library is no longer supported.
+#
+DBMDEF= -DNDBM -DNEWDB
+
+# environment definitions (e.g., -D_AIX3)
+ENVDEF=
+
+# see also conf.h for additional compilation flags
+
+# include directories
+INCDIRS=-I${SRCDIR} -I/usr/sww/include
+
+# loader options
+LDOPTS=
+
+# library directories
+LIBDIRS=-L/usr/sww/lib
+
+# libraries required on your system
+LIBS= -ldb -ldbm
+
+# location of makemap binary (usually /usr/sbin or /usr/etc)
+BINDIR= ${DESTDIR}/usr/sbin
+
+# additional .o files needed
+OBJADD=
+
+################### end of user configuration flags ######################
+
+CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+
+OBJS= makemap.o ${OBJADD}
+
+LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+BINOWN= bin
+BINGRP= bin
+BINMODE=555
+
+ALL= makemap makemap.0
+
+all: ${ALL}
+
+makemap: ${BEFORE} ${OBJS}
+ ${CC} -o makemap ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
+
+#NROFF= nroff -h
+NROFF= groff -Tascii
+MANDOC= -mandoc
+
+makemap.0: makemap.8
+ ${NROFF} ${MANDOC} makemap.8 > makemap.0
+
+install: install-makemap install-docs
+
+install-makemap: makemap
+ install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} makemap ${BINDIR}
+
+# doesn't actually install them -- you may want to install pre-nroff versions
+install-docs: makemap.0
+
+clean:
+ rm -f ${OBJS} makemap makemap.0
+
+# dependencies
+# gross overkill, and yet still not quite enough....
+${OBJS}: ${SRCDIR}/conf.h
diff --git a/usr.sbin/sendmail/makemap/makemap.c b/usr.sbin/sendmail/makemap/makemap.c
index 371b229a217..2e289a81641 100644
--- a/usr.sbin/sendmail/makemap/makemap.c
+++ b/usr.sbin/sendmail/makemap/makemap.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)makemap.c 8.14 (Berkeley) 11/5/95";
+static char sccsid[] = "@(#)makemap.c 8.19 (Berkeley) 11/18/96";
#endif /* not lint */
#include <stdio.h>
@@ -45,6 +45,7 @@ static char sccsid[] = "@(#)makemap.c 8.14 (Berkeley) 11/5/95";
#ifndef ISC_UNIX
# include <sys/file.h>
#endif
+#define NOT_SENDMAIL
#include "useful.h"
#include "conf.h"
@@ -95,6 +96,8 @@ main(argc, argv)
int lineno;
int st;
int mode;
+ int putflags;
+ long dbcachesize = 1024 * 1024;
enum type type;
int fd;
union
@@ -110,6 +113,7 @@ main(argc, argv)
union dbent key, val;
#ifdef NEWDB
BTREEINFO bti;
+ HASHINFO hinfo;
#endif
char ibuf[BUFSIZE];
char fbuf[MAXNAME];
@@ -120,7 +124,12 @@ main(argc, argv)
progname = argv[0];
- while ((opt = getopt(argc, argv, "Ndforv")) != EOF)
+#ifdef FFR_CFLAG
+#define OPTIONS "Nc:dforv"
+#else
+#define OPTIONS "Ndforv"
+#endif
+ while ((opt = getopt(argc, argv, OPTIONS)) != EOF)
{
switch (opt)
{
@@ -128,6 +137,12 @@ main(argc, argv)
inclnull = TRUE;
break;
+#ifdef FFR_CFLAG
+ case 'c':
+ dbcachesize = atol(optarg);
+ break;
+#endif
+
case 'd':
allowdups = TRUE;
break;
@@ -187,7 +202,11 @@ main(argc, argv)
switch (type)
{
case T_ERR:
+#ifdef FFR_CFLAG
+ fprintf(stderr, "Usage: %s [-N] [-c cachesize] [-d] [-f] [-o] [-r] [-v] type mapname\n", progname);
+#else
fprintf(stderr, "Usage: %s [-N] [-d] [-f] [-o] [-r] [-v] type mapname\n", progname);
+#endif
exit(EX_USAGE);
case T_UNKNOWN:
@@ -211,20 +230,34 @@ main(argc, argv)
bzero(&bti, sizeof bti);
if (allowdups)
bti.flags |= R_DUP;
+ if (allowdups || allowreplace)
+ putflags = 0;
+ else
+ putflags = R_NOOVERWRITE;
break;
case T_HASH:
+ bzero(&hinfo, sizeof hinfo);
+ if (allowreplace)
+ putflags = 0;
+ else
+ putflags = R_NOOVERWRITE;
+ break;
#endif
#ifdef NDBM
case T_DBM:
-#endif
if (allowdups)
{
fprintf(stderr, "%s: Type %s does not support -d (allow dups)\n",
progname, typename);
exit(EX_UNAVAILABLE);
}
+ if (allowreplace)
+ putflags = DBM_REPLACE;
+ else
+ putflags = DBM_INSERT;
break;
+#endif
}
/*
@@ -279,7 +312,11 @@ main(argc, argv)
#ifdef NEWDB
case T_HASH:
- dbp.db = dbopen(mapname, mode, 0644, DB_HASH, NULL);
+ /* tweak some parameters for performance */
+ hinfo.nelem = 4096;
+ hinfo.cachesize = dbcachesize;
+
+ dbp.db = dbopen(mapname, mode, 0644, DB_HASH, &hinfo);
if (dbp.db != NULL)
{
# if OLD_NEWDB
@@ -291,6 +328,9 @@ main(argc, argv)
break;
case T_BTREE:
+ /* tweak some parameters for performance */
+ bti.cachesize = dbcachesize;
+
dbp.db = dbopen(mapname, mode, 0644, DB_BTREE, &bti);
if (dbp.db != NULL)
{
@@ -386,16 +426,14 @@ main(argc, argv)
{
#ifdef NDBM
case T_DBM:
- st = dbm_store(dbp.dbm, key.dbm, val.dbm,
- allowreplace ? DBM_REPLACE : DBM_INSERT);
+ st = dbm_store(dbp.dbm, key.dbm, val.dbm, putflags);
break;
#endif
#ifdef NEWDB
case T_BTREE:
case T_HASH:
- st = (*dbp.db->put)(dbp.db, &key.db, &val.db,
- allowreplace ? 0 : R_NOOVERWRITE);
+ st = (*dbp.db->put)(dbp.db, &key.db, &val.db, putflags);
break;
#endif
}