daemon.c (42575) | daemon.c (43730) |
---|---|
1/* 2 * Copyright (c) 1998 Sendmail, Inc. All rights reserved. 3 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 4 * Copyright (c) 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * By using this file, you agree to the terms and conditions set 8 * forth in the LICENSE file which can be found at the top level of 9 * the sendmail distribution. 10 * 11 */ 12 13#include <errno.h> 14#include "sendmail.h" 15 16#ifndef lint 17#ifdef DAEMON | 1/* 2 * Copyright (c) 1998 Sendmail, Inc. All rights reserved. 3 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 4 * Copyright (c) 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * By using this file, you agree to the terms and conditions set 8 * forth in the LICENSE file which can be found at the top level of 9 * the sendmail distribution. 10 * 11 */ 12 13#include <errno.h> 14#include "sendmail.h" 15 16#ifndef lint 17#ifdef DAEMON |
18static char sccsid[] = "@(#)daemon.c 8.234 (Berkeley) 12/17/1998 (with daemon mode)"; | 18static char sccsid[] = "@(#)daemon.c 8.236 (Berkeley) 1/25/1999 (with daemon mode)"; |
19#else | 19#else |
20static char sccsid[] = "@(#)daemon.c 8.234 (Berkeley) 12/17/1998 (without daemon mode)"; | 20static char sccsid[] = "@(#)daemon.c 8.236 (Berkeley) 1/25/1999 (without daemon mode)"; |
21#endif 22#endif /* not lint */ 23 24#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__) 25# define USE_SOCK_STREAM 1 26#endif 27 28#if DAEMON || defined(USE_SOCK_STREAM) --- 144 unchanged lines hidden (view full) --- 173 if (tTd(15, 1)) 174 printf("getrequests: port 0x%x\n", port); 175 176 /* get a socket for the SMTP connection */ 177 socksize = opendaemonsocket(TRUE); 178 179 if (opencontrolsocket() < 0) 180 sm_syslog(LOG_WARNING, NOQID, | 21#endif 22#endif /* not lint */ 23 24#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__) 25# define USE_SOCK_STREAM 1 26#endif 27 28#if DAEMON || defined(USE_SOCK_STREAM) --- 144 unchanged lines hidden (view full) --- 173 if (tTd(15, 1)) 174 printf("getrequests: port 0x%x\n", port); 175 176 /* get a socket for the SMTP connection */ 177 socksize = opendaemonsocket(TRUE); 178 179 if (opencontrolsocket() < 0) 180 sm_syslog(LOG_WARNING, NOQID, |
181 "daemon could not open control socket: %s", 182 errstring(errno)); | 181 "daemon could not open control socket %s: %s", 182 ControlSocketName, errstring(errno)); |
183 184 (void) setsignal(SIGCHLD, reapchild); 185 186 /* write the pid to the log file for posterity */ 187 sff = SFF_NOLINK|SFF_ROOTOK|SFF_REGONLY|SFF_CREAT; 188 if (TrustedUid != 0 && RealUid == TrustedUid) 189 sff |= SFF_OPENASROOT; 190 pidf = safefopen(PidFile, O_WRONLY|O_TRUNC, 0644, sff); --- 307 unchanged lines hidden (view full) --- 498 message("421 Too many SMTP sessions for this host"); 499 finis(FALSE, EX_OK); 500 } 501#endif 502 break; 503 } 504 505 /* parent -- keep track of children */ | 183 184 (void) setsignal(SIGCHLD, reapchild); 185 186 /* write the pid to the log file for posterity */ 187 sff = SFF_NOLINK|SFF_ROOTOK|SFF_REGONLY|SFF_CREAT; 188 if (TrustedUid != 0 && RealUid == TrustedUid) 189 sff |= SFF_OPENASROOT; 190 pidf = safefopen(PidFile, O_WRONLY|O_TRUNC, 0644, sff); --- 307 unchanged lines hidden (view full) --- 498 message("421 Too many SMTP sessions for this host"); 499 finis(FALSE, EX_OK); 500 } 501#endif 502 break; 503 } 504 505 /* parent -- keep track of children */ |
506 snprintf(status, MAXLINE, "SMTP server child for %s", | 506 snprintf(status, sizeof status, "SMTP server child for %s", |
507 anynet_ntoa(&RealHostAddr)); 508 proc_list_add(pid, status); 509 (void) releasesignal(SIGCHLD); 510 511 /* close the read end of the synchronization pipe */ 512 if (pipefd[0] != -1) 513 (void) close(pipefd[0]); 514 --- 1640 unchanged lines hidden --- | 507 anynet_ntoa(&RealHostAddr)); 508 proc_list_add(pid, status); 509 (void) releasesignal(SIGCHLD); 510 511 /* close the read end of the synchronization pipe */ 512 if (pipefd[0] != -1) 513 (void) close(pipefd[0]); 514 --- 1640 unchanged lines hidden --- |