SCCS-vsn: usr.sbin/sendmail/src/recipient.c 5.24
SCCS-vsn: usr.sbin/sendmail/src/version.c 5.84
SCCS-vsn: usr.sbin/sendmail/src/udb.c 5.14
-static char sccsid[] = "@(#)recipient.c 5.23 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c 5.24 (Berkeley) %G%";
#endif /* not lint */
# include <sys/types.h>
#endif /* not lint */
# include <sys/types.h>
alias(a, sendq);
# ifdef USERDB
alias(a, sendq);
# ifdef USERDB
- /* if not aliased, look it up in the user database */
+ /* if not aliased, look it up in the user database */
if (!bitset(QDONTSEND|QNOTREMOTE, a->q_flags))
if (!bitset(QDONTSEND|QNOTREMOTE, a->q_flags))
+ {
+ extern int udbexpand();
+
+ if (udbexpand(a, sendq) == EX_TEMPFAIL)
+ {
+ a->q_flags |= QQUEUEUP;
+ if (CurEnv->e_message == NULL)
+ CurEnv->e_message = newstr("Deferred: user database error");
+# ifdef LOG
+ if (LogLevel > 3)
+ syslog(LOG_INFO, "%s: deferred: udbexpand",
+ CurEnv->e_id);
+# endif
+ message(Arpa_Info, "queued (user database error)");
+ return (a);
+ }
+ }
#ifndef lint
#ifdef USERDB
#ifndef lint
#ifdef USERDB
-static char sccsid [] = "@(#)udb.c 5.13 (Berkeley) %G% (with USERDB)";
+static char sccsid [] = "@(#)udb.c 5.14 (Berkeley) %G% (with USERDB)";
-static char sccsid [] = "@(#)udb.c 5.13 (Berkeley) %G% (without USERDB)";
+static char sccsid [] = "@(#)udb.c 5.14 (Berkeley) %G% (without USERDB)";
#include <sys/file.h>
#include <sys/time.h>
#include <sys/file.h>
#include <sys/time.h>
#include <fcntl.h>
#include <netdb.h>
#include <db.h>
#include <fcntl.h>
#include <netdb.h>
#include <db.h>
** sendq -- pointer to head of sendq to put the expansions in.
**
** Returns:
** sendq -- pointer to head of sendq to put the expansions in.
**
** Returns:
+** EX_TEMPFAIL -- if something "odd" happened -- probably due
+** to accessing a file on an NFS server that is down.
+** EX_OK -- otherwise.
**
** Side Effects:
** Modifies sendq.
**
** Side Effects:
** Modifies sendq.
struct udbent UdbEnts[MAXUDBENT + 1];
int UdbSock = -1;
struct udbent UdbEnts[MAXUDBENT + 1];
int UdbSock = -1;
udbexpand(a, sendq)
register ADDRESS *a;
ADDRESS **sendq;
udbexpand(a, sendq)
register ADDRESS *a;
ADDRESS **sendq;
/* make certain we are supposed to send to this address */
if (bitset(QDONTSEND, a->q_flags))
/* make certain we are supposed to send to this address */
if (bitset(QDONTSEND, a->q_flags))
CurEnv->e_to = a->q_paddr;
/* on first call, locate the database */
if (firstcall)
{
CurEnv->e_to = a->q_paddr;
/* on first call, locate the database */
if (firstcall)
{
- extern void _udbx_init();
+ extern int _udbx_init();
+ if (_udbx_init() == EX_TEMPFAIL)
+ return EX_TEMPFAIL;
firstcall = FALSE;
}
/* short circuit the process if no chance of a match */
if (UdbSpec == NULL || UdbSpec[0] == '\0')
firstcall = FALSE;
}
/* short circuit the process if no chance of a match */
if (UdbSpec == NULL || UdbSpec[0] == '\0')
/* if name is too long, assume it won't match */
if (strlen(a->q_user) > sizeof keybuf - 12)
/* if name is too long, assume it won't match */
if (strlen(a->q_user) > sizeof keybuf - 12)
/* if name begins with a colon, it indicates our metadata */
if (a->q_user[0] == ':')
/* if name begins with a colon, it indicates our metadata */
if (a->q_user[0] == ':')
/* build actual database key */
(void) strcpy(keybuf, a->q_user);
/* build actual database key */
(void) strcpy(keybuf, a->q_user);
key.data = keybuf;
key.size = keylen;
i = (*up->udb_dbp->seq)(up->udb_dbp, &key, &info, R_CURSOR);
key.data = keybuf;
key.size = keylen;
i = (*up->udb_dbp->seq)(up->udb_dbp, &key, &info, R_CURSOR);
- if (i != 0 || info.size <= 0)
+ if (i > 0 || info.size <= 0)
- if (i < 0)
- syserr("udbexpand: db-get stat %s");
if (tTd(28, 2))
printf("expand: no match on %s\n", keybuf);
continue;
if (tTd(28, 2))
printf("expand: no match on %s\n", keybuf);
continue;
/* get the next record */
i = (*up->udb_dbp->seq)(up->udb_dbp, &key, &info, R_NEXT);
}
/* get the next record */
i = (*up->udb_dbp->seq)(up->udb_dbp, &key, &info, R_NEXT);
}
+ if (i < 0)
+ {
+ syserr("udbexpand: db-get stat %s");
+ return EX_TEMPFAIL;
+ }
_udbx_init()
{
register char *p;
_udbx_init()
{
register char *p;
case '/': /* look up remote name */
up->udb_dbname = spec;
case '/': /* look up remote name */
up->udb_dbname = spec;
up->udb_dbp = dbopen(spec, O_RDONLY, 0644, DB_BTREE, NULL);
if (up->udb_dbp == NULL)
up->udb_dbp = dbopen(spec, O_RDONLY, 0644, DB_BTREE, NULL);
if (up->udb_dbp == NULL)
+ {
+ if (errno != ENOENT && errno != EACCES)
+ return EX_TEMPFAIL;
up->udb_type = UDB_LOOKUP;
up++;
break;
up->udb_type = UDB_LOOKUP;
up++;
break;
switch (up->udb_type)
{
case UDB_EOLIST:
switch (up->udb_type)
{
case UDB_EOLIST:
case UDB_REMOTE:
printf("REMOTE: addr %s, timeo %d\n",
case UDB_REMOTE:
printf("REMOTE: addr %s, timeo %d\n",
udbexpand(a, sendq)
ADDRESS *a;
ADDRESS **sendq;
{
udbexpand(a, sendq)
ADDRESS *a;
ADDRESS **sendq;
{
-static char sccsid[] = "@(#)version.c 5.83 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c 5.84 (Berkeley) %G%";
-char Version[] = "5.83";
+char Version[] = "5.84";