* 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.
.SH SYNOPSIS
.B syslogd
.RB [ " \-a "
.I socket
]
.\" Bug#24893 --> uncomment the following
.\" .RB [ " \-a "
.\" .I socket
.\" ]
.RB [ " \-d " ]
.RB [ " \-f "
.I config file
@ -73,18 +74,19 @@ the whole line is ignored.
.LP
.SH OPTIONS
.TP
.BI "\-a " "socket"
Using this argument you can specify additional sockets from that
.B syslogd
has to listen to. This is needed if you're going to let some daemon
run within a chroot() environment. You can use up to 19 additional
sockets. If your environment needs even more, you have to increase
the symbol
.B MAXFUNIX
within the syslogd.c source file. An example for a chroot() daemon is
described by the people from OpenBSD at
http://www.psionic.com/papers/dns.html.
.\" Bug#24893 --> uncomment the following
.\" .TP
.\" .BI "\-a " "socket"
.\" Using this argument you can specify additional sockets from that
.\" .B syslogd
.\" has to listen to. This is needed if you're going to let some daemon
.\" run within a chroot() environment. You can use up to 19 additional
.\" sockets. If your environment needs even more, you have to increase
.\" the symbol
.\" .B MAXFUNIX
.\" within the syslogd.c source file. An example for a chroot() daemon is
.\" described by the people from OpenBSD at
.\" http://www.psionic.com/papers/dns.html.
.TP
.B "\-d"
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"
#endif
/* Bug#24893: --> remove LogName */
char *LogName = _PATH_LOG;
char *ConfFile = _PATH_LOGCONF;
char *PidFile = _PATH_LOGPID;
char ctty[] = _PATH_CONSOLE;
char **parts;
int inetm = 0;
/* Bug#24893 --> remove funix */
int inetm = 0, funix = -1;
static int debugging_on = 0;
static int nlogs = -1;
static int restart = 0;
/* Bug#24893: --> insert
#define MAXFUNIX 20
int nfunix = 1;
char *funixn[MAXFUNIX] = { _PATH_LOG };
int funix[MAXFUNIX] = { -1, };
*/
#ifdef UT_NAMESIZE
# define UNAMESZ UT_NAMESIZE /* length of a login name */
@ -784,18 +789,22 @@ int main(argc, argv)
#ifndef TESTING
chdir ("/");
#endif
/* Bug#24893 --> add
for (i = 1; i < nfunix; i++) {
funixn[i] = "";
funix[i] = -1;
}
*/
while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:v")) != EOF)
switch((char)ch) {
case 'a':
/* Bug#24893 --> add
if (nfunix < MAXFUNIX)
funixn[nfunix++] = optarg;
else
fprintf(stderr, "Out of descriptors, ignoring %s\n", optarg);
*/
break;
case 'd': /* debug */
Debug = 1;
@ -821,7 +830,10 @@ int main(argc, argv)
NoFork = 1;
break;
case 'p': /* path to regular log socket */
/* Bug#24893 --> exchange
funixn[0] = optarg;
*/
LogName = optarg;
break;
case 'r': /* accept remote messages */
AcceptRemote = 1;
@ -993,9 +1005,16 @@ int main(argc, argv)
* Add the Unix Domain Sockets to the list of read
* 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++) {
if (funix[i] != -1)
FD_SET(funix[i], &readfds);
*/
}
#endif
#endif
@ -1091,6 +1110,22 @@ int main(argc, argv)
}
}
/* 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++)
if (funix[i] != -1 && FD_ISSET(funix[i], &readfds)) {
len = sizeof(fromunix);
@ -1105,6 +1140,7 @@ int main(argc, argv)
"%d = %s.\n", errno, strerror(errno));
}
}
*/
#endif
#ifdef SYSLOG_INET
@ -2123,16 +2159,22 @@ void die(sig)
}
/* Close the UNIX sockets. */
close(funix);
/* Bug#24893 --> remove above close(), add the following
for (i = 0; i < nfunix; i++)
if (funix[i] != -1)
close(funix[i]);
*/
/* Close the inet socket. */
if (InetInuse) close(inetm);
/* Clean-up files. */
(void) unlink(LogName);
/* Bug#24893 --> remove above unlink(), add the following
for (i = 0; i < nfunix; i++)
if (funixn[i] && funix[i] != -1)
(void)unlink(funixn[i]);
*/
#ifndef TESTING
(void) remove_pid(PidFile);
#endif
@ -2302,9 +2344,13 @@ void init()
(void) fclose(cf);
#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++)
if ((funix[i] = create_unix_socket(funixn[i])) != -1)
dprintf("Opened UNIX socket `%s'.\n", funixn[i]);
*/
#endif
#ifdef SYSLOG_INET