summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/syslogd/privsep.c18
-rw-r--r--usr.sbin/syslogd/privsep_fdpass.c12
-rw-r--r--usr.sbin/syslogd/syslogd.c23
-rw-r--r--usr.sbin/syslogd/ttymsg.c6
4 files changed, 28 insertions, 31 deletions
diff --git a/usr.sbin/syslogd/privsep.c b/usr.sbin/syslogd/privsep.c
index 64e912655fe..527c055dde9 100644
--- a/usr.sbin/syslogd/privsep.c
+++ b/usr.sbin/syslogd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.19 2004/07/03 05:32:18 djm Exp $ */
+/* $OpenBSD: privsep.c,v 1.20 2004/07/03 23:40:44 djm Exp $ */
/*
* Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org>
@@ -379,13 +379,13 @@ bad_path:
* and rewrite to /dev/null if it's a bad path.
*/
static void
-check_log_name(char *log, size_t loglen)
+check_log_name(char *lognam, size_t loglen)
{
struct logname *lg;
char *p;
/* Any path containing '..' is invalid. */
- for (p = log; *p && (p - log) < loglen; p++)
+ for (p = lognam; *p && (p - lognam) < loglen; p++)
if (*p == '.' && *(p + 1) == '.')
goto bad_path;
@@ -394,12 +394,12 @@ check_log_name(char *log, size_t loglen)
lg = malloc(sizeof(struct logname));
if (!lg)
err(1, "check_log_name() malloc");
- strlcpy(lg->path, log, MAXPATHLEN);
+ strlcpy(lg->path, lognam, MAXPATHLEN);
TAILQ_INSERT_TAIL(&lognames, lg, next);
break;
case STATE_RUNNING:
TAILQ_FOREACH(lg, &lognames, next)
- if (!strcmp(lg->path, log))
+ if (!strcmp(lg->path, lognam))
return;
goto bad_path;
break;
@@ -412,8 +412,8 @@ check_log_name(char *log, size_t loglen)
bad_path:
warnx("%s: invalid attempt to open %s: rewriting to /dev/null",
- __func__, log);
- strlcpy(log, "/dev/null", loglen);
+ __func__, lognam);
+ strlcpy(lognam, "/dev/null", loglen);
}
/* Crank our state into less permissive modes */
@@ -452,7 +452,7 @@ priv_open_tty(const char *tty)
/* Open log-file */
int
-priv_open_log(const char *log)
+priv_open_log(const char *lognam)
{
char path[MAXPATHLEN];
int cmd, fd;
@@ -461,7 +461,7 @@ priv_open_log(const char *log)
if (priv_fd < 0)
errx(1, "%s: called from privileged child", __func__);
- if (strlcpy(path, log, sizeof path) >= sizeof(path))
+ if (strlcpy(path, lognam, sizeof path) >= sizeof(path))
return -1;
path_len = strlen(path) + 1;
diff --git a/usr.sbin/syslogd/privsep_fdpass.c b/usr.sbin/syslogd/privsep_fdpass.c
index d0fd6d1b5e1..6638055c37c 100644
--- a/usr.sbin/syslogd/privsep_fdpass.c
+++ b/usr.sbin/syslogd/privsep_fdpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep_fdpass.c,v 1.1 2003/07/31 18:20:07 avsm Exp $ */
+/* $OpenBSD: privsep_fdpass.c,v 1.2 2004/07/03 23:40:44 djm Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
@@ -47,7 +47,7 @@
#include "syslogd.h"
void
-send_fd(int socket, int fd)
+send_fd(int sock, int fd)
{
struct msghdr msg;
char tmp[CMSG_SPACE(sizeof(int))];
@@ -75,15 +75,15 @@ send_fd(int socket, int fd)
msg.msg_iov = &vec;
msg.msg_iovlen = 1;
- if ((n = sendmsg(socket, &msg, 0)) == -1)
- warn("%s: sendmsg(%d)", __func__, socket);
+ if ((n = sendmsg(sock, &msg, 0)) == -1)
+ warn("%s: sendmsg(%d)", __func__, sock);
if (n != sizeof(int))
warnx("%s: sendmsg: expected sent 1 got %ld",
__func__, (long)n);
}
int
-receive_fd(int socket)
+receive_fd(int sock)
{
struct msghdr msg;
char tmp[CMSG_SPACE(sizeof(int))];
@@ -101,7 +101,7 @@ receive_fd(int socket)
msg.msg_control = tmp;
msg.msg_controllen = sizeof(tmp);
- if ((n = recvmsg(socket, &msg, 0)) == -1)
+ if ((n = recvmsg(sock, &msg, 0)) == -1)
warn("%s: recvmsg", __func__);
if (n != sizeof(int))
warnx("%s: recvmsg: expected received 1 got %ld",
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index d59364e5cc9..35429b2aa5b 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.81 2004/07/03 05:32:18 djm Exp $ */
+/* $OpenBSD: syslogd.c,v 1.82 2004/07/03 23:40:44 djm Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-static const char rcsid[] = "$OpenBSD: syslogd.c,v 1.81 2004/07/03 05:32:18 djm Exp $";
+static const char rcsid[] = "$OpenBSD: syslogd.c,v 1.82 2004/07/03 23:40:44 djm Exp $";
#endif
#endif /* not lint */
@@ -157,7 +157,7 @@ struct filed {
int f_prevpri; /* pri of f_prevline */
int f_prevlen; /* length of f_prevline */
int f_prevcount; /* repetition cnt of prevline */
- int f_repeatcount; /* number of "repeated" msgs */
+ unsigned int f_repeatcount; /* number of "repeated" msgs */
int f_quick; /* abort when matched */
};
@@ -282,7 +282,7 @@ main(int argc, char *argv[])
{
int ch, i, linesize, fd;
struct sockaddr_un fromunix;
- struct sockaddr_in sin, frominet;
+ struct sockaddr_in s_in, frominet;
socklen_t len;
char *p, *line;
char resolve[MAXHOSTNAMELEN];
@@ -364,11 +364,11 @@ main(int argc, char *argv[])
logerror("syslog/udp: unknown service");
die(0);
}
- memset(&sin, 0, sizeof(sin));
- sin.sin_len = sizeof(sin);
- sin.sin_family = AF_INET;
- sin.sin_port = LogPort = sp->s_port;
- if (bind(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+ memset(&s_in, 0, sizeof(s_in));
+ s_in.sin_len = sizeof(s_in);
+ s_in.sin_family = AF_INET;
+ s_in.sin_port = LogPort = sp->s_port;
+ if (bind(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) {
logerror("bind");
if (!Debug)
die(0);
@@ -1247,9 +1247,7 @@ cfline(char *line, struct filed *f, char *prog)
int i, pri, addr_len;
size_t rb_len;
char *bp, *p, *q, *cp;
- const char *errstr;
char buf[MAXLINE], ebuf[100];
- char addr[MAXHOSTNAMELEN];
struct filed *xf;
dprintf("cfline(\"%s\", f, \"%s\")\n", line, prog);
@@ -1296,7 +1294,6 @@ cfline(char *line, struct filed *f, char *prog)
pri = LOG_PRIMASK + 1;
else {
/* ignore trailing spaces */
- int i;
for (i=strlen(buf)-1; i >= 0 && buf[i] == ' '; i--) {
buf[i]='\0';
}
@@ -1774,7 +1771,7 @@ ctlconn_read_handler(void)
reply_hdr->flags = htonl(flags);
ctl_reply_size = reply_text_size + CTL_HDR_LEN;
- dprintf("ctlcmd reply length %d\n", ctl_reply_size);
+ dprintf("ctlcmd reply length %lu\n", (u_long)ctl_reply_size);
/* Otherwise, set up to write out reply */
ctl_state = CTL_WRITING_REPLY;
diff --git a/usr.sbin/syslogd/ttymsg.c b/usr.sbin/syslogd/ttymsg.c
index d1e17a08729..b88a3924b8b 100644
--- a/usr.sbin/syslogd/ttymsg.c
+++ b/usr.sbin/syslogd/ttymsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttymsg.c,v 1.2 2003/08/27 00:27:50 avsm Exp $ */
+/* $OpenBSD: ttymsg.c,v 1.3 2004/07/03 23:40:44 djm Exp $ */
/* $NetBSD: ttymsg.c,v 1.3 1994/11/17 07:17:55 jtc Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static const char sccsid[] = "@(#)ttymsg.c 8.2 (Berkeley) 11/16/93";
#endif
-static const char rcsid[] = "$OpenBSD: ttymsg.c,v 1.2 2003/08/27 00:27:50 avsm Exp $";
+static const char rcsid[] = "$OpenBSD: ttymsg.c,v 1.3 2004/07/03 23:40:44 djm Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -120,7 +120,7 @@ ttymsg(struct iovec *iov, int iovcnt, char *line, int tmout)
--iovcnt;
}
if (wret) {
- iov->iov_base += wret;
+ iov->iov_base = (char *)iov->iov_base + wret;
iov->iov_len -= wret;
}
continue;