/*
* Copyright (c) 1998-2002, 2004, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1992 Eric P. Allman. All rights reserved.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
"@(#) Copyright (c) 1998-2002, 2004 Sendmail, 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")
#ifndef ISC_UNIX
#endif /* ! ISC_UNIX */
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef EX_OK
#endif /* EX_OK */
#include <sysexits.h>
#include <sendmail/sendmail.h>
#include <sendmail/pathnames.h>
char *RealUserName;
char *RunAsUserName;
bool DontInitGroups = false;
static void
char *progname;
{
"Usage: %s [-C cffile] [-N] [-c cachesize] [-D commentchar]\n",
progname);
" %*s [-d] [-e] [-f] [-l] [-o] [-r] [-s] [-t delimiter]\n",
" %*s [-u] [-v] type mapname\n",
}
int
int argc;
char **argv;
{
char *progname;
char *cfile;
bool inclnull = false;
bool notrunc = false;
bool allowreplace = false;
bool allowempty = false;
bool verbose = false;
bool foldcase = true;
bool unmake = false;
int exitstat;
int opt;
unsigned int lineno;
int st;
int mode;
int smode;
int putflags = 0;
#if HASFCHOWN
#endif /* HASFCHOWN */
extern char *optarg;
extern int optind;
progname++;
else
else
"Unknown UID %d", (int) RealUid);
{
switch (opt)
{
case 'C':
break;
case 'N':
inclnull = true;
break;
case 'c':
break;
case 'd':
params.smdbp_allow_dup = true;
break;
case 'e':
allowempty = true;
break;
case 'f':
foldcase = false;
break;
case 'D':
break;
case 'l':
break;
case 'o':
notrunc = true;
break;
case 'r':
allowreplace = true;
break;
case 's':
break;
case 't':
{
"Invalid separator\n");
break;
}
break;
case 'u':
unmake = true;
break;
case 'v':
verbose = true;
break;
default:
/* NOTREACHED */
}
}
sff |= SFF_NOSLINK;
sff |= SFF_NOHLINK;
sff |= SFF_NOWLINK;
if (argc != 2)
{
/* NOTREACHED */
}
else
{
}
#if HASFCHOWN
/* Find TrustedUser value in sendmail.cf */
{
}
{
register char *b;
*b = '\0';
b = buf;
switch (*b++)
{
case 'O': /* option */
{
b = strchr(b, '=');
if (b == NULL)
continue;
continue;
TrustedUid = atoi(b);
else
{
TrustedUid = 0;
(void) sm_io_fprintf(smioerr,
"TrustedUser: unknown user %s\n", b);
else
}
# ifdef UID_MAX
if (TrustedUid > UID_MAX)
{
(void) sm_io_fprintf(smioerr,
"TrustedUser: uid value (%ld) > UID_MAX (%ld)",
(long) TrustedUid,
(long) UID_MAX);
TrustedUid = 0;
}
# endif /* UID_MAX */
break;
}
default:
continue;
}
}
#endif /* HASFCHOWN */
if (unmake)
{
}
else
{
if (!notrunc)
{
}
}
{
char *hint;
if (errno == SMDBE_UNSUPPORTED_DB_TYPE &&
"%s: Need to recompile with -D%s for %s support\n",
else
"%s: error opening type %s map %s: %s\n",
}
{
{
"WARNING: ownership change on %s failed %s",
}
}
/*
** Copy the data
*/
if (unmake)
{
{
"%s: cannot make cursor for type %s map %s\n",
}
{
break;
"%.*s%c%.*s\n",
}
}
else
{
lineno = 0;
!= NULL)
{
register char *p;
lineno++;
/*
** Parse the line.
*/
if (p != NULL)
*p = '\0';
{
"%s: %s: line %u: line too long (%ld bytes max)\n",
(long) sizeof ibuf);
continue;
}
continue;
{
"%s: %s: line %u: syntax error (leading space)\n",
continue;
}
{
*p = tolower(*p);
}
if (inclnull)
if (*p != '\0')
*p++ = '\0';
while (*p != '\0' && ISSEP(*p))
p++;
if (!allowempty && *p == '\0')
{
"%s: %s: line %u: no RHS for LHS %s\n",
continue;
}
if (inclnull)
/*
** Do the database insert.
*/
if (verbose)
{
"key=`%s', val=`%s'\n",
}
putflags);
switch (errno)
{
case SMDBE_KEY_EXIST:
st = 1;
break;
case 0:
st = 0;
break;
default:
st = -1;
break;
}
if (st < 0)
{
"%s: %s: line %u: key %s: put error: %s\n",
}
else if (st > 0)
{
"%s: %s: line %u: key %s: duplicate key\n",
}
}
}
/*
** Now close the database.
*/
{
"%s: close(%s): %s\n",
}
/* NOTREACHED */
return exitstat;
}