diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2008-05-07 12:19:21 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2008-05-07 12:19:21 +0000 |
commit | e1fc87c003c10d05e80ad1c139ab591e6ec003a4 (patch) | |
tree | 681364a876ff6c24d7dfaf815a57f4d1d1b536e4 /usr.sbin/dhcpd/errwarn.c | |
parent | 35b114188dc363874554d6bc92858cb8a2710888 (diff) |
Add synchronisation support for dhcpd - this allows for two dhcpd's
with the same configuration to be run on the same net and they will
keep their lease files/state in synch, and therefore allowing you to
run redundant dhcpd's. Synchronization code stolen from spamd, uses
an hmac key in /var/db/dhcpd.key if it exists.
ok krw@ deraadt@
Diffstat (limited to 'usr.sbin/dhcpd/errwarn.c')
-rw-r--r-- | usr.sbin/dhcpd/errwarn.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/usr.sbin/dhcpd/errwarn.c b/usr.sbin/dhcpd/errwarn.c index 70bc1830594..050eb230076 100644 --- a/usr.sbin/dhcpd/errwarn.c +++ b/usr.sbin/dhcpd/errwarn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: errwarn.c,v 1.7 2007/03/02 11:37:53 henning Exp $ */ +/* $OpenBSD: errwarn.c,v 1.8 2008/05/07 12:19:20 beck Exp $ */ /* Errors and warnings... */ @@ -73,13 +73,13 @@ error(char *fmt, ...) write(STDERR_FILENO, mbuf, strlen(mbuf)); write(STDERR_FILENO, "\n", 1); } else - syslog(log_priority | LOG_ERR, "%s", mbuf); + syslog_r(log_priority | LOG_ERR, &sdata, "%s", mbuf); if (log_perror) { fprintf(stderr, "exiting.\n"); fflush(stderr); } else - syslog(LOG_CRIT, "exiting."); + syslog_r(LOG_CRIT, &sdata, "exiting."); exit(1); } @@ -102,7 +102,7 @@ warning(char *fmt, ...) write(STDERR_FILENO, mbuf, strlen(mbuf)); write(STDERR_FILENO, "\n", 1); } else - syslog(log_priority | LOG_ERR, "%s", mbuf); + syslog_r(log_priority | LOG_ERR, &sdata, "%s", mbuf); return (0); } @@ -125,7 +125,7 @@ note(char *fmt, ...) write(STDERR_FILENO, mbuf, strlen(mbuf)); write(STDERR_FILENO, "\n", 1); } else - syslog(log_priority | LOG_INFO, "%s", mbuf); + syslog_r(log_priority | LOG_INFO, &sdata, "%s", mbuf); return (0); } @@ -148,7 +148,7 @@ debug(char *fmt, ...) write(STDERR_FILENO, mbuf, strlen(mbuf)); write(STDERR_FILENO, "\n", 1); } else - syslog(log_priority | LOG_DEBUG, "%s", mbuf); + syslog_r(log_priority | LOG_DEBUG, &sdata, "%s", mbuf); return (0); } @@ -168,7 +168,7 @@ do_percentm(char *obuf, size_t size, char *ibuf) /* * We wouldn't need this mess if printf handled %m, or if - * strerror() had been invented before syslog(). + * strerror() had been invented before syslog_r(). */ for (fmt_left = size; (ch = *s); ++s) { if (ch == '%' && s[1] == 'm') { @@ -226,10 +226,11 @@ parse_warn(char *fmt, ...) } writev(STDERR_FILENO, iov, iovcnt); } else { - syslog(log_priority | LOG_ERR, "%s", mbuf); - syslog(log_priority | LOG_ERR, "%s", token_line); + syslog_r(log_priority | LOG_ERR, &sdata, "%s", mbuf); + syslog_r(log_priority | LOG_ERR, &sdata, "%s", token_line); if (lexchar < 81) - syslog(log_priority | LOG_ERR, "%*c", lexchar, '^'); + syslog_r(log_priority | LOG_ERR, &sdata, "%*c", lexchar, + '^'); } warnings_occurred = 1; |