inetd.c (48958) | inetd.c (48962) |
---|---|
1/* 2 * Copyright (c) 1983, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)from: inetd.c 8.4 (Berkeley) 4/13/94"; 43#endif 44static const char rcsid[] = | 1/* 2 * Copyright (c) 1983, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)from: inetd.c 8.4 (Berkeley) 4/13/94"; 43#endif 44static const char rcsid[] = |
45 "$Id: inetd.c,v 1.61 1999/07/15 17:01:43 green Exp $"; | 45 "$Id: inetd.c,v 1.62 1999/07/21 12:19:24 sheldonh Exp $"; |
46#endif /* not lint */ 47 48/* 49 * Inetd - Internet super-server 50 * 51 * This program invokes all internet services as needed. Connection-oriented 52 * services are invoked each time a connection is made, by creating a process. 53 * This process is passed the connection as file descriptor 0 and is expected --- 292 unchanged lines hidden (view full) --- 346int 347main(argc, argv, envp) 348 int argc; 349 char *argv[], *envp[]; 350{ 351 struct servtab *sep; 352 struct passwd *pwd; 353 struct group *grp; | 46#endif /* not lint */ 47 48/* 49 * Inetd - Internet super-server 50 * 51 * This program invokes all internet services as needed. Connection-oriented 52 * services are invoked each time a connection is made, by creating a process. 53 * This process is passed the connection as file descriptor 0 and is expected --- 292 unchanged lines hidden (view full) --- 346int 347main(argc, argv, envp) 348 int argc; 349 char *argv[], *envp[]; 350{ 351 struct servtab *sep; 352 struct passwd *pwd; 353 struct group *grp; |
354 struct sigaction sa, sapipe; | 354 struct sigaction sa, saalrm, sachld, sahup, sapipe; |
355 int tmpint, ch, dofork; 356 pid_t pid; 357 char buf[50]; 358#ifdef LOGIN_CAP 359 login_cap_t *lc = NULL; 360#endif 361 struct request_info req; 362 int denied; --- 89 unchanged lines hidden (view full) --- 452 } 453 } 454 sa.sa_flags = 0; 455 sigemptyset(&sa.sa_mask); 456 sigaddset(&sa.sa_mask, SIGALRM); 457 sigaddset(&sa.sa_mask, SIGCHLD); 458 sigaddset(&sa.sa_mask, SIGHUP); 459 sa.sa_handler = flag_retry; | 355 int tmpint, ch, dofork; 356 pid_t pid; 357 char buf[50]; 358#ifdef LOGIN_CAP 359 login_cap_t *lc = NULL; 360#endif 361 struct request_info req; 362 int denied; --- 89 unchanged lines hidden (view full) --- 452 } 453 } 454 sa.sa_flags = 0; 455 sigemptyset(&sa.sa_mask); 456 sigaddset(&sa.sa_mask, SIGALRM); 457 sigaddset(&sa.sa_mask, SIGCHLD); 458 sigaddset(&sa.sa_mask, SIGHUP); 459 sa.sa_handler = flag_retry; |
460 sigaction(SIGALRM, &sa, (struct sigaction *)0); | 460 sigaction(SIGALRM, &sa, &saalrm); |
461 config(); 462 sa.sa_handler = flag_config; | 461 config(); 462 sa.sa_handler = flag_config; |
463 sigaction(SIGHUP, &sa, (struct sigaction *)0); | 463 sigaction(SIGHUP, &sa, &sahup); |
464 sa.sa_handler = flag_reapchild; | 464 sa.sa_handler = flag_reapchild; |
465 sigaction(SIGCHLD, &sa, (struct sigaction *)0); | 465 sigaction(SIGCHLD, &sa, &sachld); |
466 sa.sa_handler = SIG_IGN; 467 sigaction(SIGPIPE, &sa, &sapipe); 468 469 { 470 /* space for daemons to overwrite environment for ps */ 471#define DUMMYSIZE 100 472 char dummy[DUMMYSIZE]; 473 --- 145 unchanged lines hidden (view full) --- 619 sigsetmask(0L); 620 if (pid == 0) { 621 if (dofork) { 622 if (debug) 623 warnx("+ closing from %d", maxsock); 624 for (tmpint = maxsock; tmpint > 2; tmpint--) 625 if (tmpint != ctrl) 626 (void) close(tmpint); | 466 sa.sa_handler = SIG_IGN; 467 sigaction(SIGPIPE, &sa, &sapipe); 468 469 { 470 /* space for daemons to overwrite environment for ps */ 471#define DUMMYSIZE 100 472 char dummy[DUMMYSIZE]; 473 --- 145 unchanged lines hidden (view full) --- 619 sigsetmask(0L); 620 if (pid == 0) { 621 if (dofork) { 622 if (debug) 623 warnx("+ closing from %d", maxsock); 624 for (tmpint = maxsock; tmpint > 2; tmpint--) 625 if (tmpint != ctrl) 626 (void) close(tmpint); |
627 sigaction(SIGALRM, &saalrm, (struct sigaction *)0); 628 sigaction(SIGCHLD, &sachld, (struct sigaction *)0); 629 sigaction(SIGHUP, &sahup, (struct sigaction *)0); 630 /* SIGPIPE reset before exec */ |
|
627 } 628 /* 629 * Call tcpmux to find the real service to exec. 630 */ 631 if (sep->se_bi && 632 sep->se_bi->bi_fn == (void (*)()) tcpmux) { 633 sep = tcpmux(ctrl); 634 if (sep == NULL) { --- 1596 unchanged lines hidden --- | 631 } 632 /* 633 * Call tcpmux to find the real service to exec. 634 */ 635 if (sep->se_bi && 636 sep->se_bi->bi_fn == (void (*)()) tcpmux) { 637 sep = tcpmux(ctrl); 638 if (sep == NULL) { --- 1596 unchanged lines hidden --- |