diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-10-30 09:13:38 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-10-30 09:13:38 +0100 |
commit | a2cc708a88087e903bd915ecd1d91370f4347c17 (patch) | |
tree | 8af98a9d0171d5eca62d37f12f968eb977e7b3b2 /src/network/networkd-dhcp4.c | |
parent | 864edb39cfb68a304a7c318965079effc6a05ece (diff) | |
download | systemd-a2cc708a88087e903bd915ecd1d91370f4347c17.tar.gz |
network: amend SendOption= to take a c-escaped string
No need to punish users by forcing them to do base64 encodings.
Diffstat (limited to 'src/network/networkd-dhcp4.c')
-rw-r--r-- | src/network/networkd-dhcp4.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 45091de97d..947853e2c4 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -6,7 +6,7 @@ #include "alloc-util.h" #include "dhcp-client-internal.h" -#include "hexdecoct.h" +#include "escape.h" #include "hostname-util.h" #include "parse-util.h" #include "network-internal.h" @@ -1579,12 +1579,11 @@ int config_parse_dhcp_send_option( void *userdata) { _cleanup_(sd_dhcp_option_unrefp) sd_dhcp_option *opt = NULL, *old = NULL; - _cleanup_free_ char *word = NULL; - _cleanup_free_ void *q = NULL; + _cleanup_free_ char *word = NULL, *q = NULL; Network *network = data; const char *p; uint8_t u; - size_t sz; + ssize_t sz; int r; assert(filename); @@ -1619,10 +1618,10 @@ int config_parse_dhcp_send_option( return 0; } - r = unbase64mem(p, (size_t) -1, &q, &sz); - if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, - "Failed to decode base64 data, ignoring assignment: %s", p); + sz = cunescape(p, 0, &q); + if (sz < 0) { + log_syntax(unit, LOG_ERR, filename, line, sz, + "Failed to decode option data, ignoring assignment: %s", p); return 0; } |