122694Sdist /* 235073Sbostic * Copyright (c) 1983 Eric P. Allman 333728Sbostic * Copyright (c) 1988 Regents of the University of California. 433728Sbostic * All rights reserved. 533728Sbostic * 642824Sbostic * %sccs.include.redist.c% 733728Sbostic */ 822694Sdist 958332Seric # include "sendmail.h" 1050577Seric # include <signal.h> 1150577Seric # include <pwd.h> 1256766Seric 1333728Sbostic #ifndef lint 14*60537Seric static char sccsid[] = "@(#)alias.c 6.51 (Berkeley) 05/28/93"; 1533728Sbostic #endif /* not lint */ 1659673Seric 1759673Seric 18*60537Seric MAP *AliasDB[MAXALIASDB + 1]; /* actual database list */ 1959673Seric int NAliasDBs; /* number of alias databases */ 2059673Seric /* 21292Seric ** ALIAS -- Compute aliases. 22292Seric ** 239368Seric ** Scans the alias file for an alias for the given address. 249368Seric ** If found, it arranges to deliver to the alias list instead. 259368Seric ** Uses libdbm database if -DDBM. 26292Seric ** 27292Seric ** Parameters: 284097Seric ** a -- address to alias. 294999Seric ** sendq -- a pointer to the head of the send queue 304999Seric ** to put the aliases in. 3158092Seric ** e -- the current envelope. 32292Seric ** 33292Seric ** Returns: 34292Seric ** none 35292Seric ** 36292Seric ** Side Effects: 373185Seric ** Aliases found are expanded. 38292Seric ** 39292Seric ** Deficiencies: 40292Seric ** It should complain about names that are aliased to 41292Seric ** nothing. 42292Seric */ 43292Seric 4455012Seric alias(a, sendq, e) 454097Seric register ADDRESS *a; 464999Seric ADDRESS **sendq; 4755012Seric register ENVELOPE *e; 48292Seric { 494081Seric register char *p; 5058082Seric int naliases; 5158170Seric char *owner; 5258170Seric char obuf[MAXNAME + 6]; 535701Seric extern char *aliaslookup(); 54292Seric 557671Seric if (tTd(27, 1)) 564098Seric printf("alias(%s)\n", a->q_paddr); 57292Seric 584098Seric /* don't realias already aliased names */ 5958680Seric if (bitset(QDONTSEND|QBADADDR|QVERIFIED, a->q_flags)) 604098Seric return; 614098Seric 6259673Seric if (NoAlias) 6359673Seric return; 6459673Seric 6555012Seric e->e_to = a->q_paddr; 664098Seric 674314Seric /* 684314Seric ** Look up this name 694314Seric */ 704314Seric 7159673Seric p = aliaslookup(a->q_user, e); 724098Seric if (p == NULL) 734098Seric return; 74292Seric 75292Seric /* 764098Seric ** Match on Alias. 774098Seric ** Deliver to the target list. 781515Seric */ 791515Seric 807671Seric if (tTd(27, 1)) 814098Seric printf("%s (%s, %s) aliased to %s\n", 824098Seric a->q_paddr, a->q_host, a->q_user, p); 8358092Seric if (bitset(EF_VRFYONLY, e->e_flags)) 8458154Seric { 8558154Seric a->q_flags |= QVERIFIED; 8658884Seric e->e_nrcpts++; 8758092Seric return; 8858154Seric } 8958154Seric message("aliased to %s", p); 9057977Seric #ifdef LOG 9158020Seric if (LogLevel > 9) 9257977Seric syslog(LOG_INFO, "%s: alias %s => %s", e->e_id, a->q_paddr, p); 9357977Seric #endif 9458082Seric a->q_flags &= ~QSELFREF; 954098Seric AliasLevel++; 9658082Seric naliases = sendtolist(p, a, sendq, e); 974098Seric AliasLevel--; 9858082Seric if (naliases > 0 && !bitset(QSELFREF, a->q_flags)) 9958065Seric { 10058065Seric if (tTd(27, 5)) 10158065Seric { 10258065Seric printf("alias: QDONTSEND "); 10358065Seric printaddr(a, FALSE); 10458065Seric } 10558065Seric a->q_flags |= QDONTSEND; 10658065Seric } 10758170Seric 10858170Seric /* 10958170Seric ** Look for owner of alias 11058170Seric */ 11158170Seric 11258170Seric (void) strcpy(obuf, "owner-"); 11358170Seric if (strncmp(a->q_user, "owner-", 6) == 0) 11458170Seric (void) strcat(obuf, "owner"); 11558170Seric else 11658170Seric (void) strcat(obuf, a->q_user); 11758170Seric if (!bitnset(M_USR_UPPER, a->q_mailer->m_flags)) 11858170Seric makelower(obuf); 11959673Seric owner = aliaslookup(obuf, e); 12058170Seric if (owner != NULL) 12158170Seric { 12258170Seric if (strchr(owner, ',') != NULL) 12358170Seric owner = obuf; 12458170Seric a->q_owner = newstr(owner); 12558170Seric } 1264098Seric } 1274098Seric /* 1285701Seric ** ALIASLOOKUP -- look up a name in the alias file. 1295701Seric ** 1305701Seric ** Parameters: 1315701Seric ** name -- the name to look up. 1325701Seric ** 1335701Seric ** Returns: 1345701Seric ** the value of name. 1355701Seric ** NULL if unknown. 1365701Seric ** 1375701Seric ** Side Effects: 1385701Seric ** none. 1395701Seric ** 1405701Seric ** Warnings: 1415701Seric ** The return value will be trashed across calls. 1425701Seric */ 1435701Seric 1445701Seric char * 14559673Seric aliaslookup(name, e) 1465701Seric char *name; 14759673Seric ENVELOPE *e; 1485701Seric { 14959673Seric register int dbno; 15060089Seric register MAP *map; 15159673Seric register char *p; 1525701Seric 15359673Seric for (dbno = 0; dbno < NAliasDBs; dbno++) 15459673Seric { 15560089Seric auto int stat; 15660089Seric 157*60537Seric map = AliasDB[dbno]; 15860207Seric if (!bitset(MF_OPEN, map->map_mflags)) 15959673Seric continue; 16060207Seric p = (*map->map_class->map_lookup)(map, name, NULL, &stat); 16159673Seric if (p != NULL) 16259673Seric return p; 16359673Seric } 16459673Seric return NULL; 16559673Seric } 16659673Seric /* 16759673Seric ** SETALIAS -- set up an alias map 16859673Seric ** 16959673Seric ** Called when reading configuration file. 17059673Seric ** 17159673Seric ** Parameters: 17259673Seric ** spec -- the alias specification 17359673Seric ** 17459673Seric ** Returns: 17559673Seric ** none. 17659673Seric */ 17757381Seric 17859673Seric setalias(spec) 17959673Seric char *spec; 18059673Seric { 18159673Seric register char *p; 18260089Seric register MAP *map; 18359673Seric char *class; 18459673Seric STAB *s; 18559673Seric 18659697Seric if (tTd(27, 8)) 18759697Seric printf("setalias(%s)\n", spec); 18859697Seric 18959758Seric for (p = spec; p != NULL; ) 19051756Seric { 191*60537Seric char aname[50]; 192*60537Seric 19359758Seric while (isspace(*p)) 19459758Seric p++; 19560502Seric if (*p == '\0') 19659673Seric break; 19759673Seric spec = p; 19859673Seric 19959758Seric if (NAliasDBs >= MAXALIASDB) 20059758Seric { 20159758Seric syserr("Too many alias databases defined, %d max", MAXALIASDB); 20259758Seric return; 20359758Seric } 204*60537Seric (void) sprintf(aname, "Alias%d", NAliasDBs); 205*60537Seric s = stab(aname, ST_MAP, ST_ENTER); 206*60537Seric map = &s->s_map; 207*60537Seric AliasDB[NAliasDBs] = map; 20860089Seric bzero(map, sizeof *map); 20959758Seric 21059758Seric p = strpbrk(p, " ,/:"); 21159758Seric if (p != NULL && *p == ':') 21259758Seric { 21360089Seric /* map name */ 21459758Seric *p++ = '\0'; 21559758Seric class = spec; 21659758Seric spec = p; 21759758Seric } 21859758Seric else 21959758Seric { 22059758Seric class = "implicit"; 22160228Seric map->map_mflags = MF_OPTIONAL|MF_INCLNULL; 22259758Seric } 22359758Seric 22459758Seric /* find end of spec */ 22559758Seric if (p != NULL) 22659758Seric p = strchr(p, ','); 22759758Seric if (p != NULL) 22859758Seric *p++ = '\0'; 22959758Seric 23059758Seric /* look up class */ 23160089Seric s = stab(class, ST_MAPCLASS, ST_FIND); 23259758Seric if (s == NULL) 23359758Seric { 23459758Seric if (tTd(27, 1)) 23559758Seric printf("Unknown alias class %s\n", class); 23659758Seric } 23760207Seric else if (!bitset(MCF_ALIASOK, s->s_mapclass.map_cflags)) 23860207Seric { 23960207Seric syserr("setalias: map class %s can't handle aliases", 24060207Seric class); 24160207Seric } 24259758Seric else 24359758Seric { 24460207Seric map->map_class = &s->s_mapclass; 24560089Seric if (map->map_class->map_parse(map, spec)) 24660089Seric { 24760207Seric map->map_mflags |= MF_VALID|MF_ALIAS; 24860089Seric NAliasDBs++; 24960089Seric } 25059758Seric } 25159756Seric } 2525701Seric } 2535701Seric /* 25459673Seric ** ALIASWAIT -- wait for distinguished @:@ token to appear. 25559673Seric ** 25659673Seric ** This can decide to reopen or rebuild the alias file 25759673Seric */ 25859673Seric 25960207Seric aliaswait(map, ext) 26060089Seric MAP *map; 26160207Seric char *ext; 26259673Seric { 26359673Seric int atcnt; 26459673Seric time_t mtime; 26559673Seric struct stat stb; 26659673Seric char buf[MAXNAME]; 26759673Seric 26859697Seric if (tTd(27, 3)) 26960207Seric printf("aliaswait(%s:%s)\n", 27060207Seric map->map_class->map_cname, map->map_file); 27159697Seric 27217471Seric atcnt = SafeAlias * 2; 27317471Seric if (atcnt > 0) 27417471Seric { 27560089Seric auto int st; 27660089Seric 27759673Seric while (atcnt-- >= 0 && 27860089Seric map->map_class->map_lookup(map, "@", NULL, &st) == NULL) 27925689Seric { 28025689Seric /* 28159673Seric ** Close and re-open the alias database in case 28259673Seric ** the one is mv'ed instead of cp'ed in. 28325689Seric */ 28425689Seric 28559697Seric if (tTd(27, 2)) 28659697Seric printf("aliaswait: sleeping\n"); 28759697Seric 28860089Seric map->map_class->map_close(map); 28917471Seric sleep(30); 29060089Seric map->map_class->map_open(map, O_RDONLY); 29125689Seric } 29217471Seric } 2938437Seric 29459673Seric /* see if we need to go into auto-rebuild mode */ 29560207Seric if (!bitset(MCF_REBUILDABLE, map->map_class->map_cflags)) 29660207Seric { 29760207Seric if (tTd(27, 3)) 29860207Seric printf("aliaswait: not rebuildable\n"); 29959673Seric return; 30060207Seric } 30160207Seric if (stat(map->map_file, &stb) < 0) 30260207Seric { 30360207Seric if (tTd(27, 3)) 30460207Seric printf("aliaswait: no source file\n"); 30560207Seric return; 30660207Seric } 30759673Seric mtime = stb.st_mtime; 30860089Seric (void) strcpy(buf, map->map_file); 30960207Seric if (ext != NULL) 31060207Seric (void) strcat(buf, ext); 31159673Seric if (stat(buf, &stb) < 0 || stb.st_mtime < mtime || atcnt < 0) 3124322Seric { 31359673Seric /* database is out of date */ 31440559Sbostic if (AutoRebuild && stb.st_ino != 0 && stb.st_uid == geteuid()) 3154322Seric { 31660089Seric message("auto-rebuilding alias database %s", buf); 31760207Seric rebuildaliases(map, TRUE); 3184322Seric } 3194322Seric else 3204322Seric { 32119039Seric #ifdef LOG 32258020Seric if (LogLevel > 3) 32359673Seric syslog(LOG_INFO, "alias database %s out of date", 32460089Seric buf); 32556795Seric #endif /* LOG */ 32660089Seric message("Warning: alias database %s out of date", buf); 3274322Seric } 3284322Seric } 32959673Seric } 33059673Seric /* 33159673Seric ** REBUILDALIASES -- rebuild the alias database. 33259673Seric ** 33359673Seric ** Parameters: 33460089Seric ** map -- the database to rebuild. 33559673Seric ** automatic -- set if this was automatically generated. 33659673Seric ** 33759673Seric ** Returns: 33859673Seric ** none. 33959673Seric ** 34059673Seric ** Side Effects: 34159673Seric ** Reads the text version of the database, builds the 34259673Seric ** DBM or DB version. 34359673Seric */ 3444322Seric 34560207Seric rebuildaliases(map, automatic) 34660089Seric register MAP *map; 34759673Seric bool automatic; 34859673Seric { 34959673Seric FILE *af; 35059673Seric void (*oldsigint)(); 3514322Seric 35260207Seric if (!bitset(MCF_REBUILDABLE, map->map_class->map_cflags)) 35359673Seric return; 3544322Seric 35559673Seric #ifdef LOG 35659673Seric if (LogLevel > 7) 3578437Seric { 35859673Seric syslog(LOG_NOTICE, "alias database %s %srebuilt by %s", 35960089Seric map->map_file, automatic ? "auto" : "", username()); 36059673Seric } 36156795Seric #endif /* LOG */ 36259673Seric 36359673Seric /* try to lock the source file */ 36460089Seric if ((af = fopen(map->map_file, "r+")) == NULL) 36559673Seric { 36659756Seric if (tTd(27, 1)) 36759756Seric printf("Can't open %s: %s\n", 36860089Seric map->map_file, errstring(errno)); 36959673Seric errno = 0; 37059673Seric return; 3718437Seric } 37259673Seric 37359673Seric /* see if someone else is rebuilding the alias file */ 37460089Seric if (!lockfile(fileno(af), map->map_file, LOCK_EX|LOCK_NB)) 37559673Seric { 37659673Seric /* yes, they are -- wait until done */ 37759673Seric message("Alias file %s is already being rebuilt", 37860089Seric map->map_file); 37959673Seric if (OpMode != MD_INITALIAS) 38059673Seric { 38159673Seric /* wait for other rebuild to complete */ 38260089Seric (void) lockfile(fileno(af), map->map_file, 38359673Seric LOCK_EX); 38459673Seric } 38559673Seric (void) fclose(af); 38659673Seric errno = 0; 38759673Seric return; 38859673Seric } 38959673Seric 39059673Seric oldsigint = signal(SIGINT, SIG_IGN); 39159673Seric 39260207Seric if (map->map_class->map_open(map, O_RDWR)) 39360089Seric { 39460207Seric map->map_mflags |= MF_OPEN|MF_WRITABLE; 39560207Seric readaliases(map, af, automatic); 39660089Seric } 39760207Seric else 39860207Seric { 39960207Seric if (tTd(27, 1)) 40060207Seric printf("Can't create database for %s: %s\n", 40160207Seric map->map_file, errstring(errno)); 40260207Seric if (!automatic) 40360207Seric syserr("Cannot create database for alias file %s", 40460207Seric map->map_file); 40560207Seric } 40659673Seric 40759673Seric /* close the file, thus releasing locks */ 40859673Seric fclose(af); 40959673Seric 41059673Seric /* add distinguished entries and close the database */ 41160207Seric if (bitset(MF_OPEN, map->map_mflags)) 41260089Seric map->map_class->map_close(map); 41359673Seric 41459673Seric /* restore the old signal */ 41559673Seric (void) signal(SIGINT, oldsigint); 4164157Seric } 4174157Seric /* 4184157Seric ** READALIASES -- read and process the alias file. 4194157Seric ** 4204157Seric ** This routine implements the part of initaliases that occurs 4214157Seric ** when we are not going to use the DBM stuff. 4224157Seric ** 4234157Seric ** Parameters: 42460089Seric ** map -- the alias database descriptor. 42559673Seric ** af -- file to read the aliases from. 42659733Seric ** automatic -- set if this was an automatic rebuild. 4274157Seric ** 4284157Seric ** Returns: 4294157Seric ** none. 4304157Seric ** 4314157Seric ** Side Effects: 4324157Seric ** Reads aliasfile into the symbol table. 4334157Seric ** Optionally, builds the .dir & .pag files. 4344157Seric */ 4354157Seric 43660207Seric readaliases(map, af, automatic) 43760089Seric register MAP *map; 43859673Seric FILE *af; 43959733Seric int automatic; 4404157Seric { 4414098Seric register char *p; 4424098Seric char *rhs; 4434098Seric bool skipping; 44459673Seric long naliases, bytes, longest; 4454098Seric ADDRESS al, bl; 4464106Seric register STAB *s; 4479368Seric char line[BUFSIZ]; 4484098Seric 4494314Seric /* 4504314Seric ** Read and interpret lines 4514314Seric */ 4524314Seric 45360089Seric FileName = map->map_file; 4549368Seric LineNumber = 0; 4554322Seric naliases = bytes = longest = 0; 4564098Seric skipping = FALSE; 4574098Seric while (fgets(line, sizeof (line), af) != NULL) 4584098Seric { 4594322Seric int lhssize, rhssize; 4604322Seric 4619368Seric LineNumber++; 46256795Seric p = strchr(line, '\n'); 46325278Seric if (p != NULL) 46425278Seric *p = '\0'; 4654098Seric switch (line[0]) 4664098Seric { 4674098Seric case '#': 4684098Seric case '\0': 4694098Seric skipping = FALSE; 4704098Seric continue; 4714065Seric 4724098Seric case ' ': 4734098Seric case '\t': 4744098Seric if (!skipping) 47558151Seric syserr("554 Non-continuation line starts with space"); 4764098Seric skipping = TRUE; 4774097Seric continue; 4784098Seric } 4794098Seric skipping = FALSE; 4801874Seric 4814314Seric /* 4824314Seric ** Process the LHS 48357736Seric ** Find the colon separator, and parse the address. 48416898Seric ** It should resolve to a local name -- this will 48516898Seric ** be checked later (we want to optionally do 48616898Seric ** parsing of the RHS first to maximize error 48716898Seric ** detection). 4884314Seric */ 4894314Seric 4904098Seric for (p = line; *p != '\0' && *p != ':' && *p != '\n'; p++) 4914097Seric continue; 49216898Seric if (*p++ != ':') 4934098Seric { 49458151Seric syserr("554 missing colon"); 4954097Seric continue; 4964098Seric } 49760207Seric if (parseaddr(line, &al, 1, ':', NULL, CurEnv) == NULL) 4984098Seric { 49958151Seric syserr("554 illegal alias name"); 50016898Seric continue; 5014098Seric } 5024314Seric 5034314Seric /* 5044314Seric ** Process the RHS. 5054314Seric ** 'al' is the internal form of the LHS address. 5064314Seric ** 'p' points to the text of the RHS. 5074314Seric */ 5084314Seric 50958914Seric while (isascii(*p) && isspace(*p)) 51058914Seric p++; 5114098Seric rhs = p; 5124098Seric for (;;) 5134098Seric { 5144098Seric register char c; 51558662Seric register char *nlp; 5161515Seric 51758662Seric nlp = &p[strlen(p)]; 51858662Seric if (nlp[-1] == '\n') 51958662Seric *--nlp = '\0'; 52058662Seric 52159673Seric if (CheckAliases) 5224098Seric { 5234157Seric /* do parsing & compression of addresses */ 52425278Seric while (*p != '\0') 5254098Seric { 52658333Seric auto char *delimptr; 52725278Seric 52858050Seric while ((isascii(*p) && isspace(*p)) || 52958050Seric *p == ',') 5304157Seric p++; 53125278Seric if (*p == '\0') 53225278Seric break; 53360207Seric if (parseaddr(p, &bl, -1, ',', &delimptr, CurEnv) == NULL) 53458151Seric usrerr("553 %s... bad address", p); 53558333Seric p = delimptr; 5364098Seric } 5374098Seric } 5384157Seric else 53915769Seric { 54058662Seric p = nlp; 54115769Seric } 5421515Seric 5434098Seric /* see if there should be a continuation line */ 5444106Seric c = fgetc(af); 5454106Seric if (!feof(af)) 5464314Seric (void) ungetc(c, af); 5474106Seric if (c != ' ' && c != '\t') 5484098Seric break; 5494098Seric 5504098Seric /* read continuation line */ 5514098Seric if (fgets(p, sizeof line - (p - line), af) == NULL) 5524098Seric break; 5539368Seric LineNumber++; 55457135Seric 55557135Seric /* check for line overflow */ 55657135Seric if (strchr(p, '\n') == NULL) 55757135Seric { 55858151Seric usrerr("554 alias too long"); 55957135Seric break; 56057135Seric } 5614098Seric } 56216898Seric if (al.q_mailer != LocalMailer) 56316898Seric { 56458151Seric syserr("554 cannot alias non-local names"); 56516898Seric continue; 56616898Seric } 5674314Seric 5684314Seric /* 5694314Seric ** Insert alias into symbol table or DBM file 5704314Seric */ 5714314Seric 57257381Seric if (!bitnset(M_USR_UPPER, al.q_mailer->m_flags)) 57357381Seric makelower(al.q_user); 5744322Seric 57559673Seric lhssize = strlen(al.q_user); 57659673Seric rhssize = strlen(rhs); 57760089Seric map->map_class->map_store(map, al.q_user, rhs); 5784157Seric 57959673Seric if (al.q_paddr != NULL) 58059673Seric free(al.q_paddr); 58159673Seric if (al.q_host != NULL) 58259673Seric free(al.q_host); 58359673Seric if (al.q_user != NULL) 58459673Seric free(al.q_user); 5854322Seric 5864322Seric /* statistics */ 5874322Seric naliases++; 5884322Seric bytes += lhssize + rhssize; 5894322Seric if (rhssize > longest) 5904322Seric longest = rhssize; 5911515Seric } 59219784Seric 59360207Seric CurEnv->e_to = NULL; 59459673Seric FileName = NULL; 59559733Seric if (Verbose || !automatic) 59659733Seric message("%s: %d aliases, longest %d bytes, %d bytes total", 59760089Seric map->map_file, naliases, longest, bytes); 59859673Seric # ifdef LOG 59959673Seric if (LogLevel > 7) 60059673Seric syslog(LOG_INFO, "%s: %d aliases, longest %d bytes, %d bytes total", 60160089Seric map->map_file, naliases, longest, bytes); 60259673Seric # endif /* LOG */ 60359673Seric } 60459673Seric /* 605292Seric ** FORWARD -- Try to forward mail 606292Seric ** 607292Seric ** This is similar but not identical to aliasing. 608292Seric ** 609292Seric ** Parameters: 6104314Seric ** user -- the name of the user who's mail we would like 6114314Seric ** to forward to. It must have been verified -- 6124314Seric ** i.e., the q_home field must have been filled 6134314Seric ** in. 6144999Seric ** sendq -- a pointer to the head of the send queue to 6154999Seric ** put this user's aliases in. 616292Seric ** 617292Seric ** Returns: 6184098Seric ** none. 619292Seric ** 620292Seric ** Side Effects: 6213185Seric ** New names are added to send queues. 622292Seric */ 623292Seric 62455012Seric forward(user, sendq, e) 6252966Seric ADDRESS *user; 6264999Seric ADDRESS **sendq; 62755012Seric register ENVELOPE *e; 628292Seric { 62957136Seric char *pp; 63057136Seric char *ep; 6314069Seric 6327671Seric if (tTd(27, 1)) 6334098Seric printf("forward(%s)\n", user->q_paddr); 6344098Seric 6354594Seric if (user->q_mailer != LocalMailer || bitset(QBADADDR, user->q_flags)) 6364098Seric return; 6374314Seric if (user->q_home == NULL) 63858059Seric { 63958151Seric syserr("554 forward: no home"); 64058059Seric user->q_home = "/nosuchdirectory"; 64158059Seric } 6424069Seric 6434069Seric /* good address -- look for .forward file in home */ 64455012Seric define('z', user->q_home, e); 64557136Seric define('u', user->q_user, e); 64657136Seric define('h', user->q_host, e); 64757136Seric if (ForwardPath == NULL) 64858050Seric ForwardPath = newstr("\201z/.forward"); 64957136Seric 65057136Seric for (pp = ForwardPath; pp != NULL; pp = ep) 65157136Seric { 65258247Seric int err; 65357232Seric char buf[MAXPATHLEN+1]; 65457136Seric 65557136Seric ep = strchr(pp, ':'); 65657136Seric if (ep != NULL) 65757136Seric *ep = '\0'; 65857136Seric expand(pp, buf, &buf[sizeof buf - 1], e); 65957136Seric if (ep != NULL) 66057136Seric *ep++ = ':'; 66157136Seric if (tTd(27, 3)) 66257136Seric printf("forward: trying %s\n", buf); 66358247Seric err = include(buf, TRUE, user, sendq, e); 66458247Seric if (err == 0) 66557136Seric break; 66658247Seric if (transienterror(err)) 66758247Seric { 66858247Seric /* we have to suspend this message */ 66959563Seric if (tTd(27, 2)) 67059563Seric printf("forward: transient error on %s\n", buf); 67159563Seric #ifdef LOG 67259563Seric if (LogLevel > 2) 67359624Seric syslog(LOG_ERR, "%s: forward %s: transient error: %s", 67459624Seric e->e_id, buf, errstring(err)); 67559563Seric #endif 67659611Seric message("%s: %s: message queued", buf, errstring(err)); 67758247Seric user->q_flags |= QQUEUEUP|QDONTSEND; 67858247Seric return; 67958247Seric } 68057136Seric } 681292Seric } 682