1 /* 2 * Copyright (c) 1983 Eric P. Allman 3 * Copyright (c) 1988 Regents of the University of California. 4 * All rights reserved. 5 * 6 * %sccs.include.redist.c% 7 */ 8 9 # include "sendmail.h" 10 11 #ifndef lint 12 #ifdef SMTP 13 static char sccsid[] = "@(#)srvrsmtp.c 6.46 (Berkeley) 04/26/93 (with SMTP)"; 14 #else 15 static char sccsid[] = "@(#)srvrsmtp.c 6.46 (Berkeley) 04/26/93 (without SMTP)"; 16 #endif 17 #endif /* not lint */ 18 19 # include <errno.h> 20 # include <signal.h> 21 22 # ifdef SMTP 23 24 /* 25 ** SMTP -- run the SMTP protocol. 26 ** 27 ** Parameters: 28 ** none. 29 ** 30 ** Returns: 31 ** never. 32 ** 33 ** Side Effects: 34 ** Reads commands from the input channel and processes 35 ** them. 36 */ 37 38 struct cmd 39 { 40 char *cmdname; /* command name */ 41 int cmdcode; /* internal code, see below */ 42 }; 43 44 /* values for cmdcode */ 45 # define CMDERROR 0 /* bad command */ 46 # define CMDMAIL 1 /* mail -- designate sender */ 47 # define CMDRCPT 2 /* rcpt -- designate recipient */ 48 # define CMDDATA 3 /* data -- send message text */ 49 # define CMDRSET 4 /* rset -- reset state */ 50 # define CMDVRFY 5 /* vrfy -- verify address */ 51 # define CMDEXPN 6 /* expn -- expand address */ 52 # define CMDNOOP 7 /* noop -- do nothing */ 53 # define CMDQUIT 8 /* quit -- close connection and die */ 54 # define CMDHELO 9 /* helo -- be polite */ 55 # define CMDHELP 10 /* help -- give usage info */ 56 # define CMDEHLO 11 /* ehlo -- extended helo (RFC 1425) */ 57 /* non-standard commands */ 58 # define CMDONEX 16 /* onex -- sending one transaction only */ 59 # define CMDVERB 17 /* verb -- go into verbose mode */ 60 /* debugging-only commands, only enabled if SMTPDEBUG is defined */ 61 # define CMDDBGQSHOW 24 /* showq -- show send queue */ 62 # define CMDDBGDEBUG 25 /* debug -- set debug mode */ 63 64 static struct cmd CmdTab[] = 65 { 66 "mail", CMDMAIL, 67 "rcpt", CMDRCPT, 68 "data", CMDDATA, 69 "rset", CMDRSET, 70 "vrfy", CMDVRFY, 71 "expn", CMDEXPN, 72 "help", CMDHELP, 73 "noop", CMDNOOP, 74 "quit", CMDQUIT, 75 "helo", CMDHELO, 76 "ehlo", CMDEHLO, 77 "verb", CMDVERB, 78 "onex", CMDONEX, 79 /* 80 * remaining commands are here only 81 * to trap and log attempts to use them 82 */ 83 "showq", CMDDBGQSHOW, 84 "debug", CMDDBGDEBUG, 85 NULL, CMDERROR, 86 }; 87 88 bool InChild = FALSE; /* true if running in a subprocess */ 89 bool OneXact = FALSE; /* one xaction only this run */ 90 91 #define EX_QUIT 22 /* special code for QUIT command */ 92 93 smtp(e) 94 register ENVELOPE *e; 95 { 96 register char *p; 97 register struct cmd *c; 98 char *cmd; 99 static char *skipword(); 100 auto ADDRESS *vrfyqueue; 101 ADDRESS *a; 102 bool gotmail; /* mail command received */ 103 bool gothello; /* helo command received */ 104 bool vrfy; /* set if this is a vrfy command */ 105 char *protocol; /* sending protocol */ 106 char *sendinghost; /* sending hostname */ 107 long msize; /* approximate maximum message size */ 108 auto char *delimptr; 109 char *id; 110 char inp[MAXLINE]; 111 char cmdbuf[MAXLINE]; 112 extern char Version[]; 113 extern char *macvalue(); 114 extern ADDRESS *recipient(); 115 extern ENVELOPE BlankEnvelope; 116 extern ENVELOPE *newenvelope(); 117 extern char *anynet_ntoa(); 118 119 if (fileno(OutChannel) != fileno(stdout)) 120 { 121 /* arrange for debugging output to go to remote host */ 122 (void) dup2(fileno(OutChannel), fileno(stdout)); 123 } 124 settime(e); 125 CurHostName = RealHostName; 126 setproctitle("srvrsmtp %s startup", CurHostName); 127 expand("\201e", inp, &inp[sizeof inp], e); 128 message("220 %s", inp); 129 protocol = NULL; 130 sendinghost = macvalue('s', e); 131 gothello = FALSE; 132 gotmail = FALSE; 133 for (;;) 134 { 135 /* arrange for backout */ 136 if (setjmp(TopFrame) > 0 && InChild) 137 { 138 QuickAbort = FALSE; 139 SuprErrs = TRUE; 140 finis(); 141 } 142 QuickAbort = FALSE; 143 HoldErrs = FALSE; 144 LogUsrErrs = FALSE; 145 e->e_flags &= ~EF_VRFYONLY; 146 147 /* setup for the read */ 148 e->e_to = NULL; 149 Errors = 0; 150 (void) fflush(stdout); 151 152 /* read the input line */ 153 SmtpPhase = "srvrsmtp cmd read"; 154 setproctitle("srvrsmtp %s cmd read", CurHostName); 155 p = sfgets(inp, sizeof inp, InChannel, TimeOuts.to_nextcommand); 156 157 /* handle errors */ 158 if (p == NULL) 159 { 160 /* end of file, just die */ 161 message("421 %s Lost input channel from %s", 162 MyHostName, CurHostName); 163 #ifdef LOG 164 if (LogLevel > 1) 165 syslog(LOG_NOTICE, "lost input channel from %s", 166 CurHostName); 167 #endif 168 if (InChild) 169 ExitStat = EX_QUIT; 170 finis(); 171 } 172 173 /* clean up end of line */ 174 fixcrlf(inp, TRUE); 175 176 /* echo command to transcript */ 177 if (e->e_xfp != NULL) 178 fprintf(e->e_xfp, "<<< %s\n", inp); 179 180 if (e->e_id == NULL) 181 setproctitle("%s: %s", CurHostName, inp); 182 else 183 setproctitle("%s %s: %s", e->e_id, CurHostName, inp); 184 185 /* break off command */ 186 for (p = inp; isascii(*p) && isspace(*p); p++) 187 continue; 188 cmd = cmdbuf; 189 while (*p != '\0' && 190 !(isascii(*p) && isspace(*p)) && 191 cmd < &cmdbuf[sizeof cmdbuf - 2]) 192 *cmd++ = *p++; 193 *cmd = '\0'; 194 195 /* throw away leading whitespace */ 196 while (isascii(*p) && isspace(*p)) 197 p++; 198 199 /* decode command */ 200 for (c = CmdTab; c->cmdname != NULL; c++) 201 { 202 if (!strcasecmp(c->cmdname, cmdbuf)) 203 break; 204 } 205 206 /* reset errors */ 207 errno = 0; 208 209 /* process command */ 210 switch (c->cmdcode) 211 { 212 case CMDHELO: /* hello -- introduce yourself */ 213 case CMDEHLO: /* extended hello */ 214 if (c->cmdcode == CMDEHLO) 215 { 216 protocol = "ESMTP"; 217 SmtpPhase = "EHLO"; 218 } 219 else 220 { 221 protocol = "SMTP"; 222 SmtpPhase = "HELO"; 223 } 224 sendinghost = newstr(p); 225 if (strcasecmp(p, RealHostName) != 0) 226 { 227 auth_warning(e, "Host %s claimed to be %s", 228 RealHostName, p); 229 } 230 p = macvalue('_', e); 231 if (p == NULL) 232 p = RealHostName; 233 234 /* send ext. message -- old systems must ignore */ 235 message("250-%s Hello %s, pleased to meet you", 236 MyHostName, p); 237 if (!bitset(PRIV_NOEXPN, PrivacyFlags)) 238 message("250-EXPN"); 239 if (MaxMessageSize > 0) 240 message("250-SIZE %ld", MaxMessageSize); 241 else 242 message("250-SIZE"); 243 message("250 HELP"); 244 gothello = TRUE; 245 break; 246 247 case CMDMAIL: /* mail -- designate sender */ 248 SmtpPhase = "MAIL"; 249 250 /* check for validity of this command */ 251 if (!gothello) 252 { 253 /* set sending host to our known value */ 254 if (sendinghost == NULL) 255 sendinghost = RealHostName; 256 257 if (bitset(PRIV_NEEDMAILHELO, PrivacyFlags)) 258 { 259 message("503 Polite people say HELO first"); 260 break; 261 } 262 else 263 { 264 auth_warning(e, 265 "Host %s didn't use HELO protocol", 266 RealHostName); 267 } 268 } 269 if (gotmail) 270 { 271 message("503 Sender already specified"); 272 break; 273 } 274 if (InChild) 275 { 276 errno = 0; 277 syserr("503 Nested MAIL command: MAIL %s", p); 278 finis(); 279 } 280 281 /* fork a subprocess to process this command */ 282 if (runinchild("SMTP-MAIL", e) > 0) 283 break; 284 if (protocol == NULL) 285 protocol = "SMTP"; 286 define('r', protocol, e); 287 define('s', sendinghost, e); 288 initsys(e); 289 setproctitle("%s %s: %s", e->e_id, CurHostName, inp); 290 291 /* child -- go do the processing */ 292 p = skipword(p, "from"); 293 if (p == NULL) 294 break; 295 if (setjmp(TopFrame) > 0) 296 { 297 /* this failed -- undo work */ 298 if (InChild) 299 { 300 QuickAbort = FALSE; 301 SuprErrs = TRUE; 302 finis(); 303 } 304 break; 305 } 306 QuickAbort = TRUE; 307 308 /* must parse sender first */ 309 delimptr = NULL; 310 setsender(p, e, &delimptr, FALSE); 311 p = delimptr; 312 if (p != NULL && *p != '\0') 313 *p++ = '\0'; 314 315 /* now parse ESMTP arguments */ 316 msize = 0; 317 for (; p != NULL && *p != '\0'; p++) 318 { 319 char *kp; 320 char *vp; 321 322 /* locate the beginning of the keyword */ 323 while (isascii(*p) && isspace(*p)) 324 p++; 325 if (*p == '\0') 326 break; 327 kp = p; 328 329 /* skip to the value portion */ 330 while (isascii(*p) && isalnum(*p) || *p == '-') 331 p++; 332 if (*p == '=') 333 { 334 *p++ = '\0'; 335 vp = p; 336 337 /* skip to the end of the value */ 338 while (*p != '\0' && *p != ' ' && 339 !(isascii(*p) && iscntrl(*p)) && 340 *p != '=') 341 p++; 342 } 343 344 if (*p != '\0') 345 *p++ = '\0'; 346 347 if (tTd(19, 1)) 348 printf("MAIL: got arg %s=%s\n", kp, 349 vp == NULL ? "<null>" : vp); 350 351 if (strcasecmp(kp, "size") == 0) 352 { 353 if (vp == NULL) 354 { 355 usrerr("501 SIZE requires a value"); 356 /* NOTREACHED */ 357 } 358 msize = atol(vp); 359 } 360 else if (strcasecmp(kp, "body") == 0) 361 { 362 if (vp == NULL) 363 { 364 usrerr("501 BODY requires a value"); 365 /* NOTREACHED */ 366 } 367 # ifdef MIME 368 if (strcasecmp(vp, "8bitmime") == 0) 369 { 370 e->e_bodytype = "8BITMIME"; 371 EightBit = TRUE; 372 } 373 else if (strcasecmp(vp, "7bit") == 0) 374 { 375 e->e_bodytype = "7BIT"; 376 EightBit = FALSE; 377 } 378 else 379 { 380 usrerr("501 Unknown BODY type %s", 381 vp); 382 } 383 # endif 384 } 385 else 386 { 387 usrerr("501 %s parameter unrecognized", kp); 388 /* NOTREACHED */ 389 } 390 } 391 392 if (MaxMessageSize > 0 && msize > MaxMessageSize) 393 { 394 usrerr("552 Message size exceeds fixed maximum message size (%ld)", 395 MaxMessageSize); 396 /* NOTREACHED */ 397 } 398 399 if (!enoughspace(msize)) 400 { 401 message("452 Insufficient disk space; try again later"); 402 break; 403 } 404 message("250 Sender ok"); 405 gotmail = TRUE; 406 break; 407 408 case CMDRCPT: /* rcpt -- designate recipient */ 409 if (!gotmail) 410 { 411 usrerr("503 Need MAIL before RCPT"); 412 break; 413 } 414 SmtpPhase = "RCPT"; 415 if (setjmp(TopFrame) > 0) 416 { 417 e->e_flags &= ~EF_FATALERRS; 418 break; 419 } 420 QuickAbort = TRUE; 421 LogUsrErrs = TRUE; 422 423 e->e_flags |= EF_VRFYONLY; 424 425 p = skipword(p, "to"); 426 if (p == NULL) 427 break; 428 a = parseaddr(p, (ADDRESS *) NULL, 1, ' ', NULL, e); 429 if (a == NULL) 430 break; 431 a->q_flags |= QPRIMARY; 432 a = recipient(a, &e->e_sendqueue, e); 433 if (Errors != 0) 434 break; 435 436 /* no errors during parsing, but might be a duplicate */ 437 e->e_to = p; 438 if (!bitset(QBADADDR, a->q_flags)) 439 message("250 Recipient ok"); 440 else 441 { 442 /* punt -- should keep message in ADDRESS.... */ 443 message("550 Addressee unknown"); 444 } 445 e->e_to = NULL; 446 break; 447 448 case CMDDATA: /* data -- text of mail */ 449 SmtpPhase = "DATA"; 450 if (!gotmail) 451 { 452 message("503 Need MAIL command"); 453 break; 454 } 455 else if (e->e_nrcpts <= 0) 456 { 457 message("503 Need RCPT (recipient)"); 458 break; 459 } 460 461 /* check to see if we need to re-expand aliases */ 462 for (a = e->e_sendqueue; a != NULL; a = a->q_next) 463 { 464 if (bitset(QVERIFIED, a->q_flags)) 465 break; 466 } 467 468 /* collect the text of the message */ 469 SmtpPhase = "collect"; 470 collect(TRUE, a != NULL, e); 471 if (Errors != 0) 472 break; 473 474 /* 475 ** Arrange to send to everyone. 476 ** If sending to multiple people, mail back 477 ** errors rather than reporting directly. 478 ** In any case, don't mail back errors for 479 ** anything that has happened up to 480 ** now (the other end will do this). 481 ** Truncate our transcript -- the mail has gotten 482 ** to us successfully, and if we have 483 ** to mail this back, it will be easier 484 ** on the reader. 485 ** Then send to everyone. 486 ** Finally give a reply code. If an error has 487 ** already been given, don't mail a 488 ** message back. 489 ** We goose error returns by clearing error bit. 490 */ 491 492 SmtpPhase = "delivery"; 493 if (e->e_nrcpts != 1) 494 { 495 HoldErrs = TRUE; 496 e->e_errormode = EM_MAIL; 497 } 498 e->e_flags &= ~EF_FATALERRS; 499 e->e_xfp = freopen(queuename(e, 'x'), "w", e->e_xfp); 500 id = e->e_id; 501 502 /* send to all recipients */ 503 sendall(e, a == NULL ? SM_DEFAULT : SM_QUEUE); 504 e->e_to = NULL; 505 506 /* save statistics */ 507 markstats(e, (ADDRESS *) NULL); 508 509 /* issue success if appropriate and reset */ 510 if (Errors == 0 || HoldErrs) 511 message("250 %s Message accepted for delivery", id); 512 else 513 e->e_flags &= ~EF_FATALERRS; 514 515 /* if we just queued, poke it */ 516 if (a != NULL && e->e_sendmode != SM_QUEUE) 517 { 518 unlockqueue(e); 519 dowork(id, TRUE, TRUE, e); 520 e->e_id = NULL; 521 } 522 523 /* if in a child, pop back to our parent */ 524 if (InChild) 525 finis(); 526 527 /* clean up a bit */ 528 gotmail = FALSE; 529 dropenvelope(e); 530 CurEnv = e = newenvelope(e, CurEnv); 531 e->e_flags = BlankEnvelope.e_flags; 532 break; 533 534 case CMDRSET: /* rset -- reset state */ 535 message("250 Reset state"); 536 if (InChild) 537 finis(); 538 539 /* clean up a bit */ 540 gotmail = FALSE; 541 dropenvelope(e); 542 CurEnv = e = newenvelope(e, CurEnv); 543 break; 544 545 case CMDVRFY: /* vrfy -- verify address */ 546 case CMDEXPN: /* expn -- expand address */ 547 vrfy = c->cmdcode == CMDVRFY; 548 if (bitset(vrfy ? PRIV_NOVRFY : PRIV_NOEXPN, 549 PrivacyFlags)) 550 { 551 if (vrfy) 552 message("252 Who's to say?"); 553 else 554 message("502 That's none of your business"); 555 break; 556 } 557 else if (!gothello && 558 bitset(vrfy ? PRIV_NEEDVRFYHELO : PRIV_NEEDEXPNHELO, 559 PrivacyFlags)) 560 { 561 message("503 I demand that you introduce yourself first"); 562 break; 563 } 564 if (runinchild(vrfy ? "SMTP-VRFY" : "SMTP-EXPN", e) > 0) 565 break; 566 #ifdef LOG 567 if (LogLevel > 5) 568 syslog(LOG_INFO, "%s: %s", CurHostName, inp); 569 #endif 570 vrfyqueue = NULL; 571 QuickAbort = TRUE; 572 if (vrfy) 573 e->e_flags |= EF_VRFYONLY; 574 (void) sendtolist(p, (ADDRESS *) NULL, &vrfyqueue, e); 575 if (Errors != 0) 576 { 577 if (InChild) 578 finis(); 579 break; 580 } 581 while (vrfyqueue != NULL) 582 { 583 register ADDRESS *a = vrfyqueue->q_next; 584 char *code; 585 586 while (a != NULL && bitset(QDONTSEND|QBADADDR, a->q_flags)) 587 a = a->q_next; 588 589 if (!bitset(QDONTSEND|QBADADDR, vrfyqueue->q_flags)) 590 printvrfyaddr(vrfyqueue, a == NULL); 591 else if (a == NULL) 592 message("554 Self destructive alias loop"); 593 vrfyqueue = a; 594 } 595 if (InChild) 596 finis(); 597 break; 598 599 case CMDHELP: /* help -- give user info */ 600 help(p); 601 break; 602 603 case CMDNOOP: /* noop -- do nothing */ 604 message("200 OK"); 605 break; 606 607 case CMDQUIT: /* quit -- leave mail */ 608 message("221 %s closing connection", MyHostName); 609 if (InChild) 610 ExitStat = EX_QUIT; 611 finis(); 612 613 case CMDVERB: /* set verbose mode */ 614 Verbose = TRUE; 615 e->e_sendmode = SM_DELIVER; 616 message("200 Verbose mode"); 617 break; 618 619 case CMDONEX: /* doing one transaction only */ 620 OneXact = TRUE; 621 message("200 Only one transaction"); 622 break; 623 624 # ifdef SMTPDEBUG 625 case CMDDBGQSHOW: /* show queues */ 626 printf("Send Queue="); 627 printaddr(e->e_sendqueue, TRUE); 628 break; 629 630 case CMDDBGDEBUG: /* set debug mode */ 631 tTsetup(tTdvect, sizeof tTdvect, "0-99.1"); 632 tTflag(p); 633 message("200 Debug set"); 634 break; 635 636 # else /* not SMTPDEBUG */ 637 638 case CMDDBGQSHOW: /* show queues */ 639 case CMDDBGDEBUG: /* set debug mode */ 640 # ifdef LOG 641 if (LogLevel > 0) 642 syslog(LOG_NOTICE, 643 "\"%s\" command from %s (%s)", 644 c->cmdname, RealHostName, 645 anynet_ntoa(&RealHostAddr)); 646 # endif 647 /* FALL THROUGH */ 648 # endif /* SMTPDEBUG */ 649 650 case CMDERROR: /* unknown command */ 651 message("500 Command unrecognized"); 652 break; 653 654 default: 655 errno = 0; 656 syserr("500 smtp: unknown code %d", c->cmdcode); 657 break; 658 } 659 } 660 } 661 /* 662 ** SKIPWORD -- skip a fixed word. 663 ** 664 ** Parameters: 665 ** p -- place to start looking. 666 ** w -- word to skip. 667 ** 668 ** Returns: 669 ** p following w. 670 ** NULL on error. 671 ** 672 ** Side Effects: 673 ** clobbers the p data area. 674 */ 675 676 static char * 677 skipword(p, w) 678 register char *p; 679 char *w; 680 { 681 register char *q; 682 683 /* find beginning of word */ 684 while (isascii(*p) && isspace(*p)) 685 p++; 686 q = p; 687 688 /* find end of word */ 689 while (*p != '\0' && *p != ':' && !(isascii(*p) && isspace(*p))) 690 p++; 691 while (isascii(*p) && isspace(*p)) 692 *p++ = '\0'; 693 if (*p != ':') 694 { 695 syntax: 696 message("501 Syntax error"); 697 Errors++; 698 return (NULL); 699 } 700 *p++ = '\0'; 701 while (isascii(*p) && isspace(*p)) 702 p++; 703 704 /* see if the input word matches desired word */ 705 if (strcasecmp(q, w)) 706 goto syntax; 707 708 return (p); 709 } 710 /* 711 ** PRINTVRFYADDR -- print an entry in the verify queue 712 ** 713 ** Parameters: 714 ** a -- the address to print 715 ** last -- set if this is the last one. 716 ** 717 ** Returns: 718 ** none. 719 ** 720 ** Side Effects: 721 ** Prints the appropriate 250 codes. 722 */ 723 724 printvrfyaddr(a, last) 725 register ADDRESS *a; 726 bool last; 727 { 728 char fmtbuf[20]; 729 730 strcpy(fmtbuf, "250"); 731 fmtbuf[3] = last ? ' ' : '-'; 732 733 if (strchr(a->q_paddr, '<') != NULL) 734 strcpy(&fmtbuf[4], "%s"); 735 else if (a->q_fullname == NULL) 736 strcpy(&fmtbuf[4], "<%s>"); 737 else 738 { 739 strcpy(&fmtbuf[4], "%s <%s>"); 740 message(fmtbuf, a->q_fullname, a->q_paddr); 741 return; 742 } 743 message(fmtbuf, a->q_paddr); 744 } 745 /* 746 ** HELP -- implement the HELP command. 747 ** 748 ** Parameters: 749 ** topic -- the topic we want help for. 750 ** 751 ** Returns: 752 ** none. 753 ** 754 ** Side Effects: 755 ** outputs the help file to message output. 756 */ 757 758 help(topic) 759 char *topic; 760 { 761 register FILE *hf; 762 int len; 763 char buf[MAXLINE]; 764 bool noinfo; 765 766 if (HelpFile == NULL || (hf = fopen(HelpFile, "r")) == NULL) 767 { 768 /* no help */ 769 errno = 0; 770 message("502 HELP not implemented"); 771 return; 772 } 773 774 if (topic == NULL || *topic == '\0') 775 topic = "smtp"; 776 else 777 makelower(topic); 778 779 len = strlen(topic); 780 noinfo = TRUE; 781 782 while (fgets(buf, sizeof buf, hf) != NULL) 783 { 784 if (strncmp(buf, topic, len) == 0) 785 { 786 register char *p; 787 788 p = strchr(buf, '\t'); 789 if (p == NULL) 790 p = buf; 791 else 792 p++; 793 fixcrlf(p, TRUE); 794 message("214-%s", p); 795 noinfo = FALSE; 796 } 797 } 798 799 if (noinfo) 800 message("504 HELP topic unknown"); 801 else 802 message("214 End of HELP info"); 803 (void) fclose(hf); 804 } 805 /* 806 ** RUNINCHILD -- return twice -- once in the child, then in the parent again 807 ** 808 ** Parameters: 809 ** label -- a string used in error messages 810 ** 811 ** Returns: 812 ** zero in the child 813 ** one in the parent 814 ** 815 ** Side Effects: 816 ** none. 817 */ 818 819 runinchild(label, e) 820 char *label; 821 register ENVELOPE *e; 822 { 823 int childpid; 824 825 if (!OneXact) 826 { 827 childpid = dofork(); 828 if (childpid < 0) 829 { 830 syserr("%s: cannot fork", label); 831 return (1); 832 } 833 if (childpid > 0) 834 { 835 auto int st; 836 837 /* parent -- wait for child to complete */ 838 setproctitle("srvrsmtp %s child wait", CurHostName); 839 st = waitfor(childpid); 840 if (st == -1) 841 syserr("%s: lost child", label); 842 843 /* if we exited on a QUIT command, complete the process */ 844 if (st == (EX_QUIT << 8)) 845 finis(); 846 847 return (1); 848 } 849 else 850 { 851 /* child */ 852 InChild = TRUE; 853 QuickAbort = FALSE; 854 clearenvelope(e, FALSE); 855 } 856 } 857 858 /* open alias database */ 859 initaliases(AliasFile, FALSE, e); 860 861 return (0); 862 } 863 864 # endif /* SMTP */ 865