diff options
author | Denys Vlasenko | 2014-06-16 00:17:00 +0200 |
---|---|---|
committer | Denys Vlasenko | 2014-06-16 00:17:00 +0200 |
commit | 85090c162b322a4ffe53d251e59bbfc212a829ee (patch) | |
tree | 1b547e8c14ddafcb853e46eaff6724c212326123 /networking | |
parent | 9aa6ffb22b712d4e928604e291f954b02237e8cd (diff) | |
download | busybox-85090c162b322a4ffe53d251e59bbfc212a829ee.zip busybox-85090c162b322a4ffe53d251e59bbfc212a829ee.tar.gz |
udhcpc: make hostname sanitization optional. Closes 3979
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/udhcp/Config.src | 11 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/networking/udhcp/Config.src b/networking/udhcp/Config.src index 6bfa398..c34c8d6 100644 --- a/networking/udhcp/Config.src +++ b/networking/udhcp/Config.src @@ -84,6 +84,17 @@ config FEATURE_UDHCPC_ARPING will DHCPDECLINE the offer if the address is in use, and restart the discover process. +config FEATURE_UDHCPC_SANITIZEOPT + bool "Do not pass malformed host and domain names" + default y + depends on UDHCPC + help + If selected, udhcpc will check some options (such as option 12 - + hostname) and if they don't look like valid hostnames + (for example, if they start with dash or contain spaces), + they will be replaced with string "bad" when exporting + to the environment. + config FEATURE_UDHCP_PORT bool "Enable '-P port' option for udhcpd and udhcpc" default n diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 7dfc160..e468b7b 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -136,6 +136,7 @@ static int mton(uint32_t mask) return i; } +#if ENABLE_FEATURE_UDHCPC_SANITIZEOPT /* Check if a given label represents a valid DNS label * Return pointer to the first character after the label upon success, * NULL otherwise. @@ -192,6 +193,9 @@ static int good_hostname(const char *name) name++; } } +#else +# define good_hostname(name) 1 +#endif /* Create "opt_name=opt_value" string */ static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_optflag *optflag, const char *opt_name) |