Index: syslogd.8 =================================================================== RCS file: /usr/repo/src/usr.sbin/syslogd/syslogd.8,v retrieving revision 1.60 diff -u -p -r1.60 syslogd.8 --- syslogd.8 13 Apr 2005 03:19:41 -0000 1.60 +++ syslogd.8 6 Mar 2006 10:28:21 -0000 @@ -36,7 +36,7 @@ .Nd log systems messages .Sh SYNOPSIS .Nm -.Op Fl 46Acdknosuv +.Op Fl 46ACcdknosuv .Op Fl a Ar allowed_peer .Op Fl b Ar bind_address .Op Fl f Ar config_file @@ -157,6 +157,9 @@ option is also specified. Specify one specific IP address or hostname to bind to. If a hostname is specified, the IPv4 or IPv6 address which corresponds to it is used. +.It Fl C +Create log files that do not exist (permission is set to +.Li 0600 ) . .It Fl c Disable the compression of repeated instances of the same line into a single line of the form @@ -283,7 +286,9 @@ include file .Pp For security reasons, .Nm -will not append to log files that do not exist; +will not append to log files that do not exist (unless +.Fl C +option is specified); therefore, they must be created manually before running .Nm . .Sh FILES Index: syslogd.c =================================================================== RCS file: /usr/repo/src/usr.sbin/syslogd/syslogd.c,v retrieving revision 1.148 diff -u -p -r1.148 syslogd.c --- syslogd.c 17 Oct 2005 16:51:06 -0000 1.148 +++ syslogd.c 6 Mar 2006 10:23:46 -0000 @@ -286,6 +286,7 @@ static int family = PF_INET; /* protocol static int send_to_all; /* send message to all IPv4/IPv6 addresses */ static int use_bootfile; /* log entire bootfile for every kern msg */ static int no_compress; /* don't compress messages (1=pipes, 2=all) */ +static int logflags = O_WRONLY|O_APPEND; /* flags used to open log files */ static char bootfile[MAXLINE+1]; /* booted kernel file */ @@ -350,7 +351,7 @@ main(int argc, char *argv[]) socklen_t len; bindhostname = NULL; - while ((ch = getopt(argc, argv, "46Aa:b:cdf:kl:m:nop:P:sS:uv")) != -1) + while ((ch = getopt(argc, argv, "46Aa:b:cCdf:kl:m:nop:P:sS:uv")) != -1) switch (ch) { case '4': family = PF_INET; @@ -373,6 +374,9 @@ main(int argc, char *argv[]) case 'c': no_compress++; break; + case 'C': + logflags |= O_CREAT; + break; case 'd': /* debug */ Debug++; break; @@ -689,7 +693,7 @@ usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: syslogd [-46Acdknosuv] [-a allowed_peer]", + "usage: syslogd [-46ACcdknosuv] [-a allowed_peer]", " [-b bind address] [-f config_file]", " [-l log_socket] [-m mark_interval]", " [-P pid_file] [-p log_socket]"); @@ -1886,7 +1890,7 @@ cfline(const char *line, struct filed *f break; case '/': - if ((f->f_file = open(p, O_WRONLY|O_APPEND, 0)) < 0) { + if ((f->f_file = open(p, logflags, 0600)) < 0) { f->f_type = F_UNUSED; logerror(p); break;