summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/syslogd/Makefile3
-rw-r--r--usr.sbin/syslogd/syslogd.c14
2 files changed, 7 insertions, 10 deletions
diff --git a/usr.sbin/syslogd/Makefile b/usr.sbin/syslogd/Makefile
index a961eb9..96abfba 100644
--- a/usr.sbin/syslogd/Makefile
+++ b/usr.sbin/syslogd/Makefile
@@ -7,6 +7,9 @@ PROG= syslogd
MAN= syslog.conf.5 syslogd.8
SRCS= syslogd.c ttymsg.c
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
+
WARNS?= 1
CFLAGS+=-DINET6 -I${.CURDIR}/../../usr.bin/wall
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index e54d817..5d2f21b 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/syslimits.h>
+#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
@@ -99,6 +100,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <libutil.h>
#include <limits.h>
#include <paths.h>
#include <signal.h>
@@ -262,7 +264,6 @@ static int Debug; /* debug flag */
static int resolve = 1; /* resolve hostname */
static char LocalHostName[MAXHOSTNAMELEN]; /* our hostname */
static char *LocalDomain; /* our local domain name */
-static int LocalDomainLen; /* length of LocalDomain */
static int *finet; /* Internet datagram socket */
static int fklog = -1; /* /dev/klog */
static int Initialized; /* set when we have initialized ourselves */
@@ -1308,9 +1309,7 @@ cvthname(struct sockaddr *f)
hl = strlen(hname);
if (hl > 0 && hname[hl-1] == '.')
hname[--hl] = '\0';
- if (hl > LocalDomainLen && hname[hl-LocalDomainLen] == '.' &&
- strcasecmp(hname + hl - LocalDomainLen + 1, LocalDomain) == 0)
- hname[hl-LocalDomainLen] = '\0';
+ trimdomain(hname, hl);
return (hname);
}
@@ -1409,7 +1408,6 @@ init(int signo)
} else {
LocalDomain = "";
}
- LocalDomainLen = strlen(LocalDomain);
/*
* Close all open log files.
@@ -1631,11 +1629,7 @@ cfline(const char *line, struct filed *f, const char *prog, const char *host)
hl = strlen(f->f_host);
if (hl > 0 && f->f_host[hl-1] == '.')
f->f_host[--hl] = '\0';
- if (hl > LocalDomainLen &&
- f->f_host[hl-LocalDomainLen] == '.' &&
- strcasecmp(f->f_host + hl - LocalDomainLen + 1,
- LocalDomain) == 0)
- f->f_host[hl-LocalDomainLen] = '\0';
+ trimdomain(f->f_host, hl);
}
/* save program name if any */
OpenPOWER on IntegriCloud