openbsd-ports/net/darkstat/patches/patch-darkstat_c
brad 8ad9bf4678 Update to darkstat 3.0.718.
- Contains additional time_t related fixes.
- The author removed an assertion in timer_stop() I had run into and even
  though monotonic time is used somehow time went backwards.
- Change the rc.d script to use localhost instead of 127.0.0.1 to have
  darkstat also bind to the v6 address.

ok sthen@
2014-02-07 08:56:53 +00:00

67 lines
2.1 KiB
Plaintext

$OpenBSD: patch-darkstat_c,v 1.3 2014/02/07 08:56:53 brad Exp $
Re-instate the chroot by default code.
--- darkstat.c.orig Thu Feb 6 02:48:20 2014
+++ darkstat.c Thu Feb 6 02:56:07 2014
@@ -134,16 +134,44 @@ const char *opt_privdrop_user = NULL;
static void cb_user(const char *arg) { opt_privdrop_user = arg; }
const char *opt_daylog_fn = NULL;
-static void cb_daylog(const char *arg) { opt_daylog_fn = arg; }
+static void cb_daylog(const char *arg)
+{
+ if (opt_chroot_dir == NULL)
+ errx(1, "the daylog file is relative to the chroot.\n"
+ "You must specify a --chroot dir before you can use --daylog.");
+ else
+ opt_daylog_fn = arg;
+}
const char *import_fn = NULL;
-static void cb_import(const char *arg) { import_fn = arg; }
+static void cb_import(const char *arg)
+{
+ if (opt_chroot_dir == NULL)
+ errx(1, "the import file is relative to the chroot.\n"
+ "You must specify a --chroot dir before you can use --import.");
+ else
+ import_fn = arg;
+}
const char *export_fn = NULL;
-static void cb_export(const char *arg) { export_fn = arg; }
+static void cb_export(const char *arg)
+{
+ if ((opt_chroot_dir == NULL) && (opt_capfile == NULL))
+ errx(1, "the export file is relative to the chroot.\n"
+ "You must specify a --chroot dir before you can use --export.");
+ else
+ export_fn = arg;
+}
static const char *pid_fn = NULL;
-static void cb_pidfile(const char *arg) { pid_fn = arg; }
+static void cb_pidfile(const char *arg)
+{
+ if (opt_chroot_dir == NULL)
+ errx(1, "the pidfile is relative to the chroot.\n"
+ "You must specify a --chroot dir before you can use --pidfile.");
+ else
+ pid_fn = arg;
+}
unsigned int opt_hosts_max = 1000;
static void cb_hosts_max(const char *arg)
@@ -306,7 +334,9 @@ static void parse_cmdline(const int argc, char * const
if (opt_want_syslog)
openlog("darkstat", LOG_NDELAY | LOG_PID, LOG_DAEMON);
- /* default value */
+ /* some default values */
+ if (opt_chroot_dir == NULL)
+ opt_chroot_dir = CHROOT_DIR;
if (opt_privdrop_user == NULL)
opt_privdrop_user = PRIVDROP_USER;