* Reverted support for multiple Unix domain sockets since it caused

syslogd to not accept more sockets after a certain (undefinitve)
    time.  (opens: Bug#24893)
  * The complete code is still present, search for `Bug#24893'
  * Commented out `-a' in the syslogd.8 manpage
This commit is contained in:
Joey Schulze 1998-10-15 17:35:38 +00:00
parent 7bc8d64bac
commit 3acc6c3a40
2 changed files with 64 additions and 16 deletions

View File

@ -7,9 +7,10 @@
sysklogd \- Linux system logging utilities. sysklogd \- Linux system logging utilities.
.SH SYNOPSIS .SH SYNOPSIS
.B syslogd .B syslogd
.RB [ " \-a " .\" Bug#24893 --> uncomment the following
.I socket .\" .RB [ " \-a "
] .\" .I socket
.\" ]
.RB [ " \-d " ] .RB [ " \-d " ]
.RB [ " \-f " .RB [ " \-f "
.I config file .I config file
@ -73,18 +74,19 @@ the whole line is ignored.
.LP .LP
.SH OPTIONS .SH OPTIONS
.TP .\" Bug#24893 --> uncomment the following
.BI "\-a " "socket" .\" .TP
Using this argument you can specify additional sockets from that .\" .BI "\-a " "socket"
.B syslogd .\" Using this argument you can specify additional sockets from that
has to listen to. This is needed if you're going to let some daemon .\" .B syslogd
run within a chroot() environment. You can use up to 19 additional .\" has to listen to. This is needed if you're going to let some daemon
sockets. If your environment needs even more, you have to increase .\" run within a chroot() environment. You can use up to 19 additional
the symbol .\" sockets. If your environment needs even more, you have to increase
.B MAXFUNIX .\" the symbol
within the syslogd.c source file. An example for a chroot() daemon is .\" .B MAXFUNIX
described by the people from OpenBSD at .\" within the syslogd.c source file. An example for a chroot() daemon is
http://www.psionic.com/papers/dns.html. .\" described by the people from OpenBSD at
.\" http://www.psionic.com/papers/dns.html.
.TP .TP
.B "\-d" .B "\-d"
Turns on debug mode. Using this the daemon will not proceed a Turns on debug mode. Using this the daemon will not proceed a

View File

@ -512,22 +512,27 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
#define _PATH_LOG "/dev/log" #define _PATH_LOG "/dev/log"
#endif #endif
/* Bug#24893: --> remove LogName */
char *LogName = _PATH_LOG;
char *ConfFile = _PATH_LOGCONF; char *ConfFile = _PATH_LOGCONF;
char *PidFile = _PATH_LOGPID; char *PidFile = _PATH_LOGPID;
char ctty[] = _PATH_CONSOLE; char ctty[] = _PATH_CONSOLE;
char **parts; char **parts;
int inetm = 0; /* Bug#24893 --> remove funix */
int inetm = 0, funix = -1;
static int debugging_on = 0; static int debugging_on = 0;
static int nlogs = -1; static int nlogs = -1;
static int restart = 0; static int restart = 0;
/* Bug#24893: --> insert
#define MAXFUNIX 20 #define MAXFUNIX 20
int nfunix = 1; int nfunix = 1;
char *funixn[MAXFUNIX] = { _PATH_LOG }; char *funixn[MAXFUNIX] = { _PATH_LOG };
int funix[MAXFUNIX] = { -1, }; int funix[MAXFUNIX] = { -1, };
*/
#ifdef UT_NAMESIZE #ifdef UT_NAMESIZE
# define UNAMESZ UT_NAMESIZE /* length of a login name */ # define UNAMESZ UT_NAMESIZE /* length of a login name */
@ -784,18 +789,22 @@ int main(argc, argv)
#ifndef TESTING #ifndef TESTING
chdir ("/"); chdir ("/");
#endif #endif
/* Bug#24893 --> add
for (i = 1; i < nfunix; i++) { for (i = 1; i < nfunix; i++) {
funixn[i] = ""; funixn[i] = "";
funix[i] = -1; funix[i] = -1;
} }
*/
while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:v")) != EOF) while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:v")) != EOF)
switch((char)ch) { switch((char)ch) {
case 'a': case 'a':
/* Bug#24893 --> add
if (nfunix < MAXFUNIX) if (nfunix < MAXFUNIX)
funixn[nfunix++] = optarg; funixn[nfunix++] = optarg;
else else
fprintf(stderr, "Out of descriptors, ignoring %s\n", optarg); fprintf(stderr, "Out of descriptors, ignoring %s\n", optarg);
*/
break; break;
case 'd': /* debug */ case 'd': /* debug */
Debug = 1; Debug = 1;
@ -821,7 +830,10 @@ int main(argc, argv)
NoFork = 1; NoFork = 1;
break; break;
case 'p': /* path to regular log socket */ case 'p': /* path to regular log socket */
/* Bug#24893 --> exchange
funixn[0] = optarg; funixn[0] = optarg;
*/
LogName = optarg;
break; break;
case 'r': /* accept remote messages */ case 'r': /* accept remote messages */
AcceptRemote = 1; AcceptRemote = 1;
@ -993,9 +1005,16 @@ int main(argc, argv)
* Add the Unix Domain Sockets to the list of read * Add the Unix Domain Sockets to the list of read
* descriptors. * descriptors.
*/ */
if (funix >= 0) {
FD_SET(funix, &readfds);
for (nfds= 0; nfds < FD_SETSIZE; ++nfds)
if ( FD_ISSET(nfds, &unixm) )
FD_SET(nfds, &readfds);
/* Bug#24893 --> remove above if(), add the following
for (i = 0; i < nfunix; i++) { for (i = 0; i < nfunix; i++) {
if (funix[i] != -1) if (funix[i] != -1)
FD_SET(funix[i], &readfds); FD_SET(funix[i], &readfds);
*/
} }
#endif #endif
#endif #endif
@ -1091,6 +1110,22 @@ int main(argc, argv)
} }
} }
/* Accept a new unix connection */ /* Accept a new unix connection */
if (FD_ISSET(funix, &readfds)) {
len = sizeof(fromunix);
if ((fd = accept(funix, (struct sockaddr *) &fromunix,\
&len)) >= 0) {
FD_SET(fd, &unixm);
dprintf("New UNIX connect assigned to fd: " \
"%d.\n", fd);
FD_SET(fd, &readfds);
}
else {
dprintf("Error accepting UNIX connection: " \
"%d = %s.\n", errno, strerror(errno));
}
}
/* Bug#24893 --> remove above if(), add the following
for (i = 0; i < nfunix; i++) for (i = 0; i < nfunix; i++)
if (funix[i] != -1 && FD_ISSET(funix[i], &readfds)) { if (funix[i] != -1 && FD_ISSET(funix[i], &readfds)) {
len = sizeof(fromunix); len = sizeof(fromunix);
@ -1105,6 +1140,7 @@ int main(argc, argv)
"%d = %s.\n", errno, strerror(errno)); "%d = %s.\n", errno, strerror(errno));
} }
} }
*/
#endif #endif
#ifdef SYSLOG_INET #ifdef SYSLOG_INET
@ -2123,16 +2159,22 @@ void die(sig)
} }
/* Close the UNIX sockets. */ /* Close the UNIX sockets. */
close(funix);
/* Bug#24893 --> remove above close(), add the following
for (i = 0; i < nfunix; i++) for (i = 0; i < nfunix; i++)
if (funix[i] != -1) if (funix[i] != -1)
close(funix[i]); close(funix[i]);
*/
/* Close the inet socket. */ /* Close the inet socket. */
if (InetInuse) close(inetm); if (InetInuse) close(inetm);
/* Clean-up files. */ /* Clean-up files. */
(void) unlink(LogName);
/* Bug#24893 --> remove above unlink(), add the following
for (i = 0; i < nfunix; i++) for (i = 0; i < nfunix; i++)
if (funixn[i] && funix[i] != -1) if (funixn[i] && funix[i] != -1)
(void)unlink(funixn[i]); (void)unlink(funixn[i]);
*/
#ifndef TESTING #ifndef TESTING
(void) remove_pid(PidFile); (void) remove_pid(PidFile);
#endif #endif
@ -2302,9 +2344,13 @@ void init()
(void) fclose(cf); (void) fclose(cf);
#ifdef SYSLOG_UNIXAF #ifdef SYSLOG_UNIXAF
if (funix < 0)
funix = create_unix_socket(LogName);
/* Bug#24893 --> remove above if(), add the following
for (i = 0; i < nfunix; i++) for (i = 0; i < nfunix; i++)
if ((funix[i] = create_unix_socket(funixn[i])) != -1) if ((funix[i] = create_unix_socket(funixn[i])) != -1)
dprintf("Opened UNIX socket `%s'.\n", funixn[i]); dprintf("Opened UNIX socket `%s'.\n", funixn[i]);
*/
#endif #endif
#ifdef SYSLOG_INET #ifdef SYSLOG_INET