summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r--sbin/dhclient/dhclient.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index c9c74144c1b8..26e06619fb0d 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -84,6 +84,8 @@ __FBSDID("$FreeBSD$");
#define CLIENT_PATH "PATH=/usr/bin:/usr/sbin:/bin:/sbin"
+cap_channel_t *capsyslog;
+
time_t cur_time;
time_t default_lease_time = 43200; /* 12 hours... */
@@ -345,6 +347,21 @@ die:
exit(1);
}
+static void
+init_casper(void)
+{
+ cap_channel_t *casper;
+
+ casper = cap_init();
+ if (casper == NULL)
+ error("unable to start casper");
+
+ capsyslog = cap_service_open(casper, "system.syslog");
+ cap_close(casper);
+ if (capsyslog == NULL)
+ error("unable to open system.syslog service");
+}
+
int
main(int argc, char *argv[])
{
@@ -356,9 +373,11 @@ main(int argc, char *argv[])
pid_t otherpid;
cap_rights_t rights;
+ init_casper();
+
/* Initially, log errors to stderr as well as to syslogd. */
- openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
- setlogmask(LOG_UPTO(LOG_DEBUG));
+ cap_openlog(capsyslog, __progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
+ cap_setlogmask(capsyslog, LOG_UPTO(LOG_DEBUG));
while ((ch = getopt(argc, argv, "bc:dl:p:qu")) != -1)
switch (ch) {
@@ -518,7 +537,7 @@ main(int argc, char *argv[])
setproctitle("%s", ifi->name);
- if (cap_enter() < 0 && errno != ENOSYS)
+ if (CASPER_SUPPORT && cap_enter() < 0 && errno != ENOSYS)
error("can't enter capability mode: %m");
if (immediate_daemon)