home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-08-14 | 32.6 KB | 1,704 lines |
- head 5.21;
- branch 5.21.0;
- access;
- symbols
- RELEASE:5.21.0.21
- BETA:5.21.0.17
- UICSO:5.21.0
- VANILLA:5.21;
- locks; strict;
- comment @ * @;
-
-
- 5.21
- date 90.06.20.08.35.01; author paul; state Exp;
- branches
- 5.21.0.1;
- next ;
-
- 5.21.0.1
- date 90.06.20.09.42.28; author paul; state Exp;
- branches;
- next 5.21.0.2;
-
- 5.21.0.2
- date 90.06.25.09.19.29; author paul; state Exp;
- branches;
- next 5.21.0.3;
-
- 5.21.0.3
- date 90.08.02.14.37.37; author paul; state Exp;
- branches;
- next 5.21.0.4;
-
- 5.21.0.4
- date 90.08.27.17.14.39; author paul; state Exp;
- branches;
- next 5.21.0.5;
-
- 5.21.0.5
- date 90.09.17.09.34.01; author paul; state Exp;
- branches;
- next 5.21.0.6;
-
- 5.21.0.6
- date 90.10.13.17.39.29; author paul; state Exp;
- branches;
- next 5.21.0.7;
-
- 5.21.0.7
- date 90.11.19.16.12.54; author paul; state Exp;
- branches;
- next 5.21.0.8;
-
- 5.21.0.8
- date 90.11.24.02.18.57; author paul; state Exp;
- branches;
- next 5.21.0.9;
-
- 5.21.0.9
- date 91.01.19.19.26.02; author paul; state Exp;
- branches;
- next 5.21.0.10;
-
- 5.21.0.10
- date 91.02.15.20.15.20; author paul; state Exp;
- branches;
- next 5.21.0.11;
-
- 5.21.0.11
- date 91.02.17.02.49.44; author paul; state Exp;
- branches;
- next 5.21.0.12;
-
- 5.21.0.12
- date 91.03.04.21.48.23; author paul; state Exp;
- branches;
- next 5.21.0.13;
-
- 5.21.0.13
- date 91.04.02.23.06.52; author paul; state Exp;
- branches;
- next 5.21.0.14;
-
- 5.21.0.14
- date 91.04.05.14.55.15; author paul; state Exp;
- branches;
- next 5.21.0.15;
-
- 5.21.0.15
- date 91.05.18.03.39.58; author paul; state Exp;
- branches;
- next 5.21.0.16;
-
- 5.21.0.16
- date 91.05.23.21.16.31; author paul; state Exp;
- branches;
- next 5.21.0.17;
-
- 5.21.0.17
- date 91.05.29.05.11.52; author paul; state Exp;
- branches;
- next 5.21.0.18;
-
- 5.21.0.18
- date 91.06.05.02.20.56; author paul; state Exp;
- branches;
- next 5.21.0.19;
-
- 5.21.0.19
- date 91.06.13.17.16.44; author paul; state Exp;
- branches;
- next 5.21.0.20;
-
- 5.21.0.20
- date 91.06.13.19.53.29; author paul; state Exp;
- branches;
- next 5.21.0.21;
-
- 5.21.0.21
- date 91.06.21.12.16.37; author paul; state Exp;
- branches;
- next 5.21.0.22;
-
- 5.21.0.22
- date 91.07.11.05.34.08; author paul; state Exp;
- branches;
- next 5.21.0.23;
-
- 5.21.0.23
- date 91.08.08.22.13.25; author paul; state Exp;
- branches;
- next 5.21.0.24;
-
- 5.21.0.24
- date 91.08.14.16.56.42; author paul; state Exp;
- branches;
- next ;
-
-
- desc
- @@
-
-
- 5.21
- log
- @5.64 Berkeley release
- @
- text
- @/*
- * Copyright (c) 1983 Eric P. Allman
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted provided
- * that: (1) source distributions retain this entire copyright notice and
- * comment, and (2) distributions including binaries display the following
- * acknowledgement: ``This product includes software developed by the
- * University of California, Berkeley and its contributors'' in the
- * documentation or other materials provided with the distribution and in
- * all advertising materials mentioning features or use of this software.
- * Neither the name of the University nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
- #ifndef lint
- #ifdef DBM
- static char sccsid[] = "@@(#)alias.c 5.21 (Berkeley) 6/1/90 (with DBM)";
- #else
- static char sccsid[] = "@@(#)alias.c 5.21 (Berkeley) 6/1/90 (without DBM)";
- #endif
- #endif /* not lint */
-
- # include <sys/types.h>
- # include <sys/stat.h>
- # include <signal.h>
- # include <errno.h>
- # include "sendmail.h"
- # include <sys/file.h>
- # include <pwd.h>
-
- /*
- ** ALIAS -- Compute aliases.
- **
- ** Scans the alias file for an alias for the given address.
- ** If found, it arranges to deliver to the alias list instead.
- ** Uses libdbm database if -DDBM.
- **
- ** Parameters:
- ** a -- address to alias.
- ** sendq -- a pointer to the head of the send queue
- ** to put the aliases in.
- **
- ** Returns:
- ** none
- **
- ** Side Effects:
- ** Aliases found are expanded.
- **
- ** Notes:
- ** If NoAlias (the "-n" flag) is set, no aliasing is
- ** done.
- **
- ** Deficiencies:
- ** It should complain about names that are aliased to
- ** nothing.
- */
-
-
- #ifdef DBM
- typedef struct
- {
- char *dptr;
- int dsize;
- } DATUM;
- extern DATUM fetch();
- #endif DBM
-
- alias(a, sendq)
- register ADDRESS *a;
- ADDRESS **sendq;
- {
- register char *p;
- extern char *aliaslookup();
-
- if (tTd(27, 1))
- printf("alias(%s)\n", a->q_paddr);
-
- /* don't realias already aliased names */
- if (bitset(QDONTSEND, a->q_flags))
- return;
-
- CurEnv->e_to = a->q_paddr;
-
- /*
- ** Look up this name
- */
-
- if (NoAlias)
- p = NULL;
- else
- p = aliaslookup(a->q_user);
- if (p == NULL)
- return;
-
- /*
- ** Match on Alias.
- ** Deliver to the target list.
- */
-
- if (tTd(27, 1))
- printf("%s (%s, %s) aliased to %s\n",
- a->q_paddr, a->q_host, a->q_user, p);
- message(Arpa_Info, "aliased to %s", p);
- AliasLevel++;
- sendtolist(p, a, sendq);
- AliasLevel--;
- }
- /*
- ** ALIASLOOKUP -- look up a name in the alias file.
- **
- ** Parameters:
- ** name -- the name to look up.
- **
- ** Returns:
- ** the value of name.
- ** NULL if unknown.
- **
- ** Side Effects:
- ** none.
- **
- ** Warnings:
- ** The return value will be trashed across calls.
- */
-
- char *
- aliaslookup(name)
- char *name;
- {
- # ifdef DBM
- DATUM rhs, lhs;
-
- /* create a key for fetch */
- lhs.dptr = name;
- lhs.dsize = strlen(name) + 1;
- rhs = fetch(lhs);
- return (rhs.dptr);
- # else DBM
- register STAB *s;
-
- s = stab(name, ST_ALIAS, ST_FIND);
- if (s == NULL)
- return (NULL);
- return (s->s_alias);
- # endif DBM
- }
- /*
- ** INITALIASES -- initialize for aliasing
- **
- ** Very different depending on whether we are running DBM or not.
- **
- ** Parameters:
- ** aliasfile -- location of aliases.
- ** init -- if set and if DBM, initialize the DBM files.
- **
- ** Returns:
- ** none.
- **
- ** Side Effects:
- ** initializes aliases:
- ** if DBM: opens the database.
- ** if ~DBM: reads the aliases into the symbol table.
- */
-
- # define DBMMODE 0644
-
- initaliases(aliasfile, init)
- char *aliasfile;
- bool init;
- {
- #ifdef DBM
- int atcnt;
- time_t modtime;
- bool automatic = FALSE;
- char buf[MAXNAME];
- #endif DBM
- struct stat stb;
- static bool initialized = FALSE;
-
- if (initialized)
- return;
- initialized = TRUE;
-
- if (aliasfile == NULL || stat(aliasfile, &stb) < 0)
- {
- if (aliasfile != NULL && init)
- syserr("Cannot open %s", aliasfile);
- NoAlias = TRUE;
- errno = 0;
- return;
- }
-
- # ifdef DBM
- /*
- ** Check to see that the alias file is complete.
- ** If not, we will assume that someone died, and it is up
- ** to us to rebuild it.
- */
-
- if (!init)
- dbminit(aliasfile);
- atcnt = SafeAlias * 2;
- if (atcnt > 0)
- {
- while (!init && atcnt-- >= 0 && aliaslookup("@@") == NULL)
- {
- /*
- ** Reinitialize alias file in case the new
- ** one is mv'ed in instead of cp'ed in.
- **
- ** Only works with new DBM -- old one will
- ** just consume file descriptors forever.
- ** If you have a dbmclose() it can be
- ** added before the sleep(30).
- */
-
- sleep(30);
- # ifdef NDBM
- dbminit(aliasfile);
- # endif NDBM
- }
- }
- else
- atcnt = 1;
-
- /*
- ** See if the DBM version of the file is out of date with
- ** the text version. If so, go into 'init' mode automatically.
- ** This only happens if our effective userid owns the DBM.
- ** Note the unpalatable hack to see if the stat succeeded.
- */
-
- modtime = stb.st_mtime;
- (void) strcpy(buf, aliasfile);
- (void) strcat(buf, ".pag");
- stb.st_ino = 0;
- if (!init && (stat(buf, &stb) < 0 || stb.st_mtime < modtime || atcnt < 0))
- {
- errno = 0;
- if (AutoRebuild && stb.st_ino != 0 && stb.st_uid == geteuid())
- {
- init = TRUE;
- automatic = TRUE;
- message(Arpa_Info, "rebuilding alias database");
- #ifdef LOG
- if (LogLevel >= 7)
- syslog(LOG_INFO, "rebuilding alias database");
- #endif LOG
- }
- else
- {
- #ifdef LOG
- if (LogLevel >= 7)
- syslog(LOG_INFO, "alias database out of date");
- #endif LOG
- message(Arpa_Info, "Warning: alias database out of date");
- }
- }
-
-
- /*
- ** If necessary, load the DBM file.
- ** If running without DBM, load the symbol table.
- */
-
- if (init)
- {
- #ifdef LOG
- if (LogLevel >= 6)
- {
- extern char *username();
-
- syslog(LOG_NOTICE, "alias database %srebuilt by %s",
- automatic ? "auto" : "", username());
- }
- #endif LOG
- readaliases(aliasfile, TRUE);
- }
- # else DBM
- readaliases(aliasfile, init);
- # endif DBM
- }
- /*
- ** READALIASES -- read and process the alias file.
- **
- ** This routine implements the part of initaliases that occurs
- ** when we are not going to use the DBM stuff.
- **
- ** Parameters:
- ** aliasfile -- the pathname of the alias file master.
- ** init -- if set, initialize the DBM stuff.
- **
- ** Returns:
- ** none.
- **
- ** Side Effects:
- ** Reads aliasfile into the symbol table.
- ** Optionally, builds the .dir & .pag files.
- */
-
- static
- readaliases(aliasfile, init)
- char *aliasfile;
- bool init;
- {
- register char *p;
- char *rhs;
- bool skipping;
- int naliases, bytes, longest;
- FILE *af;
- void (*oldsigint)();
- ADDRESS al, bl;
- register STAB *s;
- char line[BUFSIZ];
-
- if ((af = fopen(aliasfile, "r")) == NULL)
- {
- if (tTd(27, 1))
- printf("Can't open %s\n", aliasfile);
- errno = 0;
- NoAlias++;
- return;
- }
-
- # ifdef DBM
- /* see if someone else is rebuilding the alias file already */
- if (flock(fileno(af), LOCK_EX | LOCK_NB) < 0 && errno == EWOULDBLOCK)
- {
- /* yes, they are -- wait until done and then return */
- message(Arpa_Info, "Alias file is already being rebuilt");
- if (OpMode != MD_INITALIAS)
- {
- /* wait for other rebuild to complete */
- (void) flock(fileno(af), LOCK_EX);
- }
- (void) fclose(af);
- errno = 0;
- return;
- }
- # endif DBM
-
- /*
- ** If initializing, create the new DBM files.
- */
-
- if (init)
- {
- oldsigint = signal(SIGINT, SIG_IGN);
- (void) strcpy(line, aliasfile);
- (void) strcat(line, ".dir");
- if (close(creat(line, DBMMODE)) < 0)
- {
- syserr("cannot make %s", line);
- (void) signal(SIGINT, oldsigint);
- return;
- }
- (void) strcpy(line, aliasfile);
- (void) strcat(line, ".pag");
- if (close(creat(line, DBMMODE)) < 0)
- {
- syserr("cannot make %s", line);
- (void) signal(SIGINT, oldsigint);
- return;
- }
- dbminit(aliasfile);
- }
-
- /*
- ** Read and interpret lines
- */
-
- FileName = aliasfile;
- LineNumber = 0;
- naliases = bytes = longest = 0;
- skipping = FALSE;
- while (fgets(line, sizeof (line), af) != NULL)
- {
- int lhssize, rhssize;
-
- LineNumber++;
- p = index(line, '\n');
- if (p != NULL)
- *p = '\0';
- switch (line[0])
- {
- case '#':
- case '\0':
- skipping = FALSE;
- continue;
-
- case ' ':
- case '\t':
- if (!skipping)
- syserr("Non-continuation line starts with space");
- skipping = TRUE;
- continue;
- }
- skipping = FALSE;
-
- /*
- ** Process the LHS
- ** Find the final colon, and parse the address.
- ** It should resolve to a local name -- this will
- ** be checked later (we want to optionally do
- ** parsing of the RHS first to maximize error
- ** detection).
- */
-
- for (p = line; *p != '\0' && *p != ':' && *p != '\n'; p++)
- continue;
- if (*p++ != ':')
- {
- syserr("missing colon");
- continue;
- }
- if (parseaddr(line, &al, 1, ':') == NULL)
- {
- syserr("illegal alias name");
- continue;
- }
- loweraddr(&al);
-
- /*
- ** Process the RHS.
- ** 'al' is the internal form of the LHS address.
- ** 'p' points to the text of the RHS.
- */
-
- rhs = p;
- for (;;)
- {
- register char c;
-
- if (init && CheckAliases)
- {
- /* do parsing & compression of addresses */
- while (*p != '\0')
- {
- extern char *DelimChar;
-
- while (isspace(*p) || *p == ',')
- p++;
- if (*p == '\0')
- break;
- if (parseaddr(p, &bl, -1, ',') == NULL)
- usrerr("%s... bad address", p);
- p = DelimChar;
- }
- }
- else
- {
- p = &p[strlen(p)];
- if (p[-1] == '\n')
- *--p = '\0';
- }
-
- /* see if there should be a continuation line */
- c = fgetc(af);
- if (!feof(af))
- (void) ungetc(c, af);
- if (c != ' ' && c != '\t')
- break;
-
- /* read continuation line */
- if (fgets(p, sizeof line - (p - line), af) == NULL)
- break;
- LineNumber++;
- }
- if (al.q_mailer != LocalMailer)
- {
- syserr("cannot alias non-local names");
- continue;
- }
-
- /*
- ** Insert alias into symbol table or DBM file
- */
-
- lhssize = strlen(al.q_user) + 1;
- rhssize = strlen(rhs) + 1;
-
- # ifdef DBM
- if (init)
- {
- DATUM key, content;
-
- key.dsize = lhssize;
- key.dptr = al.q_user;
- content.dsize = rhssize;
- content.dptr = rhs;
- store(key, content);
- }
- else
- # endif DBM
- {
- s = stab(al.q_user, ST_ALIAS, ST_ENTER);
- s->s_alias = newstr(rhs);
- }
-
- /* statistics */
- naliases++;
- bytes += lhssize + rhssize;
- if (rhssize > longest)
- longest = rhssize;
- }
-
- # ifdef DBM
- if (init)
- {
- /* add the distinquished alias "@@" */
- DATUM key;
-
- key.dsize = 2;
- key.dptr = "@@";
- store(key, key);
-
- /* restore the old signal */
- (void) signal(SIGINT, oldsigint);
- }
- # endif DBM
-
- /* closing the alias file drops the lock */
- (void) fclose(af);
- CurEnv->e_to = NULL;
- FileName = NULL;
- message(Arpa_Info, "%d aliases, longest %d bytes, %d bytes total",
- naliases, longest, bytes);
- # ifdef LOG
- if (LogLevel >= 8)
- syslog(LOG_INFO, "%d aliases, longest %d bytes, %d bytes total",
- naliases, longest, bytes);
- # endif LOG
- }
- /*
- ** FORWARD -- Try to forward mail
- **
- ** This is similar but not identical to aliasing.
- **
- ** Parameters:
- ** user -- the name of the user who's mail we would like
- ** to forward to. It must have been verified --
- ** i.e., the q_home field must have been filled
- ** in.
- ** sendq -- a pointer to the head of the send queue to
- ** put this user's aliases in.
- **
- ** Returns:
- ** none.
- **
- ** Side Effects:
- ** New names are added to send queues.
- */
-
- forward(user, sendq)
- ADDRESS *user;
- ADDRESS **sendq;
- {
- char buf[60];
- extern bool safefile();
-
- if (tTd(27, 1))
- printf("forward(%s)\n", user->q_paddr);
-
- if (user->q_mailer != LocalMailer || bitset(QBADADDR, user->q_flags))
- return;
- if (user->q_home == NULL)
- syserr("forward: no home");
-
- /* good address -- look for .forward file in home */
- define('z', user->q_home, CurEnv);
- expand("\001z/.forward", buf, &buf[sizeof buf - 1], CurEnv);
- if (!safefile(buf, user->q_uid, S_IREAD))
- return;
-
- /* we do have an address to forward to -- do it */
- include(buf, "forwarding", user, sendq);
- }
- @
-
-
- 5.21.0.1
- log
- @IDA patches
- @
- text
- @d65 6
- a70 1
- #if defined(DBM) && !defined(NDBM) && !defined(SDBM)
- d72 1
- a72 1
- #endif /* DBM && !NDBM && !SDBM */
- d82 1
- a82 1
- printf("alias(%s)\n", a->q_user);
- d128 1
- a128 2
- ** The return value will be trashed across calls
- ** unless NDBM or SDBM is defined and we're using mapkey().
- a135 12
- # if defined(NDBM) || defined(SDBM)
- char *newname;
-
- if (tTd(27, 3))
- printf("aliaslookup(\"%s\") => ", name);
- newname = (char *) mapkey(DB_ALIAS, name, 0, 0);
- if (tTd(27, 3))
- printf("%s\n", newname == NULL ? "NOT_FOUND" : newname);
- return newname;
-
- # else /* !NDBM && !SDBM */
-
- a136 1
- char *lowname = xalloc(strlen(name) + 1); /* potential space hog */
- d139 1
- a139 3
- (void) strcpy(lowname, name);
- (void) makelower(lowname);
- lhs.dptr = lowname;
- a140 2
- if (tTd(27, 3))
- printf("aliaslookup(\"%s\") => ", lhs.dptr);
- a141 3
- if (tTd(27, 3))
- printf("%s\n", rhs.dptr == NULL ? "NOT_FOUND" : rhs.dptr);
- (void) free(lowname);
- d143 1
- a143 2
- # endif /* NDBM || SDBM */
- # else /* !DBM */
- a146 2
- if (tTd(27, 3))
- printf("%s\n", s == NULL ? "NOT_FOUND" : s->s_alias);
- d150 1
- a150 1
- # endif /* DBM */
- d158 1
- d172 2
- a173 1
- initaliases(init)
- d181 1
- a181 1
- #endif /* DBM */
- d189 1
- a189 8
- if (AliasFile == NULL ||
- #ifdef YPMARK
- (AliasFile[0] != YPMARK &&
- #endif /* YPMARK */
- stat(AliasFile, &stb) < 0)
- #ifdef YPMARK
- )
- #endif /* YPMARK */
- d191 2
- a192 2
- if (AliasFile != NULL && init)
- syserr("Cannot open %s", AliasFile);
- a204 1
- #if !defined(NDBM) && !defined(SDBM)
- d206 1
- a206 2
- dbminit(AliasFile);
- #endif /* !NDBM && !SDBM */
- d209 1
- d211 11
- d223 5
- d239 2
- a240 2
- (void) strcpy(buf, AliasFile);
- (void) strcat(buf, DB_PAGEXT);
- d242 1
- a242 5
- if (!init &&
- #ifdef YPMARK
- AliasFile[0] != YPMARK &&
- #endif /* YPMARK */
- (stat(buf, &stb) < 0 || stb.st_mtime < modtime || atcnt < 0))
- d253 1
- a253 1
- #endif /* LOG */
- d260 1
- a260 1
- #endif /* LOG */
- d281 2
- a282 2
- #endif /* LOG */
- readaliases(TRUE);
- d284 3
- a286 3
- # else /* !DBM */
- readaliases(init);
- # endif /* DBM */
- d295 1
- d302 1
- a302 1
- ** Reads AliasFile into the symbol table.
- d307 2
- a308 1
- readaliases(init)
- d316 1
- a316 1
- SIG_TYPE (*oldsigint)();
- d321 1
- a321 11
- # ifdef YPMARK
- if (AliasFile[0] == YPMARK) {
- if (tTd(27, 1))
- printf("Can't reinit YP databases: \"%s\"\n", AliasFile);
- /* reuse old aliases */
- errno = 0;
- return;
- }
- # endif /* YPMARK */
-
- if ((af = fopen(AliasFile, "r")) == NULL)
- d324 1
- a324 1
- printf("Can't open %s\n", AliasFile);
- d345 1
- a345 1
- # endif /* DBM */
- d354 2
- a355 2
- (void) strcpy(line, AliasFile);
- (void) strcat(line, DB_PAGEXT);
- d362 2
- a363 2
- (void) strcpy(line, AliasFile);
- (void) strcat(line, DB_DIREXT);
- d370 1
- a370 5
- # if defined(NDBM) || defined(SDBM)
- mapinit(DB_ALIAS);
- # else /* !NDBM && !SDBM */
- dbminit(AliasFile);
- # endif /* NDBM || SDBM */
- d377 1
- a377 1
- FileName = AliasFile;
- a476 6
- if (tTd(27, 3)) {
- printf("Mailer al.q_mailer:\n");
- print_mailer(al.q_mailer);
- printf("\nMailer LocalMailer:\n");
- print_mailer(LocalMailer);
- }
- a495 3
- # if defined(NDBM) || defined(SDBM)
- (void) dbm_store(AliasDbm, key, content, DBM_REPLACE);
- # else /* !NDBM && !SDBM */
- a496 1
- # endif /* NDBM || SDBM */
- d499 1
- a499 1
- # endif /* DBM */
- d515 1
- a516 3
- # ifdef YP
- DATUM content;
- char Now[65];
- a517 24
- /* add the YP stamps. N.B., don't pad the lengths by 1! */
- gethostname (Now, 64);
- key.dsize = strlen ("YP_MASTER_NAME");
- key.dptr = "YP_MASTER_NAME";
- content.dsize = strlen (Now);
- content.dptr = Now;
- # if defined(NDBM) || defined(SDBM)
- (void) dbm_store(AliasDbm, key, content, DBM_INSERT);
- # else /* !NDBM && !SDBM */
- store(key, content);
- # endif /* NDBM || SDBM */
- (void) sprintf (Now, "%010u", time(0));
- key.dsize = strlen ("YP_LAST_MODIFIED");
- key.dptr = "YP_LAST_MODIFIED";
- content.dsize = strlen (Now);
- content.dptr = Now;
- # if defined(NDBM) || defined(SDBM)
- (void) dbm_store(AliasDbm, key, content, DBM_INSERT);
- # else /* !NDBM && !SDBM */
- store(key, Now);
- # endif /* NDBM || SDBM */
- # endif /* YP */
-
- /* add the distinquished alias "@@" */
- a519 3
- # if defined(NDBM) || defined(SDBM)
- (void) dbm_store(AliasDbm, key, key, DBM_INSERT);
- # else /* !NDBM && !SDBM */
- a520 1
- # endif /* NDBM || SDBM */
- d525 1
- a525 1
- # endif /* DBM */
- d537 1
- a537 1
- # endif /* LOG */
- a581 52
- }
- /*
- ** PRINT_MAILER -- Print contents of struct mailer
- **
- ** This is for debugging
- **
- ** Parameters:
- ** Mpnt -- pointer to struct mailer
- **
- ** Returns:
- ** none.
- **
- ** Side Effects:
- ** none.
- */
-
- print_mailer(Mpnt)
- MAILER *Mpnt;
- {
- register int i;
- register char **j;
-
- if (Mpnt == (MAILER *) NULL) {
- printf("Null MAILER pointer\n");
- return;
- }
- printf("m_name (symbolic name) %s\n",
- (Mpnt->m_name == (char *)NULL) ? "NULL" : Mpnt->m_name);
- printf("m_mailer (pathname) %s\n",
- (Mpnt->m_mailer == (char *)NULL) ? "NULL" : Mpnt->m_mailer);
- printf("m_flags BITMAP: ");
- for (i = 0; i < (BITMAPBYTES / sizeof (int)); i++)
- printf(" %X", Mpnt->m_flags[i]);
- printf("\n");
- printf("m_mno (internal mailer number) %d\n", (int) Mpnt->m_mno);
- printf("m_argv (template argument vector): ");
- for (j = Mpnt->m_argv; *j != (char *) NULL; j++)
- printf(" \"%s\"", *j);
- printf("\n");
- printf("m_se_rwset (rewriting ruleset for envelope senders): %d\n",
- (int) Mpnt->m_se_rwset);
- printf("m_sh_rwset (rewriting ruleset for header senders): %d\n",
- (int) Mpnt->m_sh_rwset);
- printf("m_re_rwset (rewriting ruleset for envelope recipients): %d\n",
- (int) Mpnt->m_re_rwset);
- printf("m_rh_rwset (rewriting ruleset for header recipient): %d\n",
- (int) Mpnt->m_rh_rwset);
- printf("m_eol (end of line string) %s\n",
- (Mpnt->m_eol == (char *)NULL) ? "NULL" : Mpnt->m_eol);
- printf("m_maxsize (size limit on message to this mailer): %D\n",
- Mpnt->m_maxsize);
- return;
- @
-
-
- 5.21.0.2
- log
- @Patches for HP-UX from Andy Linton <root@@comp.vuw.ac.nz>. Thanks Andy!
- @
- text
- @a340 7
- #if defined(hpux)
- /*
- * We can't get an exclusive lock on a file that
- * isn't opened for writing - sigh!
- */
- if ((af = fopen(AliasFile, "r+")) == NULL)
- #else
- a342 1
- #endif /* hpux */
- @
-
-
- 5.21.0.3
- log
- @Reported maximum alias size now includes the size of the lhs+rhs and the
- name of the longest alias. Check success of dbm_store/store call.
- @
- text
- @a330 1
- char longest_lhs[BUFSIZ];
- a534 1
- if (
- d536 1
- a536 1
- dbm_store(AliasDbm, key, content, DBM_REPLACE)
- d538 1
- a538 1
- store(key, content)
- a539 2
- < 0)
- syserr("DBM store of %s (size %d) failed", al.q_user, (lhssize+rhssize));
- d551 2
- a552 4
- if ((rhssize + lhssize) > longest) {
- longest = rhssize + lhssize;
- (void) strcpy(longest_lhs, al.q_user);
- }
- d604 2
- a605 2
- message(Arpa_Info, "%d aliases, longest (%s) %d bytes, %d bytes total",
- naliases, longest_lhs, longest, bytes);
- d608 2
- a609 2
- syslog(LOG_INFO, "%d aliases, longest (%s) %d bytes, %d bytes total",
- naliases, longest_lhs, longest, bytes);
- @
-
-
- 5.21.0.4
- log
- @Use MAXHOSTNAMELEN from sys/param.h instead of a hardwired 64. Provide
- a default value for older systems.
- @
- text
- @a35 6
- #ifdef YP
- # include <sys/param.h>
- # ifndef MAXHOSTNAMELEN
- # define MAXHOSTNAMELEN 64
- # endif /* !MAXHOSTNAMELEN */
- #endif /* YP */
- d567 1
- a567 1
- char Now[MAXHOSTNAMELEN+1];
- d570 1
- a570 1
- gethostname (Now, MAXHOSTNAMELEN);
- @
-
-
- 5.21.0.5
- log
- @Corrected use of mapkey() return value, changed a printf() format from %D
- to %ld.
- @
- text
- @a139 1
- char *mapkey();
- d143 1
- a143 1
- newname = mapkey(DB_ALIAS, name, 0, (char *)0);
- d407 1
- a407 1
- (void) mapinit(DB_ALIAS);
- d716 1
- a716 1
- printf("m_maxsize (size limit on message to this mailer): %ld\n",
- @
-
-
- 5.21.0.6
- log
- @Re-did #statement indentation. All files to be exclusively flock()'ed are
- now opened with type "r+" rather than "r". Many platforms implement flock()
- with lockf(). The latter requires that files be opened for writing to
- obtain an exclusive lock. Added GDBM support.
- @
- text
- @d21 7
- a27 9
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <signal.h>
- #include <errno.h>
- #include "sendmail.h"
- #include <sys/file.h>
- #ifndef LOCK_EX
- # include "flock.h"
- #endif /* !LOCK_EX */
- d29 7
- a35 1
- #include <pwd.h>
- a42 8
- #ifndef lint
- # ifdef DBM
- static char sccsid[] = "@@(#)alias.c 5.21 (Berkeley) 6/1/90 (with DBM)";
- # else /* !DBM */
- static char sccsid[] = "@@(#)alias.c 5.21 (Berkeley) 6/1/90 (without DBM)";
- # endif /* DBM */
- #endif /* not lint */
-
- d71 3
- a73 3
- #if defined(DBM) && !defined(NDBM) && !defined(OTHERDBM)
- extern XDATUM fetch();
- #endif /* DBM && !NDBM && !OTHERDBM */
- d130 1
- a130 1
- ** unless NDBM or OTHERDBM is defined and we're using mapkey().
- d137 2
- a138 2
- #ifdef DBM
- # if defined(NDBM) || defined(OTHERDBM)
- d140 1
- a140 1
- extern char *mapkey();
- d144 1
- a144 1
- newname = mapkey(DB_ALIAS, name, 0, (char *)NULL);
- d149 1
- a149 1
- # else /* !NDBM && !OTHERDBM */
- d151 2
- a152 2
- XDATUM rhs, lhs;
- char *lowname = newstr(name);
- d155 1
- d164 1
- a164 1
- free(lowname);
- d166 2
- a167 2
- # endif /* NDBM || OTHERDBM */
- #else /* !DBM */
- d176 1
- a176 1
- #endif /* DBM */
- d195 1
- a195 1
- #define DBMMODE 0644
- d229 1
- a229 1
- #ifdef DBM
- d236 1
- a236 1
- # if !defined(NDBM) && !defined(SDBM)
- d239 1
- a239 1
- # endif /* !NDBM && !SDBM */
- d259 1
- a259 1
- # ifdef YPMARK
- d261 1
- a261 1
- # endif /* YPMARK */
- d270 1
- a270 1
- # ifdef LOG
- d273 1
- a273 1
- # endif /* LOG */
- d277 1
- a277 1
- # ifdef LOG
- d280 1
- a280 1
- # endif /* LOG */
- d285 1
- d293 1
- a293 1
- # ifdef LOG
- d301 1
- a301 1
- # endif /* LOG */
- d304 1
- a304 1
- #else /* !DBM */
- d306 1
- a306 1
- #endif /* DBM */
- d340 1
- a340 1
- #ifdef YPMARK
- d348 11
- a358 6
- #endif /* YPMARK */
- /*
- * We can't get an exclusive lock on a file that isn't opened for
- * writing on most systems - sigh!
- */
- if ((af = fopen(AliasFile, "r+")) == NULL)
- d367 1
- a367 1
- #ifdef DBM
- d369 1
- a369 2
- if (flock(fileno(af), LOCK_EX | LOCK_NB) < 0 &&
- (errno == EWOULDBLOCK || errno == EAGAIN))
- d382 1
- a382 1
- #endif /* DBM */
- d407 1
- a407 1
- #if defined(NDBM) || defined(OTHERDBM)
- d409 1
- a409 1
- #else /* !NDBM && !OTHERDBM */
- d411 1
- a411 1
- #endif /* NDBM || OTHERDBM */
- d448 1
- a448 1
- ** Find the first colon, and parse the address.
- d534 1
- a534 1
- #ifdef DBM
- d537 1
- a537 1
- XDATUM key, content;
- d544 1
- a544 1
- # if defined(NDBM) || defined(OTHERDBM)
- d546 1
- a546 1
- # else /* !NDBM && !OTHERDBM */
- d548 1
- a548 1
- # endif /* NDBM || OTHERDBM */
- d553 1
- a553 1
- #endif /* DBM */
- d568 1
- a568 1
- #ifdef DBM
- d571 1
- a571 1
- XDATUM key;
- d573 1
- a573 1
- XDATUM content;
- d582 1
- a582 1
- # if defined(NDBM) || defined(OTHERDBM)
- d584 1
- a584 1
- # else /* !NDBM && !OTHERDBM */
- d586 1
- a586 1
- # endif /* NDBM || OTHERDBM */
- d592 1
- a592 1
- # if defined(NDBM) || defined(OTHERDBM)
- d594 1
- a594 1
- # else /* !NDBM && !OTHERDBM */
- d596 1
- a596 1
- # endif /* NDBM || OTHERDBM */
- d602 1
- a602 1
- # if defined(NDBM) || defined(OTHERDBM)
- d604 1
- a604 1
- # else /* !NDBM && !OTHERDBM */
- d606 1
- a606 1
- # endif /* NDBM || OTHERDBM */
- d611 1
- a611 1
- #endif /* DBM */
- d619 1
- a619 1
- #ifdef LOG
- d623 1
- a623 1
- #endif /* LOG */
- @
-
-
- 5.21.0.7
- log
- @Moved test and include of flock.h to sendmail.h.
- @
- text
- @d26 5
- @
-
-
- 5.21.0.8
- log
- @Added forward declaration of readaliases() for gcc.
- @
- text
- @a193 1
- void readaliases();
- d322 1
- a322 1
- static void
- @
-
-
- 5.21.0.9
- log
- @Deleted #include <sys/types.h> as it's already included via sendmail.h from
- useful.h. #include "sendmail.h" relocated to top of #include list.
- @
- text
- @d21 1
- a21 1
- #include "sendmail.h"
- d25 1
- @
-
-
- 5.21.0.10
- log
- @Bulletproofing for POSIX.
- @
- text
- @a31 3
- #ifndef S_IREAD
- # define S_IREAD _S_IREAD
- #endif /* !S_IREAD */
- @
-
-
- 5.21.0.11
- log
- @declared print_mailer() static.
- @
- text
- @a679 1
- static
- @
-
-
- 5.21.0.12
- log
- @ANSIfied.
- @
- text
- @a43 8
- #ifdef __STDC__
- static void print_mailer(MAILER *);
- static void readaliases(int);
- #else /* !__STDC__ */
- static void print_mailer();
- static void readaliases();
- #endif /* __STDC__ */
-
- a75 1
- void
- d81 1
- d141 1
- d196 1
- a197 1
- void
- d244 1
- a244 1
- Xsleep(30);
- d295 3
- d300 1
- a640 1
- void
- d646 1
- d680 1
- a680 1
- static void
- @
-
-
- 5.21.0.13
- log
- @Include <sys/signal.h>, not <signal.h>.
- @
- text
- @d23 1
- a23 1
- #include <sys/signal.h>
- @
-
-
- 5.21.0.14
- log
- @Added RCS ID string
- @
- text
- @a38 1
- static char rcsid[] = "@@(#)$Id$ (with DBM)";
- a40 1
- static char rcsid[] = "@@(#)$Id$ (without DBM)";
- @
-
-
- 5.21.0.15
- log
- @Minor presentation cleanup.
- @
- text
- @d38 2
- a39 2
- static char sccsid[] = "@@(#)alias.c 5.21 (Berkeley) 6/1/90 (with DBM) %I% local";
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.14 1991/04/05 14:55:15 paul Exp paul $ (with DBM)";
- d41 2
- a42 2
- static char sccsid[] = "@@(#)alias.c 5.21 (Berkeley) 6/1/90 (without DBM) %I% local";
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.14 1991/04/05 14:55:15 paul Exp paul $ (without DBM)";
- d346 1
- a346 2
- if (AliasFile[0] == YPMARK)
- {
- d519 1
- a519 2
- if (tTd(27, 3))
- {
- d563 1
- a563 2
- if ((rhssize + lhssize) > longest)
- {
- d692 1
- a692 2
- if (Mpnt == (MAILER *) NULL)
- {
- @
-
-
- 5.21.0.16
- log
- @Further changes for Interactive Systems UNIX adapted from patches
- sent by Andy Linton <Andy.Linton@@comp.vuw.ac.nz>.
- @
- text
- @d23 1
- a24 3
- #ifdef ISC
- # include <net/errno.h>
- #endif /* ISC */
- d39 1
- a39 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.15 1991/05/18 03:39:58 paul Exp paul $ (with DBM)";
- d42 1
- a42 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.15 1991/05/18 03:39:58 paul Exp paul $ (without DBM)";
- a422 1
- *longest_lhs = '\0';
- @
-
-
- 5.21.0.17
- log
- @News sccsid mesg.
- @
- text
- @d41 1
- a41 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.16 1991/05/23 21:16:31 paul Exp $ (with DBM)";
- d44 1
- a44 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.16 1991/05/23 21:16:31 paul Exp $ (without DBM)";
- d523 1
- @
-
-
- 5.21.0.18
- log
- @Fix handling of multi-line .forward files. From Eric Wassenaar
- (e07@@nikhefh.nikhef.nl)>
- @
- text
- @d41 1
- a41 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.17 1991/05/29 05:11:52 paul Exp paul $ (with DBM)";
- d44 1
- a44 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.17 1991/05/29 05:11:52 paul Exp paul $ (without DBM)";
- a126 2
- if (!bitset(QSELFREF, a->q_flags))
- a->q_flags |= QDONTSEND;
- @
-
-
- 5.21.0.19
- log
- @Date: Sat, 8 Jun 1991 10:27:47 -0400
- From: bruce%balilly@@broadcast.sony.com (Bruce Lilly)
- Subject: case sensitive/insensitive database lookups
-
- Files affected: alias.c, daemon.c
-
- Allow case-sensitive (as well as -insensitive) database lookup. Needed
- because (a) user names in the aliases file, used as a dbm key, may be stored
- with upper-case letters preserved (if mailerflag 'u' is specified for the
- local mailer), making it impossible to retrieve aliases for these users without
- the change (see loweraddr() in parseaddr.c), and (b) at most it requires one
- additional dbm access per lookup, and only if keys supplied have upper-case
- letters, so it is inexpensive. Code is included for lookup of keys that may
- or may not be NULL-terminated.
- @
- text
- @d41 1
- a41 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.18 1991/06/05 02:20:56 paul Exp paul $ (with DBM)";
- d44 1
- a44 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.18 1991/06/05 02:20:56 paul Exp paul $ (without DBM)";
- d170 2
- a171 1
- lhs.dsize = strlen(name);
- d173 1
- a173 4
- printf("aliaslookup(\"%s\") => ", name);
-
- /* first try key as given */
- lhs.dptr = name;
- d175 2
- a176 19
- if (rhs.dptr == (char *)NULL)
- {
- /* try null-terminated version */
- lhs.dsize += 1;
- rhs = fetch(lhs);
- lhs.dsize -= 1;
- if (rhs.dptr == (char *)NULL)
- {
- /* try lower-case version */
- lhs.dptr = lowname;
- rhs = fetch(lhs);
- if (rhs.dptr == (char *)NULL)
- {
- /* try null-terminated lower-case version */
- lhs.dsize += 1;
- rhs = fetch(lhs);
- }
- }
- }
- a177 3
- if (tTd(27, 3))
- (rhs.dptr) ? printf("%.*s\n", rhs.dsize, rhs.dptr)
- : printf("NOT_FOUND\n");
- @
-
-
- 5.21.0.20
- log
- @Further changes to support NO_PADDING.
- @
- text
- @d41 1
- a41 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.19 1991/06/13 17:16:44 paul Exp paul $ (with DBM)";
- d44 1
- a44 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.19 1991/06/13 17:16:44 paul Exp paul $ (without DBM)";
- d560 2
- a561 6
- lhssize = strlen(al.q_user);
- rhssize = strlen(rhs);
- #ifndef NO_PADDING
- lhssize++;
- rhssize++;
- #endif /* !NO_PADDING */
- @
-
-
- 5.21.0.21
- log
- @Changed occurences of time_t to TIME_TYPE.
- @
- text
- @d40 2
- a41 2
- static char sccsid[] = "@@(#)alias.c 5.21 (Berkeley) 6/1/90 (with DBM)";
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.20 1991/06/13 19:53:29 paul Exp paul $ (with DBM)";
- d43 2
- a44 2
- static char sccsid[] = "@@(#)alias.c 5.21 (Berkeley) 6/1/90 (without DBM)";
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.20 1991/06/13 19:53:29 paul Exp paul $ (without DBM)";
- a84 3
- # ifdef __STDC__
- extern XDATUM fetch(XDATUM);
- # else /* !__STDC__ */
- a85 1
- # endif /* __STDC__ */
- d238 1
- a238 1
- TIME_TYPE modtime;
- @
-
-
- 5.21.0.22
- log
- @Don't carry over QSELFREF when handling .forward files.
- @
- text
- @d41 1
- a41 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.21 1991/06/21 12:16:37 paul Exp paul $ (with DBM)";
- d44 1
- a44 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.21 1991/06/21 12:16:37 paul Exp paul $ (without DBM)";
- d704 1
- a704 5
- /*
- * we do have an address to forward to -- do it but
- * don't carry over selfref from alias.
- */
- user->q_flags &= ~QSELFREF;
- @
-
-
- 5.21.0.23
- log
- @From: e07@@nikhefh.nikhef.nl (Eric Wassenaar)
- Date: 22 Jul 91 14:40:21 GMT
- Newsgroup: comp.mail.sendmail
- Subject: Re: sendmail-5.65c+IDA-1.4.4 - Double delivery problem
-
- This is a slight amendment to the patch of Neil Rickert.
- It involves no functional change, only a simple change of
- the place where the QSELFREF flag is reset.
- Blame me for having overlooked this one in the original patch.
-
- The memory of self-reference is needed only within the scope
- of the routines alias() and include(). It is therefore best
- to reset the QSELFREF bit in the beginning of those routines
- itself to make calls to them independent.
-
- As already has been pointed out, it must not be done within
- sendtolist() since that would nullify the effect for which
- this flag was introduced. (The flag should be carried over
- across the multiple calls of sendtolist() in the loop in
- the include() routine.)
-
- Eric Wassenaar
- --
- Organization: NIKHEF-H, National Institute for Nuclear and High-Energy Physics
- Address: Kruislaan 409, P.O. Box 41882, 1009 DB Amsterdam, the Netherlands
- Phone: +31 20 592 0412, Home: +31 20 6909449, Telefax: +31 20 592 5155
- Internet: e07@@nikhef.nl
- @
- text
- @d41 1
- a41 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.22 1991/07/11 05:34:08 paul Exp paul $ (with DBM)";
- d44 1
- a44 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.22 1991/07/11 05:34:08 paul Exp paul $ (without DBM)";
- a127 3
-
- /* sendtolist() will detect a possible self-reference for this alias */
- a->q_flags &= ~QSELFREF;
- @
-
-
- 5.21.0.24
- log
- @A wrapper around dbminit() of the alias file used SDBM instead of OTHERDBM.
- @
- text
- @d41 1
- a41 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.23 1991/08/08 22:13:25 paul Exp paul $ (with DBM)";
- d44 1
- a44 1
- static char rcsid[] = "@@(#)$Id: alias.c,v 5.21.0.23 1991/08/08 22:13:25 paul Exp paul $ (without DBM)";
- d279 1
- a279 1
- # if !defined(NDBM) && !defined(OTHERDBM)
- d282 1
- a282 1
- # endif /* !NDBM && !OTHERDBM */
- @
-