rrdcached possible bug
Adrian-Ioan Vasile <[email protected]>
| Newsgroups | gmane.comp.db.rrdtool.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all, 1. I found an apparent bug in the journaling system of rrdcached. When specifying a relative path (-j option) it would segfault when trying to read past journals (journal_init function). So, for this reason, I added an extra check to journal_init before reading the directory, and, when parsing the command line options, to expand the relative path to an absolute path. Here's the patch. 2. Why implement any security into rrdcached for the reason that only authorized hosts may connect to it via tcp/udp and this can be done with local tools such as iptables. Thanks for this great product, Adrian-Ioan Vasile [email protected] _______________________________________________ rrd-developers mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
journal-bug.diff
(application/octet-stream, 812 B)
diff -ruN rrdtool-trunk/src/rrd_daemon.c rrd-trunk-clean/src/rrd_daemon.c
--- rrdtool-trunk/src/rrd_daemon.c 2010-04-22 17:55:22.000000000 +0300
+++ rrd-trunk-clean/src/rrd_daemon.c 2010-04-22 17:20:37.000000000 +0300
@@ -2293,6 +2293,10 @@
}
dir = opendir(journal_dir);
+ if (!dir) {
+ RRDD_LOG(LOG_CRIT, "journal_init: opendir(%s) failed\n", journal_dir);
+ return;
+ }
while ((dent = readdir(dir)) != NULL)
{
/* looks like a journal file? */
@@ -3244,7 +3244,11 @@
case 'j':
{
- const char *dir = journal_dir = strdup(optarg);
+ char journal_dir_actual[PATH_MAX];
+ const char *dir;
+
+ dir = journal_dir = strdup(realpath((const char *)optarg, journal_dir_actual));
status = rrd_mkdir_p(dir, 0777);
if (status != 0)