svn commit: r320229 - in stable/10: etc etc/cron.d etc/mtree etc/newsyslog.conf.d etc/pam.d etc/syslog.d tools/build/mk usr.sbin/cron/cron usr.sbin/cron/lib usr.sbin/syslogd
Ngie Cooper
ngie at FreeBSD.org
Thu Jun 22 07:54:22 UTC 2017
Author: ngie
Date: Thu Jun 22 07:54:12 2017
New Revision: 320229
URL: https://svnweb.freebsd.org/changeset/base/320229
Log:
Revert r320222,r320223,r320224
The committed changes (reverted after this commit) break POLA on
a stable branch.
Requested by: jhb
Deleted:
stable/10/etc/cron.d/
stable/10/etc/newsyslog.conf.d/amd.conf
stable/10/etc/newsyslog.conf.d/ftp.conf
stable/10/etc/newsyslog.conf.d/lpr.conf
stable/10/etc/newsyslog.conf.d/pf.conf
stable/10/etc/newsyslog.conf.d/ppp.conf
stable/10/etc/newsyslog.conf.d/sendmail.conf
stable/10/etc/syslog.d/
Modified:
stable/10/etc/crontab
stable/10/etc/mtree/BSD.root.dist
stable/10/etc/newsyslog.conf
stable/10/etc/newsyslog.conf.d/Makefile
stable/10/etc/pam.d/Makefile
stable/10/etc/syslog.conf
stable/10/tools/build/mk/OptionalObsoleteFiles.inc
stable/10/usr.sbin/cron/cron/cron.8
stable/10/usr.sbin/cron/cron/cron.h
stable/10/usr.sbin/cron/cron/database.c
stable/10/usr.sbin/cron/cron/pathnames.h
stable/10/usr.sbin/cron/lib/misc.c
stable/10/usr.sbin/syslogd/syslog.conf.5
stable/10/usr.sbin/syslogd/syslogd.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/etc/crontab
==============================================================================
--- stable/10/etc/crontab Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/etc/crontab Thu Jun 22 07:54:12 2017 (r320229)
@@ -7,6 +7,8 @@ PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
#
#minute hour mday month wday who command
#
+*/5 * * * * root /usr/libexec/atrun
+#
# Save some entropy so that /dev/random can re-seed on boot.
*/11 * * * * operator /usr/libexec/save-entropy
#
Modified: stable/10/etc/mtree/BSD.root.dist
==============================================================================
--- stable/10/etc/mtree/BSD.root.dist Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/etc/mtree/BSD.root.dist Thu Jun 22 07:54:12 2017 (r320229)
@@ -30,8 +30,6 @@
..
bluetooth
..
- cron.d
- ..
defaults
..
devd
@@ -73,8 +71,6 @@
ssh
..
ssl
- ..
- syslog.d
..
zfs
..
Modified: stable/10/etc/newsyslog.conf
==============================================================================
--- stable/10/etc/newsyslog.conf Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/etc/newsyslog.conf Thu Jun 22 07:54:12 2017 (r320229)
@@ -18,6 +18,7 @@
#
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/var/log/all.log 600 7 * @T00 J
+/var/log/amd.log 644 7 100 * J
/var/log/auth.log 600 7 100 @0101T JC
/var/log/console.log 600 5 100 * J
/var/log/cron 600 3 100 * JC
@@ -25,13 +26,18 @@
/var/log/debug.log 600 7 100 * JC
/var/log/init.log 644 3 100 * J
/var/log/kerberos.log 600 7 100 * J
+/var/log/lpd-errs 644 7 100 * JC
/var/log/maillog 640 7 * @T00 JC
/var/log/messages 644 5 100 @0101T JC
/var/log/monthly.log 640 12 * $M1D0 JN
+/var/log/pflog 600 3 100 * JB /var/run/pflogd.pid
+/var/log/ppp.log root:network 640 3 100 * JC
/var/log/devd.log 644 3 100 * JC
/var/log/security 600 10 100 * JC
+/var/log/sendmail.st 640 10 * 168 BN
/var/log/utx.log 644 3 * @01T05 B
/var/log/weekly.log 640 5 * $W6D0 JN
+/var/log/xferlog 600 7 100 * JC
<include> /etc/newsyslog.conf.d/*
<include> /usr/local/etc/newsyslog.conf.d/*
Modified: stable/10/etc/newsyslog.conf.d/Makefile
==============================================================================
--- stable/10/etc/newsyslog.conf.d/Makefile Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/etc/newsyslog.conf.d/Makefile Thu Jun 22 07:54:12 2017 (r320229)
@@ -6,32 +6,8 @@ BINDIR= /etc/newsyslog.conf.d
FILES=
-.if ${MK_AMD} != "no"
-FILES+= amd.conf
-.endif
-
-.if ${MK_FTP} != "no"
-FILES+= ftp.conf
-.endif
-
-.if ${MK_LPR} != "no"
-FILES+= lpr.conf
-.endif
-
.if ${MK_OFED} != "no"
FILES+= opensm.conf
-.endif
-
-.if ${MK_PF} != "no"
-FILES+= pf.conf
-.endif
-
-.if ${MK_PPP} != "no"
-FILES+= ppp.conf
-.endif
-
-.if ${MK_SENDMAIL} != "no"
-FILES+= sendmail.conf
.endif
.include <bsd.prog.mk>
Modified: stable/10/etc/pam.d/Makefile
==============================================================================
--- stable/10/etc/pam.d/Makefile Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/etc/pam.d/Makefile Thu Jun 22 07:54:12 2017 (r320229)
@@ -1,52 +1,23 @@
# $FreeBSD$
-.include <bsd.own.mk>
-
NO_OBJ=
-FILESGROUPS= FILES
-
FILES= README \
+ atrun \
cron \
+ ftpd \
imap \
login \
other \
passwd pop3 \
+ rsh \
sshd su system \
+ telnetd \
xdm
FILESDIR= /etc/pam.d
FILESMODE= 644
-
-.if ${MK_AT} != "no"
-FILESGROUPS+= AT
-AT+= atrun
-ATDIR= ${FILESDIR}
-ATMODE= ${FILESMODE}
-.endif
-
-.if ${MK_FTP} != "no"
-FILESGROUPS+= FTP
-FTP+= ftpd
-FTPDIR= ${FILESDIR}
-FTPMODE= ${FILESMODE}
-LINKS= ${FILESDIR}/ftpd ${FILESDIR}/ftp
-.endif
-
-.if ${MK_RCMDS} != "no"
-FILESGROUPS+= RCMDS
-RCMDS+= rsh
-RCMDSDIR= ${FILESDIR}
-RCMDSMODE= ${FILESMODE}
-.endif
-
-.if ${MK_TELNET} != "no"
-FILESGROUPS+= TELNET
-TELNET+= telnetd
-TELNETDIR= ${FILESDIR}
-TELNETMODE= ${FILESMODE}
-.endif
-
FILESMODE_README= 444
+LINKS= ${FILESDIR}/ftpd ${FILESDIR}/ftp
.include <bsd.prog.mk>
Modified: stable/10/etc/syslog.conf
==============================================================================
--- stable/10/etc/syslog.conf Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/etc/syslog.conf Thu Jun 22 07:54:12 2017 (r320229)
@@ -10,6 +10,8 @@
security.* /var/log/security
auth.info;authpriv.info /var/log/auth.log
mail.info /var/log/maillog
+lpr.info /var/log/lpd-errs
+ftp.info /var/log/xferlog
cron.* /var/log/cron
!-devd
*.=debug /var/log/debug.log
@@ -29,6 +31,6 @@ cron.* /var/log/cron
# Uncomment this if you wish to see messages produced by devd
# !devd
# *.>=notice /var/log/devd.log
+!ppp
+*.* /var/log/ppp.log
!*
-include /etc/syslog.d
-include /usr/local/etc/syslog.d
Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- stable/10/tools/build/mk/OptionalObsoleteFiles.inc Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc Thu Jun 22 07:54:12 2017 (r320229)
@@ -56,7 +56,6 @@ OLD_FILES+=usr/share/man/man8/iasl.8.gz
.if ${MK_AMD} == no
OLD_FILES+=etc/amd.map
-OLD_FILES+=etc/newsyslog.conf.d/amd.conf
OLD_FILES+=etc/rc.d/amd
OLD_FILES+=usr/bin/pawd
OLD_FILES+=usr/sbin/amd
@@ -1064,11 +1063,7 @@ OLD_FILES+=usr/share/man/man8/fmtree.8.gz
.if ${MK_FTP} == no
OLD_FILES+=etc/ftpusers
-OLD_FILES+=etc/newsyslog.conf.d/ftp.conf
-OLD_FILES+=etc/pam.d/ftp
-OLD_FILES+=etc/pam.d/ftpd
OLD_FILES+=etc/rc.d/ftpd
-OLD_FILES+=etc/syslog.d/ftp.conf
OLD_FILES+=usr/bin/ftp
OLD_FILES+=usr/bin/gate-ftp
OLD_FILES+=usr/bin/pftp
@@ -3821,9 +3816,7 @@ OLD_FILES+=usr/share/man/man8/updatedb.8.gz
.if ${MK_LPR} == no
OLD_FILES+=etc/hosts.lpd
OLD_FILES+=etc/printcap
-OLD_FILES+=etc/newsyslog.conf.d/lpr.conf
OLD_FILES+=etc/rc.d/lpd
-OLD_FILES+=etc/syslog.d/lpr.conf
OLD_FILES+=usr/bin/lp
OLD_FILES+=usr/bin/lpq
OLD_FILES+=usr/bin/lpr
@@ -4199,7 +4192,6 @@ OLD_DIRS+=usr/share/examples/pc-sysinstall
.endif
.if ${MK_PF} == no
-OLD_FILES+=etc/newsyslog.conf.d/pf.conf
OLD_FILES+=etc/periodic/security/520.pfdenied
OLD_FILES+=etc/pf.os
OLD_FILES+=etc/rc.d/ftp-proxy
@@ -4268,9 +4260,7 @@ OLD_FILES+=usr/share/man/man8/portsnap.8.gz
.endif
.if ${MK_PPP} == no
-OLD_FILES+=etc/newsyslog.conf.d/ppp.conf
OLD_FILES+=etc/ppp/ppp.conf
-OLD_FILES+=etc/syslog.d/ppp.conf
OLD_DIRS+=etc/ppp
OLD_FILES+=usr/sbin/ppp
OLD_FILES+=usr/sbin/pppctl
@@ -4470,7 +4460,6 @@ OLD_FILES+=usr/share/man/man8/rtquery.8.gz
.endif
.if ${MK_SENDMAIL} == no
-OLD_FILES+=etc/newsyslog.conf.d/sendmail.conf
OLD_FILES+=etc/periodic/daily/150.clean-hoststat
OLD_FILES+=etc/periodic/daily/440.status-mailq
OLD_FILES+=etc/periodic/daily/460.status-mail-rejects
@@ -4789,7 +4778,6 @@ OLD_FILES+=usr/share/nls/uk_UA.UTF-8/tcsh.cat
.endif
.if ${MK_TELNET} == no
-OLD_FILES+=etc/pam.d/telnetd
OLD_FILES+=usr/bin/telnet
OLD_FILES+=usr/libexec/telnetd
OLD_FILES+=usr/share/man/man1/telnet.1.gz
Modified: stable/10/usr.sbin/cron/cron/cron.8
==============================================================================
--- stable/10/usr.sbin/cron/cron/cron.8 Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/usr.sbin/cron/cron/cron.8 Thu Jun 22 07:54:12 2017 (r320229)
@@ -17,7 +17,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 31, 2016
+.Dd June 29, 2008
.Dt CRON 8
.Os
.Sh NAME
@@ -52,11 +52,7 @@ The
.Nm
utility also searches for
.Pa /etc/crontab
-and files in
-.Pa /etc/cron.d
-and
-.Pa /usr/local/etc/cron.d
-which are in a different format (see
+which is in a different format (see
.Xr crontab 5 ) .
.Pp
The
Modified: stable/10/usr.sbin/cron/cron/cron.h
==============================================================================
--- stable/10/usr.sbin/cron/cron/cron.h Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/usr.sbin/cron/cron/cron.h Thu Jun 22 07:54:12 2017 (r320229)
@@ -218,7 +218,7 @@ void set_cron_uid(void),
unget_char(int, FILE *),
free_entry(entry *),
skip_comments(FILE *),
- log_it(char *, int, char *, const char *),
+ log_it(char *, int, char *, char *),
log_close(void);
int job_runqueue(void),
Modified: stable/10/usr.sbin/cron/cron/database.c
==============================================================================
--- stable/10/usr.sbin/cron/cron/database.c Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/usr.sbin/cron/cron/database.c Thu Jun 22 07:54:12 2017 (r320229)
@@ -44,19 +44,10 @@ load_database(old_db)
{
DIR *dir;
struct stat statbuf;
- struct stat syscron_stat, st;
- time_t maxmtime;
+ struct stat syscron_stat;
DIR_T *dp;
cron_db new_db;
user *u, *nu;
- struct {
- const char *name;
- struct stat st;
- } syscrontabs [] = {
- { SYSCRONTABS },
- { LOCALSYSCRONTABS }
- };
- int i;
Debug(DLOAD, ("[%d] load_database()\n", getpid()))
@@ -74,16 +65,6 @@ load_database(old_db)
if (stat(SYSCRONTAB, &syscron_stat) < OK)
syscron_stat.st_mtime = 0;
- maxmtime = TMAX(statbuf.st_mtime, syscron_stat.st_mtime);
-
- for (i = 0; i < nitems(syscrontabs); i++) {
- if (stat(syscrontabs[i].name, &syscrontabs[i].st) != -1) {
- maxmtime = TMAX(syscrontabs[i].st.st_mtime, maxmtime);
- } else {
- syscrontabs[i].st.st_mtime = 0;
- }
- }
-
/* if spooldir's mtime has not changed, we don't need to fiddle with
* the database.
*
@@ -91,7 +72,7 @@ load_database(old_db)
* so is guaranteed to be different than the stat() mtime the first
* time this function is called.
*/
- if (old_db->mtime == maxmtime) {
+ if (old_db->mtime == TMAX(statbuf.st_mtime, syscron_stat.st_mtime)) {
Debug(DLOAD, ("[%d] spool dir mtime unch, no load needed.\n",
getpid()))
return;
@@ -102,37 +83,13 @@ load_database(old_db)
* actually changed. Whatever is left in the old database when
* we're done is chaff -- crontabs that disappeared.
*/
- new_db.mtime = maxmtime;
+ new_db.mtime = TMAX(statbuf.st_mtime, syscron_stat.st_mtime);
new_db.head = new_db.tail = NULL;
if (syscron_stat.st_mtime) {
process_crontab("root", SYS_NAME,
SYSCRONTAB, &syscron_stat,
&new_db, old_db);
- }
-
- for (i = 0; i < nitems(syscrontabs); i++) {
- char tabname[MAXPATHLEN];
- if (syscrontabs[i].st.st_mtime == 0)
- continue;
- if (!(dir = opendir(syscrontabs[i].name))) {
- log_it("CRON", getpid(), "OPENDIR FAILED",
- syscrontabs[i].name);
- (void) exit(ERROR_EXIT);
- }
-
- while (NULL != (dp = readdir(dir))) {
- if (dp->d_name[0] == '.')
- continue;
- if (fstatat(dirfd(dir), dp->d_name, &st, 0) == 0 &&
- !S_ISREG(st.st_mode))
- continue;
- snprintf(tabname, sizeof(tabname), "%s/%s",
- syscrontabs[i].name, dp->d_name);
- process_crontab("root", SYS_NAME, tabname,
- &syscrontabs[i].st, &new_db, old_db);
- }
- closedir(dir);
}
/* we used to keep this dir open all the time, for the sake of
Modified: stable/10/usr.sbin/cron/cron/pathnames.h
==============================================================================
--- stable/10/usr.sbin/cron/cron/pathnames.h Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/usr.sbin/cron/cron/pathnames.h Thu Jun 22 07:54:12 2017 (r320229)
@@ -62,8 +62,6 @@
/* 4.3BSD-style crontab */
#define SYSCRONTAB "/etc/crontab"
-#define SYSCRONTABS "/etc/cron.d"
-#define LOCALSYSCRONTABS "/usr/local/etc/cron.d"
/* what editor to use if no EDITOR or VISUAL
* environment variable specified.
Modified: stable/10/usr.sbin/cron/lib/misc.c
==============================================================================
--- stable/10/usr.sbin/cron/lib/misc.c Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/usr.sbin/cron/lib/misc.c Thu Jun 22 07:54:12 2017 (r320229)
@@ -385,7 +385,11 @@ out: if (allow)
void
-log_it(char *username, int xpid, char *event, const char *detail)
+log_it(username, xpid, event, detail)
+ char *username;
+ int xpid;
+ char *event;
+ char *detail;
{
#if defined(LOG_FILE) || DEBUGGING
PID_T pid = xpid;
Modified: stable/10/usr.sbin/syslogd/syslog.conf.5
==============================================================================
--- stable/10/usr.sbin/syslogd/syslog.conf.5 Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/usr.sbin/syslogd/syslog.conf.5 Thu Jun 22 07:54:12 2017 (r320229)
@@ -28,7 +28,7 @@
.\" @(#)syslog.conf.5 8.1 (Berkeley) 6/9/93
.\" $FreeBSD$
.\"
-.Dd November 1, 2016
+.Dd September 12, 2012
.Dt SYSLOG.CONF 5
.Os
.Sh NAME
@@ -61,12 +61,6 @@ The
field is separated from the
.Em action
field by one or more tab characters or spaces.
-.Pp
-A special
-.Em include
-keyword can be used to include all files with names ending in '.conf' and not
-beginning with a '.' contained in the directory following the keyword.
-This keyword can only be used in the first level configuration file.
.Pp
Note that if you use spaces as separators, your
.Nm
Modified: stable/10/usr.sbin/syslogd/syslogd.c
==============================================================================
--- stable/10/usr.sbin/syslogd/syslogd.c Thu Jun 22 07:42:36 2017 (r320228)
+++ stable/10/usr.sbin/syslogd/syslogd.c Thu Jun 22 07:54:12 2017 (r320229)
@@ -97,7 +97,6 @@ __FBSDID("$FreeBSD$");
#include <arpa/inet.h>
#include <ctype.h>
-#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -121,8 +120,6 @@ __FBSDID("$FreeBSD$");
const char *ConfFile = _PATH_LOGCONF;
const char *PidFile = _PATH_LOGPID;
const char ctty[] = _PATH_CONSOLE;
-static const char include_str[] = "include";
-static const char include_ext[] = ".conf";
#define dprintf if (Debug) printf
@@ -1551,46 +1548,96 @@ die(int signo)
exit(1);
}
-static int
-configfiles(const struct dirent *dp)
+/*
+ * INIT -- Initialize syslogd from configuration table
+ */
+static void
+init(int signo)
{
- const char *p;
- size_t ext_len;
+ int i;
+ FILE *cf;
+ struct filed *f, *next, **nextp;
+ char *p;
+ char cline[LINE_MAX];
+ char prog[LINE_MAX];
+ char host[MAXHOSTNAMELEN];
+ char oldLocalHostName[MAXHOSTNAMELEN];
+ char hostMsg[2*MAXHOSTNAMELEN+40];
+ char bootfileMsg[LINE_MAX];
- if (dp->d_name[0] == '.')
- return (0);
+ dprintf("init\n");
- ext_len = sizeof(include_ext) -1;
+ /*
+ * Load hostname (may have changed).
+ */
+ if (signo != 0)
+ (void)strlcpy(oldLocalHostName, LocalHostName,
+ sizeof(oldLocalHostName));
+ if (gethostname(LocalHostName, sizeof(LocalHostName)))
+ err(EX_OSERR, "gethostname() failed");
+ if ((p = strchr(LocalHostName, '.')) != NULL) {
+ *p++ = '\0';
+ LocalDomain = p;
+ } else {
+ LocalDomain = "";
+ }
- if (dp->d_namlen <= ext_len)
- return (0);
+ /*
+ * Close all open log files.
+ */
+ Initialized = 0;
+ for (f = Files; f != NULL; f = next) {
+ /* flush any pending output */
+ if (f->f_prevcount)
+ fprintlog(f, 0, (char *)NULL);
- p = &dp->d_name[dp->d_namlen - ext_len];
- if (strcmp(p, include_ext) != 0)
- return (0);
+ switch (f->f_type) {
+ case F_FILE:
+ case F_FORW:
+ case F_CONSOLE:
+ case F_TTY:
+ close_filed(f);
+ break;
+ case F_PIPE:
+ if (f->f_un.f_pipe.f_pid > 0) {
+ close_filed(f);
+ deadq_enter(f->f_un.f_pipe.f_pid,
+ f->f_un.f_pipe.f_pname);
+ }
+ f->f_un.f_pipe.f_pid = 0;
+ break;
+ }
+ next = f->f_next;
+ if (f->f_program) free(f->f_program);
+ if (f->f_host) free(f->f_host);
+ free((char *)f);
+ }
+ Files = NULL;
+ nextp = &Files;
- return (1);
-}
+ /* open the configuration file */
+ if ((cf = fopen(ConfFile, "r")) == NULL) {
+ dprintf("cannot open %s\n", ConfFile);
+ *nextp = (struct filed *)calloc(1, sizeof(*f));
+ if (*nextp == NULL) {
+ logerror("calloc");
+ exit(1);
+ }
+ cfline("*.ERR\t/dev/console", *nextp, "*", "*");
+ (*nextp)->f_next = (struct filed *)calloc(1, sizeof(*f));
+ if ((*nextp)->f_next == NULL) {
+ logerror("calloc");
+ exit(1);
+ }
+ cfline("*.PANIC\t*", (*nextp)->f_next, "*", "*");
+ Initialized = 1;
+ return;
+ }
-static void
-readconfigfile(FILE *cf, struct filed **nextp, int allow_includes)
-{
- FILE *cf2;
- struct filed *f;
- struct dirent **ent;
- char cline[LINE_MAX];
- char host[MAXHOSTNAMELEN];
- char prog[LINE_MAX];
- char file[MAXPATHLEN];
- char *p, *tmp;
- int i, nents;
- size_t include_len;
-
/*
* Foreach line in the conf table, open that file.
*/
f = NULL;
- include_len = sizeof(include_str) -1;
(void)strlcpy(host, "*", sizeof(host));
(void)strlcpy(prog, "*", sizeof(prog));
while (fgets(cline, sizeof(cline), cf) != NULL) {
@@ -1603,42 +1650,6 @@ readconfigfile(FILE *cf, struct filed **nextp, int all
continue;
if (*p == 0)
continue;
- if (allow_includes &&
- strncmp(p, include_str, include_len) == 0 &&
- isspace(p[include_len])) {
- p += include_len;
- while (isspace(*p))
- p++;
- tmp = p;
- while (*tmp != '\0' && !isspace(*tmp))
- tmp++;
- *tmp = '\0';
- dprintf("Trying to include files in '%s'\n", p);
- nents = scandir(p, &ent, configfiles, alphasort);
- if (nents == -1) {
- dprintf("Unable to open '%s': %s\n", p,
- strerror(errno));
- continue;
- }
- for (i = 0; i < nents; i++) {
- if (snprintf(file, sizeof(file), "%s/%s", p,
- ent[i]->d_name) >= (int)sizeof(file)) {
- dprintf("ignoring path too long: "
- "'%s/%s'\n", p, ent[i]->d_name);
- free(ent[i]);
- continue;
- }
- free(ent[i]);
- cf2 = fopen(file, "r");
- if (cf2 == NULL)
- continue;
- dprintf("reading %s\n", file);
- readconfigfile(cf2, nextp, 0);
- fclose(cf2);
- }
- free(ent);
- continue;
- }
if (*p == '#') {
p++;
if (*p != '!' && *p != '+' && *p != '-')
@@ -1700,92 +1711,6 @@ readconfigfile(FILE *cf, struct filed **nextp, int all
nextp = &f->f_next;
cfline(cline, f, prog, host);
}
-}
-
-/*
- * INIT -- Initialize syslogd from configuration table
- */
-static void
-init(int signo)
-{
- int i;
- FILE *cf;
- struct filed *f, *next, **nextp;
- char *p;
- char oldLocalHostName[MAXHOSTNAMELEN];
- char hostMsg[2*MAXHOSTNAMELEN+40];
- char bootfileMsg[LINE_MAX];
-
- dprintf("init\n");
-
- /*
- * Load hostname (may have changed).
- */
- if (signo != 0)
- (void)strlcpy(oldLocalHostName, LocalHostName,
- sizeof(oldLocalHostName));
- if (gethostname(LocalHostName, sizeof(LocalHostName)))
- err(EX_OSERR, "gethostname() failed");
- if ((p = strchr(LocalHostName, '.')) != NULL) {
- *p++ = '\0';
- LocalDomain = p;
- } else {
- LocalDomain = "";
- }
-
- /*
- * Close all open log files.
- */
- Initialized = 0;
- for (f = Files; f != NULL; f = next) {
- /* flush any pending output */
- if (f->f_prevcount)
- fprintlog(f, 0, (char *)NULL);
-
- switch (f->f_type) {
- case F_FILE:
- case F_FORW:
- case F_CONSOLE:
- case F_TTY:
- close_filed(f);
- break;
- case F_PIPE:
- if (f->f_un.f_pipe.f_pid > 0) {
- close_filed(f);
- deadq_enter(f->f_un.f_pipe.f_pid,
- f->f_un.f_pipe.f_pname);
- }
- f->f_un.f_pipe.f_pid = 0;
- break;
- }
- next = f->f_next;
- if (f->f_program) free(f->f_program);
- if (f->f_host) free(f->f_host);
- free((char *)f);
- }
- Files = NULL;
- nextp = &Files;
-
- /* open the configuration file */
- if ((cf = fopen(ConfFile, "r")) == NULL) {
- dprintf("cannot open %s\n", ConfFile);
- *nextp = (struct filed *)calloc(1, sizeof(*f));
- if (*nextp == NULL) {
- logerror("calloc");
- exit(1);
- }
- cfline("*.ERR\t/dev/console", *nextp, "*", "*");
- (*nextp)->f_next = (struct filed *)calloc(1, sizeof(*f));
- if ((*nextp)->f_next == NULL) {
- logerror("calloc");
- exit(1);
- }
- cfline("*.PANIC\t*", (*nextp)->f_next, "*", "*");
- Initialized = 1;
- return;
- }
-
- readconfigfile(cf, &Files, 1);
/* close the configuration file */
(void)fclose(cf);
More information about the svn-src-stable
mailing list