Bug 4092 - libunbound: use-caps-for-id lacks colon in config_set_option
libunbound: use-caps-for-id lacks colon in config_set_option
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
1.7.0
x86_64 Linux
: P5 minor
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-04-21 00:49 CEST by Alex Zorin
Modified: 2018-04-23 09:52 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Zorin 2018-04-21 00:49:56 CEST
Hello,

The following results in a syntax error:

    ub_ctx_set_option(ctx, "use-caps-for-id:", "yes");

but will succeed if the trailing colon is removed:

    ub_ctx_set_option(ctx, "use-caps-for-id", "yes");

This isn't consistent with the documentation for ub_ctx_set_option: 

    Pass the option name with the trailing ':'.

The source of the issue appears to be a missing colon in the definition of the option within config_set_option: https://github.com/NLnetLabs/unbound/blob/f39e39ed4728ea7853f6fd3e59fc5397e92fb317/util/config_file.c#L512 .

The issue does not seem to be present in the config lexer.
Comment 1 Wouter Wijngaards 2018-04-23 09:52:13 CEST
Hi Alex,

Thanks for the report!  It turns out to be a one letter mistake.
Fixed in the code repository and a patch diff below.

Best regards, Wouter

Index: util/config_file.c
===================================================================
--- util/config_file.c	(revision 4642)
+++ util/config_file.c	(working copy)
@@ -509,7 +509,7 @@
 	else S_YNO("harden-below-nxdomain:", harden_below_nxdomain)
 	else S_YNO("harden-referral-path:", harden_referral_path)
 	else S_YNO("harden-algo-downgrade:", harden_algo_downgrade)
-	else S_YNO("use-caps-for-id", use_caps_bits_for_id)
+	else S_YNO("use-caps-for-id:", use_caps_bits_for_id)
 	else S_STRLIST("caps-whitelist:", caps_whitelist)
 	else S_SIZET_OR_ZERO("unwanted-reply-threshold:", unwanted_threshold)
 	else S_STRLIST("private-address:", private_address)