diff options
Diffstat (limited to 'contrib/sendmail/src/udb.c')
-rw-r--r-- | contrib/sendmail/src/udb.c | 99 |
1 files changed, 10 insertions, 89 deletions
diff --git a/contrib/sendmail/src/udb.c b/contrib/sendmail/src/udb.c index a279afff1552c..e7f42af2ba915 100644 --- a/contrib/sendmail/src/udb.c +++ b/contrib/sendmail/src/udb.c @@ -14,9 +14,9 @@ #ifndef lint #if USERDB -static char sccsid [] = "@(#)udb.c 8.70 (Berkeley) 12/21/1998 (with USERDB)"; +static char sccsid [] = "@(#)udb.c 8.66 (Berkeley) 6/18/98 (with USERDB)"; #else -static char sccsid [] = "@(#)udb.c 8.70 (Berkeley) 12/21/1998 (without USERDB)"; +static char sccsid [] = "@(#)udb.c 8.66 (Berkeley) 6/18/98 (without USERDB)"; #endif #endif @@ -49,7 +49,6 @@ struct udbent { char *udb_spec; /* string version of spec */ int udb_type; /* type of entry */ - pid_t udb_pid; /* PID of process which opened db */ char *udb_default; /* default host for outgoing mail */ union { @@ -92,7 +91,7 @@ struct udbent #define MAXUDBENT 10 /* maximum number of UDB entries */ -struct udb_option +struct option { char *name; char *val; @@ -141,7 +140,6 @@ udbexpand(a, sendq, aliaslevel, e) register struct udbent *up; int keylen; int naddrs; - char *user; char keybuf[MAXKEY]; bzero(&key, sizeof key); @@ -166,24 +164,20 @@ udbexpand(a, sendq, aliaslevel, e) if (UdbSpec == NULL || UdbSpec[0] == '\0') return EX_OK; - /* extract user to do userdb matching on */ - user = a->q_user; - /* short circuit name begins with '\\' since it can't possibly match */ - /* (might want to treat this as unquoted instead) */ - if (user[0] == '\\') + if (a->q_user[0] == '\\') return EX_OK; /* if name is too long, assume it won't match */ - if (strlen(user) > (SIZE_T) sizeof keybuf - 12) + if (strlen(a->q_user) > (SIZE_T) sizeof keybuf - 12) return EX_OK; /* if name begins with a colon, it indicates our metadata */ - if (user[0] == ':') + if (a->q_user[0] == ':') return EX_OK; /* build actual database key */ - (void) strcpy(keybuf, user); + (void) strcpy(keybuf, a->q_user); (void) strcat(keybuf, ":maildrop"); keylen = strlen(keybuf); @@ -228,13 +222,8 @@ udbexpand(a, sendq, aliaslevel, e) #else i = 0; if (dbc == NULL && -# if DB_VERSION_MAJOR > 2 || DB_VERSION_MINOR >=6 - (errno = (*up->udb_dbp->cursor)(up->udb_dbp, - NULL, &dbc, 0)) != 0) -# else (errno = (*up->udb_dbp->cursor)(up->udb_dbp, NULL, &dbc)) != 0) -# endif i = -1; if (i != 0 || dbc == NULL || (errno = dbc->c_get(dbc, &key, @@ -903,8 +892,8 @@ _udbx_init(e) register struct hostent *h; char *mxhosts[MAXMXHOSTS + 1]; # endif - struct udb_option opts[MAXUDBOPTS + 1]; - extern int _udb_parsespec __P((char *, struct udb_option [], int)); + struct option opts[MAXUDBOPTS + 1]; + extern int _udb_parsespec __P((char *, struct option [], int)); while (*p == ' ' || *p == '\t' || *p == ',') p++; @@ -983,7 +972,6 @@ _udbx_init(e) if (h == NULL) continue; up->udb_type = UDB_REMOTE; - up->udb_pid = getpid(); up->udb_addr.sin_family = h->h_addrtype; bcopy(h->h_addr_list[0], (char *) &up->udb_addr.sin_addr, @@ -1005,7 +993,6 @@ _udbx_init(e) case '@': /* forward to remote host */ up->udb_type = UDB_FORWARD; - up->udb_pid = getpid(); up->udb_fwdhost = spec + 1; ents++; up++; @@ -1017,7 +1004,6 @@ _udbx_init(e) if (strcasecmp(spec, "hesiod") != 0) goto badspec; up->udb_type = UDB_HESIOD; - up->udb_pid = getpid(); ents++; up++; break; @@ -1080,17 +1066,7 @@ _udbx_init(e) free(up->udb_dbname); break; } - if (tTd(28, 1)) - { -#if DB_VERSION_MAJOR < 2 - printf("_udbx_init: dbopen(%s)\n", -#else - printf("_udbx_init: db_open(%s)\n", -#endif - up->udb_dbname); - } up->udb_type = UDB_DBFETCH; - up->udb_pid = getpid(); ents++; up++; break; @@ -1162,15 +1138,6 @@ badspec: #else errno = (*up->udb_dbp->close)(up->udb_dbp, 0); #endif - if (tTd(28, 1)) - { -#if DB_VERSION_MAJOR < 2 - printf("_udbx_init: db->close(%s)\n", -#else - printf("_udbx_init: db->close(%s)\n", -#endif - up->udb_dbname); - } } } #endif @@ -1180,7 +1147,7 @@ badspec: int _udb_parsespec(udbspec, opt, maxopts) char *udbspec; - struct udb_option opt[]; + struct option opt[]; int maxopts; { register char *spec; @@ -1206,52 +1173,6 @@ _udb_parsespec(udbspec, opt, maxopts) } return optnum; } -/* -** _UDBX_CLOSE -- close all file based UDB entries. -** -** Parameters: -** none -** -** Returns: -** none -*/ -void -_udbx_close() -{ - pid_t pid; - struct udbent *up; - - if (!UdbInitialized) - return; - - pid = getpid(); - - for (up = UdbEnts; up->udb_type != UDB_EOLIST; up++) - { - if (up->udb_pid != pid) - continue; - -#ifdef NEWDB - if (up->udb_type == UDB_DBFETCH) - { -#if DB_VERSION_MAJOR < 2 - (*up->udb_dbp->close)(up->udb_dbp); -#else - errno = (*up->udb_dbp->close)(up->udb_dbp, 0); -#endif - } - if (tTd(28, 1)) - { -#if DB_VERSION_MAJOR < 2 - printf("_udbx_init: db->close(%s)\n", -#else - printf("_udbx_init: db->close(%s)\n", -#endif - up->udb_dbname); - } -#endif - } -} #ifdef HESIOD |