/*
* Copyright (c) 1998-2001, 2008 Proofpoint, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 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.
*
*/
"@(#) Copyright (c) 1998-2001 Proofpoint, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1983 Eric P. Allman. All rights reserved.\n\
Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n")
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef EX_OK
#endif /* EX_OK */
#include <sysexits.h>
#ifndef NOT_SENDMAIL
# define NOT_SENDMAIL
#endif /* ! NOT_SENDMAIL */
#include <sendmail/sendmail.h>
#include <sendmail/pathnames.h>
char *RealUserName;
char *RunAsUserName;
bool DontInitGroups = false;
int
int argc;
char **argv;
{
char *cfile;
int ch;
extern char *optarg;
extern int optind;
{
}
else
"Unknown UID %d", (int) RealUid);
{
switch ((char)ch) {
case 'C':
break;
case 'f':
break;
case '?':
default:
"usage: praliases [-C cffile] [-f aliasfile]"
" [key ...]\n");
}
}
{
}
{
"praliases: %s: %s\n", cfile,
}
{
register char *b, *p;
if (b != NULL)
*b = '\0';
b = buf;
switch (*b++)
{
case 'O': /* option -- see if alias file */
{
/* new form -- find value */
b = strchr(b, '=');
if (b == NULL)
continue;
continue;
}
else if (*b++ != 'A')
{
/* something else boring */
continue;
}
/* this is the A or AliasFile option -- save it */
sizeof afilebuf)
{
"praliases: AliasFile filename too long: %.30s\n",
b);
}
b = afilebuf;
for (p = b; p != NULL; )
{
p++;
if (*p == '\0')
break;
b = p;
p = strpbrk(p, DELIMITERS);
/* find end of spec */
if (p != NULL)
{
bool quoted = false;
for (; *p != '\0'; p++)
{
/*
** Don't break into a quoted
** string.
*/
if (*p == '"')
else if (*p == ',' && !quoted)
break;
}
/* No more alias specs follow */
if (*p == '\0')
{
/* chop trailing whitespace */
while (isascii(*p) &&
isspace(*p) &&
p > b)
p--;
*p = '\0';
p = NULL;
}
}
if (p != NULL)
{
char *e = p - 1;
/* chop trailing whitespace */
while (isascii(*e) &&
isspace(*e) &&
e > b)
e--;
*++e = '\0';
*p++ = '\0';
}
}
default:
continue;
}
}
/* NOTREACHED */
return EX_OK;
}
static void
char *filename;
int argc;
char **argv;
{
int result;
char *colon;
char *db_name;
char *db_type;
{
}
else
{
*colon = '\0';
}
/* clean off arguments */
for (;;)
{
db_name++;
if (*db_name != '-')
break;
while (*db_name != '\0' &&
db_name++;
}
/* Skip non-file based DB types */
{
if (db_type != SMDB_TYPE_DEFAULT &&
{
"praliases: Skipping non-file based alias type %s\n",
db_type);
return;
}
}
{
*colon = ':';
"praliases: illegal alias specification: %s\n", filename);
goto fatal;
}
{
"praliases: %s: open: %s\n",
goto fatal;
}
if (argc == 0)
{
{
"praliases: %s: set cursor: %s\n", db_name,
goto fatal;
}
SMDB_CURSOR_GET_NEXT)) ==
{
#if 0
/* skip magic @:@ entry */
continue;
#endif /* 0 */
"%.*s:%.*s\n",
}
{
"praliases: %s: get value at cursor: %s\n",
goto fatal;
}
}
{
int get_res;
if (get_res == SMDBE_NOT_FOUND)
{
&db_value, 0);
}
{
"%.*s:%.*s\n",
}
else
"%s: No such key\n",
}
*colon = ':';
return;
}