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.49 (Berkeley) 05/03/93 (with SMTP)"; 14 #else 15 static char sccsid[] = "@(#)srvrsmtp.c 6.49 (Berkeley) 05/03/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 SevenBit = FALSE; 372 } 373 else if (strcasecmp(vp, "7bit") == 0) 374 { 375 e->e_bodytype = "7BIT"; 376 SevenBit = TRUE; 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 if (e->e_sendmode != SM_DELIVER) 424 e->e_flags |= EF_VRFYONLY; 425 426 p = skipword(p, "to"); 427 if (p == NULL) 428 break; 429 a = parseaddr(p, (ADDRESS *) NULL, 1, ' ', NULL, e); 430 if (a == NULL) 431 break; 432 a->q_flags |= QPRIMARY; 433 a = recipient(a, &e->e_sendqueue, e); 434 if (Errors != 0) 435 break; 436 437 /* no errors during parsing, but might be a duplicate */ 438 e->e_to = p; 439 if (!bitset(QBADADDR, a->q_flags)) 440 message("250 Recipient ok"); 441 else 442 { 443 /* punt -- should keep message in ADDRESS.... */ 444 message("550 Addressee unknown"); 445 } 446 e->e_to = NULL; 447 break; 448 449 case CMDDATA: /* data -- text of mail */ 450 SmtpPhase = "DATA"; 451 if (!gotmail) 452 { 453 message("503 Need MAIL command"); 454 break; 455 } 456 else if (e->e_nrcpts <= 0) 457 { 458 message("503 Need RCPT (recipient)"); 459 break; 460 } 461 462 /* check to see if we need to re-expand aliases */ 463 for (a = e->e_sendqueue; a != NULL; a = a->q_next) 464 { 465 if (bitset(QVERIFIED, a->q_flags)) 466 break; 467 } 468 469 /* collect the text of the message */ 470 SmtpPhase = "collect"; 471 collect(TRUE, a != NULL, e); 472 if (Errors != 0) 473 break; 474 475 /* 476 ** Arrange to send to everyone. 477 ** If sending to multiple people, mail back 478 ** errors rather than reporting directly. 479 ** In any case, don't mail back errors for 480 ** anything that has happened up to 481 ** now (the other end will do this). 482 ** Truncate our transcript -- the mail has gotten 483 ** to us successfully, and if we have 484 ** to mail this back, it will be easier 485 ** on the reader. 486 ** Then send to everyone. 487 ** Finally give a reply code. If an error has 488 ** already been given, don't mail a 489 ** message back. 490 ** We goose error returns by clearing error bit. 491 */ 492 493 SmtpPhase = "delivery"; 494 if (e->e_nrcpts != 1) 495 { 496 HoldErrs = TRUE; 497 e->e_errormode = EM_MAIL; 498 } 499 e->e_flags &= ~EF_FATALERRS; 500 e->e_xfp = freopen(queuename(e, 'x'), "w", e->e_xfp); 501 id = e->e_id; 502 503 /* send to all recipients */ 504 sendall(e, a == NULL ? SM_DEFAULT : SM_QUEUE); 505 e->e_to = NULL; 506 507 /* save statistics */ 508 markstats(e, (ADDRESS *) NULL); 509 510 /* issue success if appropriate and reset */ 511 if (Errors == 0 || HoldErrs) 512 message("250 %s Message accepted for delivery", id); 513 else 514 e->e_flags &= ~EF_FATALERRS; 515 516 /* if we just queued, poke it */ 517 if (a != NULL && e->e_sendmode != SM_QUEUE) 518 { 519 unlockqueue(e); 520 dowork(id, TRUE, TRUE, e); 521 e->e_id = NULL; 522 } 523 524 /* if in a child, pop back to our parent */ 525 if (InChild) 526 finis(); 527 528 /* clean up a bit */ 529 gotmail = FALSE; 530 dropenvelope(e); 531 CurEnv = e = newenvelope(e, CurEnv); 532 e->e_flags = BlankEnvelope.e_flags; 533 break; 534 535 case CMDRSET: /* rset -- reset state */ 536 message("250 Reset state"); 537 if (InChild) 538 finis(); 539 540 /* clean up a bit */ 541 gotmail = FALSE; 542 dropenvelope(e); 543 CurEnv = e = newenvelope(e, CurEnv); 544 break; 545 546 case CMDVRFY: /* vrfy -- verify address */ 547 case CMDEXPN: /* expn -- expand address */ 548 vrfy = c->cmdcode == CMDVRFY; 549 if (bitset(vrfy ? PRIV_NOVRFY : PRIV_NOEXPN, 550 PrivacyFlags)) 551 { 552 if (vrfy) 553 message("252 Who's to say?"); 554 else 555 message("502 That's none of your business"); 556 break; 557 } 558 else if (!gothello && 559 bitset(vrfy ? PRIV_NEEDVRFYHELO : PRIV_NEEDEXPNHELO, 560 PrivacyFlags)) 561 { 562 message("503 I demand that you introduce yourself first"); 563 break; 564 } 565 if (runinchild(vrfy ? "SMTP-VRFY" : "SMTP-EXPN", e) > 0) 566 break; 567 #ifdef LOG 568 if (LogLevel > 5) 569 syslog(LOG_INFO, "%s: %s", CurHostName, inp); 570 #endif 571 vrfyqueue = NULL; 572 QuickAbort = TRUE; 573 if (vrfy) 574 e->e_flags |= EF_VRFYONLY; 575 (void) sendtolist(p, (ADDRESS *) NULL, &vrfyqueue, e); 576 if (Errors != 0) 577 { 578 if (InChild) 579 finis(); 580 break; 581 } 582 while (vrfyqueue != NULL) 583 { 584 register ADDRESS *a = vrfyqueue->q_next; 585 char *code; 586 587 while (a != NULL && bitset(QDONTSEND|QBADADDR, a->q_flags)) 588 a = a->q_next; 589 590 if (!bitset(QDONTSEND|QBADADDR, vrfyqueue->q_flags)) 591 printvrfyaddr(vrfyqueue, a == NULL); 592 else if (a == NULL) 593 message("554 Self destructive alias loop"); 594 vrfyqueue = a; 595 } 596 if (InChild) 597 finis(); 598 break; 599 600 case CMDHELP: /* help -- give user info */ 601 help(p); 602 break; 603 604 case CMDNOOP: /* noop -- do nothing */ 605 message("200 OK"); 606 break; 607 608 case CMDQUIT: /* quit -- leave mail */ 609 message("221 %s closing connection", MyHostName); 610 if (InChild) 611 ExitStat = EX_QUIT; 612 finis(); 613 614 case CMDVERB: /* set verbose mode */ 615 Verbose = TRUE; 616 e->e_sendmode = SM_DELIVER; 617 message("200 Verbose mode"); 618 break; 619 620 case CMDONEX: /* doing one transaction only */ 621 OneXact = TRUE; 622 message("200 Only one transaction"); 623 break; 624 625 # ifdef SMTPDEBUG 626 case CMDDBGQSHOW: /* show queues */ 627 printf("Send Queue="); 628 printaddr(e->e_sendqueue, TRUE); 629 break; 630 631 case CMDDBGDEBUG: /* set debug mode */ 632 tTsetup(tTdvect, sizeof tTdvect, "0-99.1"); 633 tTflag(p); 634 message("200 Debug set"); 635 break; 636 637 # else /* not SMTPDEBUG */ 638 639 case CMDDBGQSHOW: /* show queues */ 640 case CMDDBGDEBUG: /* set debug mode */ 641 # ifdef LOG 642 if (LogLevel > 0) 643 syslog(LOG_NOTICE, 644 "\"%s\" command from %s (%s)", 645 c->cmdname, RealHostName, 646 anynet_ntoa(&RealHostAddr)); 647 # endif 648 /* FALL THROUGH */ 649 # endif /* SMTPDEBUG */ 650 651 case CMDERROR: /* unknown command */ 652 message("500 Command unrecognized"); 653 break; 654 655 default: 656 errno = 0; 657 syserr("500 smtp: unknown code %d", c->cmdcode); 658 break; 659 } 660 } 661 } 662 /* 663 ** SKIPWORD -- skip a fixed word. 664 ** 665 ** Parameters: 666 ** p -- place to start looking. 667 ** w -- word to skip. 668 ** 669 ** Returns: 670 ** p following w. 671 ** NULL on error. 672 ** 673 ** Side Effects: 674 ** clobbers the p data area. 675 */ 676 677 static char * 678 skipword(p, w) 679 register char *p; 680 char *w; 681 { 682 register char *q; 683 684 /* find beginning of word */ 685 while (isascii(*p) && isspace(*p)) 686 p++; 687 q = p; 688 689 /* find end of word */ 690 while (*p != '\0' && *p != ':' && !(isascii(*p) && isspace(*p))) 691 p++; 692 while (isascii(*p) && isspace(*p)) 693 *p++ = '\0'; 694 if (*p != ':') 695 { 696 syntax: 697 message("501 Syntax error"); 698 Errors++; 699 return (NULL); 700 } 701 *p++ = '\0'; 702 while (isascii(*p) && isspace(*p)) 703 p++; 704 705 /* see if the input word matches desired word */ 706 if (strcasecmp(q, w)) 707 goto syntax; 708 709 return (p); 710 } 711 /* 712 ** PRINTVRFYADDR -- print an entry in the verify queue 713 ** 714 ** Parameters: 715 ** a -- the address to print 716 ** last -- set if this is the last one. 717 ** 718 ** Returns: 719 ** none. 720 ** 721 ** Side Effects: 722 ** Prints the appropriate 250 codes. 723 */ 724 725 printvrfyaddr(a, last) 726 register ADDRESS *a; 727 bool last; 728 { 729 char fmtbuf[20]; 730 731 strcpy(fmtbuf, "250"); 732 fmtbuf[3] = last ? ' ' : '-'; 733 734 if (strchr(a->q_paddr, '<') != NULL) 735 strcpy(&fmtbuf[4], "%s"); 736 else if (a->q_fullname == NULL) 737 strcpy(&fmtbuf[4], "<%s>"); 738 else 739 { 740 strcpy(&fmtbuf[4], "%s <%s>"); 741 message(fmtbuf, a->q_fullname, a->q_paddr); 742 return; 743 } 744 message(fmtbuf, a->q_paddr); 745 } 746 /* 747 ** HELP -- implement the HELP command. 748 ** 749 ** Parameters: 750 ** topic -- the topic we want help for. 751 ** 752 ** Returns: 753 ** none. 754 ** 755 ** Side Effects: 756 ** outputs the help file to message output. 757 */ 758 759 help(topic) 760 char *topic; 761 { 762 register FILE *hf; 763 int len; 764 char buf[MAXLINE]; 765 bool noinfo; 766 767 if (HelpFile == NULL || (hf = fopen(HelpFile, "r")) == NULL) 768 { 769 /* no help */ 770 errno = 0; 771 message("502 HELP not implemented"); 772 return; 773 } 774 775 if (topic == NULL || *topic == '\0') 776 topic = "smtp"; 777 else 778 makelower(topic); 779 780 len = strlen(topic); 781 noinfo = TRUE; 782 783 while (fgets(buf, sizeof buf, hf) != NULL) 784 { 785 if (strncmp(buf, topic, len) == 0) 786 { 787 register char *p; 788 789 p = strchr(buf, '\t'); 790 if (p == NULL) 791 p = buf; 792 else 793 p++; 794 fixcrlf(p, TRUE); 795 message("214-%s", p); 796 noinfo = FALSE; 797 } 798 } 799 800 if (noinfo) 801 message("504 HELP topic unknown"); 802 else 803 message("214 End of HELP info"); 804 (void) fclose(hf); 805 } 806 /* 807 ** RUNINCHILD -- return twice -- once in the child, then in the parent again 808 ** 809 ** Parameters: 810 ** label -- a string used in error messages 811 ** 812 ** Returns: 813 ** zero in the child 814 ** one in the parent 815 ** 816 ** Side Effects: 817 ** none. 818 */ 819 820 runinchild(label, e) 821 char *label; 822 register ENVELOPE *e; 823 { 824 int childpid; 825 826 if (!OneXact) 827 { 828 childpid = dofork(); 829 if (childpid < 0) 830 { 831 syserr("%s: cannot fork", label); 832 return (1); 833 } 834 if (childpid > 0) 835 { 836 auto int st; 837 838 /* parent -- wait for child to complete */ 839 setproctitle("srvrsmtp %s child wait", CurHostName); 840 st = waitfor(childpid); 841 if (st == -1) 842 syserr("%s: lost child", label); 843 844 /* if we exited on a QUIT command, complete the process */ 845 if (st == (EX_QUIT << 8)) 846 finis(); 847 848 return (1); 849 } 850 else 851 { 852 /* child */ 853 InChild = TRUE; 854 QuickAbort = FALSE; 855 clearenvelope(e, FALSE); 856 } 857 } 858 859 /* open alias database */ 860 initaliases(FALSE, e); 861 862 return (0); 863 } 864 865 # endif /* SMTP */ 866