Maintained by: NLnet Labs

[Unbound-users] Patch: wildcard for include: statement

W.C.A. Wijngaards
Mon Apr 15 09:59:05 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Robert,

On 04/13/2013 11:31 PM, Robert Edmonds wrote:
> Paul Wouters wrote:
>> On Sat, 13 Apr 2013, Robert Edmonds wrote:
>>> this goes away if i put at least one file that matches the glob
>>> into that directory, but i don't want to have to ship a dummy
>>> empty "do-not-remove.conf" file in the conf.d directory in
>>> order to get the config to parse correctly (what if the user
>>> removes it?).  could this feature be updated so that a lack of
>>> glob matches is treated as "success, but no files included"
>>> rather than failure to parse the config?  (possibly made
>>> contingent on the existence of the directory of the dirname()
>>> of the wildcarded include: parameter.)
>> 
>> What I did was put commented out examples (example.com.conf, 
>> example.comf.key) in those directories. Without those, the users
>> will have a hard time figuring out the syntax anyway.
>> 
>> eg I have example.com.conf:
> 
> yes, that's exactly what i don't want to do.  i just want a
> completely empty /etc/unbound/conf.d directory to work, so i can
> simply put something like this at the end of the default debian
> unbound.conf:
> 
> # Additional local configuration of unbound can be performed by
> creating # files whose names end in ".conf" in the
> /etc/unbound/conf.d directory. # See the the unbound.conf(5) man
> page for details about the "include:" # directive. include:
> "/etc/unbound/conf.d/*.conf"
> 
> and the users won't have any problem figuring out the syntax...
> ".d" config directories are well-understood.  after all, they're
> the ones asking for the feature:
> 
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656549

Makes sense, the patch is very simple, and should not make trouble for
Paul, right?  It is also part of svn , if you want to use it right
away, this is the patch:

This is the patch:
- --- util/configlexer.lex (revision 2882)
+++ util/configlexer.lex (working copy)
@@ -107,6 +107,8 @@
                 if(r) {
                         /* some error */
                         globfree(&g);
+                        if(r == GLOB_NOMATCH)
+                                return; /* no matches for pattern */
                         config_start_include(filename); /* let
original deal with it */
                         return;
                 }

Best regards,
   Wouter

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRa7NJAAoJEJ9vHC1+BF+NtUkQAIWoiIiLCNI57EchHuO/5uYM
GuYcylfx+rvHHYq7N9ME7FuOwMPOFM048AXTxWdiO9H6oVNTyd62FXiDG35rJvjJ
y1m8glimypQ5Is/SCgoATpDsH2qvVFd/hWIPHotwrtcTUUqXhipgumYCermco8j6
q1FONpwbMxkUNJBEpQERSznGB7/HgRGoHgMUcuhQf6dcbvgPx0+rN3ykT6ZqS6QD
6AR9H8xtUB8oY2gyW1BLZGSfDDxPl7BrC48iXd6Pl6uJMebBK3xZRsCGHY/eD5jP
+PhTWE/uMgZcjSo6jm0H8Gytxt3V0hibJ2Jn5lvZtwwPURX42okGSSluNs/HOl3w
Qf3rqe4agAwrpuhb2ouqaBjaqCOIIeBO8hS1Psh7vi5Qxo+nQUsO7lOFriXi04E4
igdkBGY6MPJGshcoE9fRzuHbkenFm+CJxd175s4nsJ2NYf9o2l2/yr3ShUtpOjHs
QWf9nuS4z+8XRXWpq/07qCXU1N/nrDBjDi4Ul47dNnoNMe3O3q1ORZBPQLYEaKMs
m2tRqmnwef03/rM8EBfYEvg+rn8uO9lvaiPJfiYrneafUHrfuLACAC7awsmtwh6g
OQRBALkSzrO8oNEKwZ/kG5ptnZu0Gzt1SNDTUOILfy515MHGGzQQLCbS1LKLItJ2
w1m3Sw3UKgkRwKOHQ05u
=HM5G
-----END PGP SIGNATURE-----