122711Sdist /* 234921Sbostic * Copyright (c) 1983 Eric P. Allman 333731Sbostic * Copyright (c) 1988 Regents of the University of California. 433731Sbostic * All rights reserved. 533731Sbostic * 642829Sbostic * %sccs.include.redist.c% 733731Sbostic */ 822711Sdist 922711Sdist #ifndef lint 10*58333Seric static char sccsid[] = "@(#)savemail.c 6.18 (Berkeley) 03/01/93"; 1133731Sbostic #endif /* not lint */ 1222711Sdist 13297Seric # include <pwd.h> 143313Seric # include "sendmail.h" 15297Seric 16297Seric /* 17297Seric ** SAVEMAIL -- Save mail on error 18297Seric ** 199375Seric ** If mailing back errors, mail it back to the originator 20297Seric ** together with an error message; otherwise, just put it in 21297Seric ** dead.letter in the user's home directory (if he exists on 22297Seric ** this machine). 23297Seric ** 24297Seric ** Parameters: 259337Seric ** e -- the envelope containing the message in error. 26297Seric ** 27297Seric ** Returns: 28297Seric ** none 29297Seric ** 30297Seric ** Side Effects: 31297Seric ** Saves the letter, by writing or mailing it back to the 32297Seric ** sender, or by putting it in dead.letter in her home 33297Seric ** directory. 34297Seric */ 35297Seric 3624942Seric /* defines for state machine */ 3724942Seric # define ESM_REPORT 0 /* report to sender's terminal */ 3824942Seric # define ESM_MAIL 1 /* mail back to sender */ 3924942Seric # define ESM_QUIET 2 /* messages have already been returned */ 4024942Seric # define ESM_DEADLETTER 3 /* save in ~/dead.letter */ 4124942Seric # define ESM_POSTMASTER 4 /* return to postmaster */ 4224942Seric # define ESM_USRTMP 5 /* save in /usr/tmp/dead.letter */ 4324942Seric # define ESM_PANIC 6 /* leave the locked queue/transcript files */ 4424942Seric # define ESM_DONE 7 /* the message is successfully delivered */ 4524942Seric 4624942Seric 479337Seric savemail(e) 489337Seric register ENVELOPE *e; 49297Seric { 50297Seric register struct passwd *pw; 5124942Seric register FILE *fp; 5224942Seric int state; 5324942Seric auto ADDRESS *q; 54297Seric char buf[MAXLINE+1]; 55297Seric extern struct passwd *getpwnam(); 56297Seric register char *p; 57297Seric extern char *ttypath(); 585846Seric typedef int (*fnptr)(); 59297Seric 607676Seric if (tTd(6, 1)) 6124979Seric printf("\nsavemail, ErrorMode = %c\n", ErrorMode); 627361Seric 639375Seric if (bitset(EF_RESPONSE, e->e_flags)) 64297Seric return; 659337Seric e->e_flags &= ~EF_FATALERRS; 66297Seric 67297Seric /* 68297Seric ** In the unhappy event we don't know who to return the mail 69297Seric ** to, make someone up. 70297Seric */ 71297Seric 729337Seric if (e->e_from.q_paddr == NULL) 73297Seric { 74*58333Seric if (parseaddr("root", &e->e_from, 0, '\0', NULL, e) == NULL) 75297Seric { 7658151Seric syserr("553 Cannot parse root!"); 77297Seric ExitStat = EX_SOFTWARE; 78297Seric finis(); 79297Seric } 80297Seric } 819337Seric e->e_to = NULL; 82297Seric 83297Seric /* 8424942Seric ** Basic state machine. 8524942Seric ** 8624942Seric ** This machine runs through the following states: 8724942Seric ** 8824942Seric ** ESM_QUIET Errors have already been printed iff the 8924942Seric ** sender is local. 9024942Seric ** ESM_REPORT Report directly to the sender's terminal. 9124942Seric ** ESM_MAIL Mail response to the sender. 9224942Seric ** ESM_DEADLETTER Save response in ~/dead.letter. 9324942Seric ** ESM_POSTMASTER Mail response to the postmaster. 9424942Seric ** ESM_PANIC Save response anywhere possible. 95297Seric */ 96297Seric 9724942Seric /* determine starting state */ 9824942Seric switch (ErrorMode) 99297Seric { 10024942Seric case EM_WRITE: 10124942Seric state = ESM_REPORT; 10224942Seric break; 10324942Seric 10424942Seric case EM_BERKNET: 10524942Seric /* mail back, but return o.k. exit status */ 106401Seric ExitStat = EX_OK; 10724942Seric 10824942Seric /* fall through.... */ 10924942Seric 11024942Seric case EM_MAIL: 11124942Seric state = ESM_MAIL; 11224942Seric break; 11324942Seric 11424942Seric case EM_PRINT: 11524979Seric case '\0': 11624942Seric state = ESM_QUIET; 11724942Seric break; 11824942Seric 11924942Seric case EM_QUIET: 12024942Seric /* no need to return anything at all */ 12124942Seric return; 12224979Seric 12324979Seric default: 12458151Seric syserr("554 savemail: ErrorMode x%x\n"); 12524979Seric state = ESM_MAIL; 12624979Seric break; 127297Seric } 128297Seric 12924942Seric while (state != ESM_DONE) 130297Seric { 13124979Seric if (tTd(6, 5)) 13224979Seric printf(" state %d\n", state); 13324979Seric 13424942Seric switch (state) 135297Seric { 13624979Seric case ESM_QUIET: 13724979Seric if (e->e_from.q_mailer == LocalMailer) 13824979Seric state = ESM_DEADLETTER; 13924979Seric else 14024979Seric state = ESM_MAIL; 14124979Seric break; 14224979Seric 14324942Seric case ESM_REPORT: 14424942Seric 14524942Seric /* 14624942Seric ** If the user is still logged in on the same terminal, 14724942Seric ** then write the error messages back to hir (sic). 14824942Seric */ 14924942Seric 15024942Seric p = ttypath(); 15124942Seric if (p == NULL || freopen(p, "w", stdout) == NULL) 15224942Seric { 15324942Seric state = ESM_MAIL; 15424942Seric break; 15524942Seric } 15624942Seric 15758050Seric expand("\201n", buf, &buf[sizeof buf - 1], e); 1589375Seric printf("\r\nMessage from %s...\r\n", buf); 1599375Seric printf("Errors occurred while sending mail.\r\n"); 1609542Seric if (e->e_xfp != NULL) 1619375Seric { 1629542Seric (void) fflush(e->e_xfp); 16324942Seric fp = fopen(queuename(e, 'x'), "r"); 1649375Seric } 1659375Seric else 16624942Seric fp = NULL; 16724942Seric if (fp == NULL) 1689375Seric { 1699337Seric syserr("Cannot open %s", queuename(e, 'x')); 1709375Seric printf("Transcript of session is unavailable.\r\n"); 1719375Seric } 1729375Seric else 1739375Seric { 1749375Seric printf("Transcript follows:\r\n"); 17524942Seric while (fgets(buf, sizeof buf, fp) != NULL && 1769375Seric !ferror(stdout)) 1779375Seric fputs(buf, stdout); 17824942Seric (void) fclose(fp); 1799375Seric } 18024942Seric printf("Original message will be saved in dead.letter.\r\n"); 18124942Seric state = ESM_DEADLETTER; 18224942Seric break; 183297Seric 18424942Seric case ESM_MAIL: 18524942Seric case ESM_POSTMASTER: 18624942Seric /* 18724942Seric ** If mailing back, do it. 18824942Seric ** Throw away all further output. Don't alias, 18924942Seric ** since this could cause loops, e.g., if joe 19024942Seric ** mails to joe@x, and for some reason the network 19124942Seric ** for @x is down, then the response gets sent to 19224942Seric ** joe@x, which gives a response, etc. Also force 19324942Seric ** the mail to be delivered even if a version of 19424942Seric ** it has already been sent to the sender. 19558295Seric ** 19658295Seric ** Clever technique for computing rpath from 19758295Seric ** Eric Wassenaar <e07@nikhef.nl>. 19824942Seric */ 199297Seric 20024942Seric if (state == ESM_MAIL) 20124942Seric { 20258304Seric char *rpath; 20358178Seric 20458304Seric if (e->e_returnpath != e->e_sender) 20558304Seric rpath = e->e_returnpath; 20658304Seric else 20758304Seric rpath = e->e_from.q_paddr; 20858304Seric if (strcmp(rpath, "<>") != 0) 20958304Seric (void) sendtolist(rpath, 21058304Seric (ADDRESS *) NULL, 21158304Seric &e->e_errorqueue, e); 21224981Seric 21324981Seric /* deliver a cc: to the postmaster if desired */ 21424981Seric if (PostMasterCopy != NULL) 21558306Seric { 21658306Seric auto ADDRESS *rlist = NULL; 21758306Seric 21858082Seric (void) sendtolist(PostMasterCopy, 21958082Seric (ADDRESS *) NULL, 22058306Seric &rlist, e); 22158306Seric (void) returntosender(e->e_message, 22258306Seric rlist, FALSE, e); 22358306Seric } 22424942Seric q = e->e_errorqueue; 22558111Seric if (q == NULL) 22658111Seric { 22758111Seric /* this is an error-error */ 22858111Seric state = ESM_USRTMP; 22958111Seric break; 23058111Seric } 23124942Seric } 23224942Seric else 23324942Seric { 234*58333Seric if (parseaddr("postmaster", q, 0, '\0', NULL, e) == NULL) 23524942Seric { 23658151Seric syserr("553 cannot parse postmaster!"); 23724942Seric ExitStat = EX_SOFTWARE; 23824942Seric state = ESM_USRTMP; 23924942Seric break; 24024942Seric } 24124942Seric } 24224942Seric if (returntosender(e->e_message != NULL ? e->e_message : 24324942Seric "Unable to deliver mail", 24457438Seric q, (e->e_class >= 0), e) == 0) 24524942Seric { 24624942Seric state = ESM_DONE; 24724942Seric break; 24824942Seric } 249297Seric 25024942Seric state = state == ESM_MAIL ? ESM_POSTMASTER : ESM_USRTMP; 25124942Seric break; 252297Seric 25324942Seric case ESM_DEADLETTER: 25424942Seric /* 25524942Seric ** Save the message in dead.letter. 25624942Seric ** If we weren't mailing back, and the user is 25724942Seric ** local, we should save the message in 25824942Seric ** ~/dead.letter so that the poor person doesn't 25924942Seric ** have to type it over again -- and we all know 26024942Seric ** what poor typists UNIX users are. 26124942Seric */ 2625315Seric 26324942Seric p = NULL; 26424942Seric if (e->e_from.q_mailer == LocalMailer) 26524942Seric { 26624942Seric if (e->e_from.q_home != NULL) 26724942Seric p = e->e_from.q_home; 26824942Seric else if ((pw = getpwnam(e->e_from.q_user)) != NULL) 26924942Seric p = pw->pw_dir; 27024942Seric } 27124942Seric if (p == NULL) 27224942Seric { 27358151Seric syserr("554 Can't return mail to %s", e->e_from.q_paddr); 27424942Seric state = ESM_MAIL; 27524942Seric break; 27624942Seric } 27724942Seric if (e->e_dfp != NULL) 27824942Seric { 27924942Seric auto ADDRESS *q; 28024942Seric bool oldverb = Verbose; 28124942Seric 28224942Seric /* we have a home directory; open dead.letter */ 28324942Seric define('z', p, e); 28458050Seric expand("\201z/dead.letter", buf, &buf[sizeof buf - 1], e); 28524942Seric Verbose = TRUE; 28658151Seric message("Saving message in %s", buf); 28724942Seric Verbose = oldverb; 28824942Seric e->e_to = buf; 28924942Seric q = NULL; 29058082Seric (void) sendtolist(buf, &e->e_from, &q, e); 29124942Seric if (deliver(e, q) == 0) 29224942Seric state = ESM_DONE; 29324942Seric else 29424942Seric state = ESM_MAIL; 29524942Seric } 29625569Seric else 29725569Seric { 29825569Seric /* no data file -- try mailing back */ 29925569Seric state = ESM_MAIL; 30025569Seric } 30124942Seric break; 30224942Seric 30324942Seric case ESM_USRTMP: 30424942Seric /* 30524942Seric ** Log the mail in /usr/tmp/dead.letter. 30624942Seric */ 30724942Seric 30857438Seric if (e->e_class < 0) 30957438Seric { 31057438Seric state = ESM_DONE; 31157438Seric break; 31257438Seric } 31357438Seric 31424942Seric fp = dfopen("/usr/tmp/dead.letter", "a"); 31524942Seric if (fp == NULL) 31624942Seric { 31724942Seric state = ESM_PANIC; 31824942Seric break; 31924942Seric } 32024942Seric 32158010Seric putfromline(fp, FileMailer, e); 32258010Seric (*e->e_puthdr)(fp, FileMailer, e); 32358010Seric putline("\n", fp, FileMailer); 32458010Seric (*e->e_putbody)(fp, FileMailer, e); 32558010Seric putline("\n", fp, FileMailer); 32624942Seric (void) fflush(fp); 32724942Seric state = ferror(fp) ? ESM_PANIC : ESM_DONE; 32824942Seric (void) fclose(fp); 32924942Seric break; 33024942Seric 33124942Seric default: 33258151Seric syserr("554 savemail: unknown state %d", state); 33324942Seric 33424942Seric /* fall through ... */ 33524942Seric 33624942Seric case ESM_PANIC: 33724942Seric /* leave the locked queue & transcript files around */ 33858151Seric syserr("554 savemail: cannot save rejected email anywhere"); 33924942Seric exit(EX_SOFTWARE); 34024942Seric } 341297Seric } 342297Seric } 343297Seric /* 3444633Seric ** RETURNTOSENDER -- return a message to the sender with an error. 3454633Seric ** 3464633Seric ** Parameters: 3474633Seric ** msg -- the explanatory message. 34816479Seric ** returnq -- the queue of people to send the message to. 3495984Seric ** sendbody -- if TRUE, also send back the body of the 3505984Seric ** message; otherwise just send the header. 35155012Seric ** e -- the current envelope. 3524633Seric ** 3534633Seric ** Returns: 3544633Seric ** zero -- if everything went ok. 3554633Seric ** else -- some error. 3564633Seric ** 3574633Seric ** Side Effects: 3584633Seric ** Returns the current message to the sender via 3594633Seric ** mail. 3604633Seric */ 3614633Seric 3625984Seric static bool SendBody; 3634633Seric 3647045Seric #define MAXRETURNS 6 /* max depth of returning messages */ 3657045Seric 36655012Seric returntosender(msg, returnq, sendbody, e) 3674633Seric char *msg; 36816479Seric ADDRESS *returnq; 3695984Seric bool sendbody; 37055012Seric register ENVELOPE *e; 3714633Seric { 3724633Seric char buf[MAXNAME]; 3736978Seric extern putheader(), errbody(); 3746978Seric register ENVELOPE *ee; 3756978Seric extern ENVELOPE *newenvelope(); 3766978Seric ENVELOPE errenvelope; 3777045Seric static int returndepth; 3789375Seric register ADDRESS *q; 3794633Seric 3807676Seric if (tTd(6, 1)) 3817287Seric { 38255012Seric printf("Return To Sender: msg=\"%s\", depth=%d, e=%x,\n", 38355012Seric msg, returndepth, e); 38424942Seric printf("\treturnq="); 38516479Seric printaddr(returnq, TRUE); 3867287Seric } 3877287Seric 3887045Seric if (++returndepth >= MAXRETURNS) 3897045Seric { 3907045Seric if (returndepth != MAXRETURNS) 39158151Seric syserr("554 returntosender: infinite recursion on %s", returnq->q_paddr); 3927045Seric /* don't "unrecurse" and fake a clean exit */ 3937045Seric /* returndepth--; */ 3947045Seric return (0); 3957045Seric } 3967045Seric 3975984Seric SendBody = sendbody; 39858179Seric define('g', e->e_sender, e); 39958179Seric define('<', e->e_returnpath, e); 40058179Seric ee = newenvelope(&errenvelope, e); 40158050Seric define('a', "\201b", ee); 4026978Seric ee->e_puthdr = putheader; 4036978Seric ee->e_putbody = errbody; 4049375Seric ee->e_flags |= EF_RESPONSE; 40555012Seric if (!bitset(EF_OLDSTYLE, e->e_flags)) 40645155Seric ee->e_flags &= ~EF_OLDSTYLE; 40716479Seric ee->e_sendqueue = returnq; 4089542Seric openxscript(ee); 40916479Seric for (q = returnq; q != NULL; q = q->q_next) 4109375Seric { 41158144Seric if (!DontPruneRoutes && pruneroute(q->q_paddr)) 412*58333Seric parseaddr(q->q_paddr, q, 0, '\0', NULL, e); 41358144Seric 4149375Seric if (q->q_alias == NULL) 4159375Seric addheader("to", q->q_paddr, ee); 4169375Seric } 41724942Seric 41857642Seric # ifdef LOG 41958020Seric if (LogLevel > 5) 42057642Seric syslog(LOG_INFO, "%s: %s: return to sender: %s", 42157642Seric e->e_id, ee->e_id, msg); 42257642Seric # endif 42357642Seric 42410845Seric (void) sprintf(buf, "Returned mail: %s", msg); 42510106Seric addheader("subject", buf, ee); 4264633Seric 4274633Seric /* fake up an address header for the from person */ 42858050Seric expand("\201n", buf, &buf[sizeof buf - 1], e); 42958111Seric ee->e_sender = newstr(buf); 43058121Seric if (ConfigLevel >= 4) 43158121Seric ee->e_returnpath = "<>"; 43258121Seric else 43358121Seric ee->e_returnpath = ee->e_sender; 434*58333Seric if (parseaddr(buf, &ee->e_from, -1, '\0', NULL, e) == NULL) 4354633Seric { 43658151Seric syserr("553 Can't parse myself!"); 4374633Seric ExitStat = EX_SOFTWARE; 4387045Seric returndepth--; 4394633Seric return (-1); 4404633Seric } 44116159Seric loweraddr(&ee->e_from); 4425984Seric 4436978Seric /* push state into submessage */ 4446978Seric CurEnv = ee; 44558050Seric define('f', "\201n", ee); 4469375Seric define('x', "Mail Delivery Subsystem", ee); 44757642Seric eatheader(ee, FALSE); 4485984Seric 4496978Seric /* actually deliver the error message */ 45014876Seric sendall(ee, SM_DEFAULT); 4516978Seric 4526978Seric /* restore state */ 4537811Seric dropenvelope(ee); 4546978Seric CurEnv = CurEnv->e_parent; 4557045Seric returndepth--; 4566978Seric 4577045Seric /* should check for delivery errors here */ 4584633Seric return (0); 4594633Seric } 4604633Seric /* 4616978Seric ** ERRBODY -- output the body of an error message. 4626978Seric ** 4636978Seric ** Typically this is a copy of the transcript plus a copy of the 4646978Seric ** original offending message. 4656978Seric ** 466297Seric ** Parameters: 467297Seric ** fp -- the output file. 46810170Seric ** m -- the mailer to output to. 4699542Seric ** e -- the envelope we are working in. 470297Seric ** 471297Seric ** Returns: 472297Seric ** none 473297Seric ** 474297Seric ** Side Effects: 4756978Seric ** Outputs the body of an error message. 476297Seric */ 477297Seric 47810170Seric errbody(fp, m, e) 479297Seric register FILE *fp; 4804318Seric register struct mailer *m; 4819542Seric register ENVELOPE *e; 482297Seric { 4836978Seric register FILE *xfile; 4843189Seric char buf[MAXLINE]; 4859337Seric char *p; 486297Seric 4879057Seric /* 48855372Seric ** Output error message header (if specified and available). 48955372Seric */ 49055372Seric 49155372Seric if (ErrMsgFile != NULL) 49255372Seric { 49355372Seric if (*ErrMsgFile == '/') 49455372Seric { 49555372Seric xfile = fopen(ErrMsgFile, "r"); 49655372Seric if (xfile != NULL) 49755372Seric { 49855372Seric while (fgets(buf, sizeof buf, xfile) != NULL) 49955425Seric { 50055425Seric expand(buf, buf, &buf[sizeof buf - 1], e); 50155372Seric putline(buf, fp, m); 50255425Seric } 50355372Seric (void) fclose(xfile); 50455372Seric fprintf(fp, "\n"); 50555372Seric } 50655372Seric } 50755372Seric else 50855372Seric { 50955425Seric expand(ErrMsgFile, buf, &buf[sizeof buf - 1], e); 51055425Seric putline(buf, fp, m); 51155372Seric fprintf(fp, "\n"); 51255372Seric } 51355372Seric } 51455372Seric 51555372Seric /* 5169057Seric ** Output transcript of errors 5179057Seric */ 5189057Seric 5194086Seric (void) fflush(stdout); 5209542Seric p = queuename(e->e_parent, 'x'); 5219337Seric if ((xfile = fopen(p, "r")) == NULL) 5229057Seric { 5239337Seric syserr("Cannot open %s", p); 5249057Seric fprintf(fp, " ----- Transcript of session is unavailable -----\n"); 5259057Seric } 5269057Seric else 5279057Seric { 5289057Seric fprintf(fp, " ----- Transcript of session follows -----\n"); 5299542Seric if (e->e_xfp != NULL) 5309542Seric (void) fflush(e->e_xfp); 5319057Seric while (fgets(buf, sizeof buf, xfile) != NULL) 53210170Seric putline(buf, fp, m); 5339057Seric (void) fclose(xfile); 5349057Seric } 535297Seric errno = 0; 5364318Seric 5374318Seric /* 5384318Seric ** Output text of original message 5394318Seric */ 5404318Seric 5414289Seric if (NoReturn) 5424289Seric fprintf(fp, "\n ----- Return message suppressed -----\n\n"); 5439542Seric else if (e->e_parent->e_dfp != NULL) 5444199Seric { 5455984Seric if (SendBody) 5465984Seric { 54710170Seric putline("\n", fp, m); 54810170Seric putline(" ----- Unsent message follows -----\n", fp, m); 5495984Seric (void) fflush(fp); 55010170Seric putheader(fp, m, e->e_parent); 55110170Seric putline("\n", fp, m); 55210170Seric putbody(fp, m, e->e_parent); 5535984Seric } 5545984Seric else 5555984Seric { 55610170Seric putline("\n", fp, m); 55710170Seric putline(" ----- Message header follows -----\n", fp, m); 5585984Seric (void) fflush(fp); 55910170Seric putheader(fp, m, e->e_parent); 5605984Seric } 5614199Seric } 5624199Seric else 56310170Seric { 56410170Seric putline("\n", fp, m); 56510170Seric putline(" ----- No message was collected -----\n", fp, m); 56610170Seric putline("\n", fp, m); 56710170Seric } 5684318Seric 5694318Seric /* 5704318Seric ** Cleanup and exit 5714318Seric */ 5724318Seric 573297Seric if (errno != 0) 5746978Seric syserr("errbody: I/O error"); 575297Seric } 57658144Seric /* 57758144Seric ** PRUNEROUTE -- prune an RFC-822 source route 57858144Seric ** 57958144Seric ** Trims down a source route to the last internet-registered hop. 58058144Seric ** This is encouraged by RFC 1123 section 5.3.3. 58158144Seric ** 58258144Seric ** Parameters: 58358144Seric ** addr -- the address 58458144Seric ** 58558144Seric ** Returns: 58658144Seric ** TRUE -- address was modified 58758144Seric ** FALSE -- address could not be pruned 58858144Seric ** 58958144Seric ** Side Effects: 59058144Seric ** modifies addr in-place 59158144Seric */ 59258144Seric 59358144Seric pruneroute(addr) 59458144Seric char *addr; 59558144Seric { 59658144Seric #ifdef NAMED_BIND 59758144Seric char *start, *at, *comma; 59858144Seric char c; 59958144Seric int rcode; 60058144Seric char hostbuf[BUFSIZ]; 60158144Seric char *mxhosts[MAXMXHOSTS + 1]; 60258144Seric 60358144Seric /* check to see if this is really a route-addr */ 60458144Seric if (*addr != '<' || addr[1] != '@' || addr[strlen(addr) - 1] != '>') 60558144Seric return FALSE; 60658144Seric start = strchr(addr, ':'); 60758144Seric at = strrchr(addr, '@'); 60858144Seric if (start == NULL || at == NULL || at < start) 60958144Seric return FALSE; 61058144Seric 61158144Seric /* slice off the angle brackets */ 61258144Seric strcpy(hostbuf, at + 1); 61358144Seric hostbuf[strlen(hostbuf) - 1] = '\0'; 61458144Seric 61558144Seric while (start) 61658144Seric { 61758144Seric if (getmxrr(hostbuf, mxhosts, "", &rcode) > 0) 61858144Seric { 61958144Seric strcpy(addr + 1, start + 1); 62058144Seric return TRUE; 62158144Seric } 62258144Seric c = *start; 62358144Seric *start = '\0'; 62458144Seric comma = strrchr(addr, ','); 62558144Seric if (comma && comma[1] == '@') 62658144Seric strcpy(hostbuf, comma + 2); 62758144Seric else 62858144Seric comma = 0; 62958144Seric *start = c; 63058144Seric start = comma; 63158144Seric } 63258144Seric #endif 63358144Seric return FALSE; 63458144Seric } 635