From e010dcf7810d8edc91015999f5370a8e50f76644 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sat, 6 Jun 2015 15:28:41 -0400 Subject: [PATCH] Allow comments in configuration list files. A commented line begins with a ';'. --- doc/pwmd.html | 18 ++++++++++-------- doc/pwmd.texi | 18 ++++++++++-------- src/cache.c | 3 ++- src/rcfile.c | 3 +++ 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/doc/pwmd.html b/doc/pwmd.html index 01c36281..b3e1440a 100644 --- a/doc/pwmd.html +++ b/doc/pwmd.html @@ -400,10 +400,11 @@ the executes pwmd.

invoking_file = filename
-

A file containing one entry per line. An entry has the same syntax as the -invoking_user parameter. When both this parameter and the -invoking_user parameter are specified then the invoking_file -entries will be appended to the invoking_user parameter value. +

A file containing one ACL entry per line. Lines beginning with a ; are +ignored. An entry has the same syntax as the invoking_user parameter. +When both this parameter and the invoking_user parameter are specified +then the invoking_file entries will be appended to the +invoking_user parameter value.

strict_kill = boolean
@@ -439,10 +440,11 @@ allow any TLS client except for the client with TLS fingerprint has
allowed_file = filename
-

A file containing one entry per line. An entry has the same syntax as the -allowed parameter. When both this parameter and the allowed -parameter are specified then the allowed_file entries will be appended -to the allowed parameter value. +

A file containing one ACL entry per line. Lines beginning with a ; are +ignored. An entry has the same syntax as the allowed parameter. When +both this parameter and the allowed parameter are specified then the +allowed_file entries will be appended to the allowed parameter +value.

disable_mlockall = boolean
diff --git a/doc/pwmd.texi b/doc/pwmd.texi index ef5a5147..e4c58789 100644 --- a/doc/pwmd.texi +++ b/doc/pwmd.texi @@ -336,10 +336,11 @@ data file and element paths (@pxref{Access Control}). The default is the user the executes @command{pwmd}. @item invoking_file = filename -A file containing one entry per line. An entry has the same syntax as the -@code{invoking_user} parameter. When both this parameter and the -@code{invoking_user} parameter are specified then the @code{invoking_file} -entries will be appended to the @code{invoking_user} parameter value. +A file containing one ACL entry per line. Lines beginning with a @code{;} are +ignored. An entry has the same syntax as the @code{invoking_user} parameter. +When both this parameter and the @code{invoking_user} parameter are specified +then the @code{invoking_file} entries will be appended to the +@code{invoking_user} parameter value. @item strict_kill = boolean When @code{false}, the @code{KILL} command (@pxref{KILL}) will allow killing @@ -372,10 +373,11 @@ allowed=-@@primary,username,+,!#ABCDEF @end example @item allowed_file = filename -A file containing one entry per line. An entry has the same syntax as the -@code{allowed} parameter. When both this parameter and the @code{allowed} -parameter are specified then the @code{allowed_file} entries will be appended -to the @code{allowed} parameter value. +A file containing one ACL entry per line. Lines beginning with a @code{;} are +ignored. An entry has the same syntax as the @code{allowed} parameter. When +both this parameter and the @code{allowed} parameter are specified then the +@code{allowed_file} entries will be appended to the @code{allowed} parameter +value. @item disable_mlockall = boolean When set to @code{false}, @cite{mlockall(2)} will be called on startup. This diff --git a/src/cache.c b/src/cache.c index 7e5d86a2..24826b1a 100644 --- a/src/cache.c +++ b/src/cache.c @@ -149,7 +149,8 @@ cache_unlock_mutex (const unsigned char *md5file, int remove) } #ifdef WITH_AGENT -static int valid_agent_grip (file_cache_t *e) +static int +valid_agent_grip (file_cache_t *e) { size_t c; diff --git a/src/rcfile.c b/src/rcfile.c index 9b441e77..93ed7ce1 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -678,6 +678,9 @@ parse_list_file (struct slist_s *config, const char *section, { char **pp = NULL; + if (!*p || *p == ';') + continue; + if (p[strlen(p)-1] == '\n') p[strlen(p)-1] = 0; -- 2.11.4.GIT