summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-09-29 15:06:53 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-09-29 15:06:53 +0000
commit0e98fbc399284e7fef87b160f2842b0c3106e843 (patch)
treeb3adf6949632f774da3d3980b7c321f701cca729
parent275880f8c7f7e257d10fa902d82eb70a954af888 (diff)
Change parsing of comments in external rule files. The hash mark may
appear in URLs (eg. /index.html#anchor), so only allow full-line comments indicated by a hash mark # at the beginning of a line.
-rw-r--r--usr.sbin/relayd/relayd.c8
-rw-r--r--usr.sbin/relayd/relayd.conf.58
2 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index 1e559e71f06..5c49ac8e933 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.81 2008/09/29 14:53:35 reyk Exp $ */
+/* $OpenBSD: relayd.c,v 1.82 2008/09/29 15:06:52 reyk Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -1187,9 +1187,9 @@ protonode_load(enum direction dir, struct protocol *proto,
return (-1);
while (fgets(buf, sizeof(buf), fp) != NULL) {
- /* strip comment, whitespace, and newline characters */
- buf[strcspn(buf, "\r\n\t #")] = '\0';
- if (!strlen(buf))
+ /* strip whitespace and newline characters */
+ buf[strcspn(buf, "\r\n\t ")] = '\0';
+ if (!strlen(buf) || buf[0] == '#')
continue;
pn.key = strdup(buf);
if (node->value != NULL)
diff --git a/usr.sbin/relayd/relayd.conf.5 b/usr.sbin/relayd/relayd.conf.5
index 9985fc42a4e..0bd77c1a6b4 100644
--- a/usr.sbin/relayd/relayd.conf.5
+++ b/usr.sbin/relayd/relayd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: relayd.conf.5,v 1.95 2008/09/29 14:53:35 reyk Exp $
+.\" $OpenBSD: relayd.conf.5,v 1.96 2008/09/29 15:06:52 reyk Exp $
.\"
.\" Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
.\" Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -828,10 +828,10 @@ Like the directive above, but load the non-digest keys from an
external file with the specified
.Ar path
containing one key per line.
-Empty lines will be ingnored and lines will be stripped at any
-whitespaces, newline characters, or hash marks
+Lines will be stripped at the first whitespace or newline character.
+Any empty lines or lines beginning with a hash mark
.Pq Sq #
-indicating a comment.
+will be ignored.
.It Ic filter Ar value Ic from Ar key
Like the
.Ic expect Ar .. Ic from