Commit a93bd4b0 authored by Simon Kelley's avatar Simon Kelley

Fix broken DNSMASQ_USER<x> envvars in script with more than one class.

parent 407a1f3e
...@@ -1110,10 +1110,14 @@ int do_script_run(time_t now) ...@@ -1110,10 +1110,14 @@ int do_script_run(time_t now)
} }
#ifdef HAVE_SCRIPT #ifdef HAVE_SCRIPT
/* delim == -1 -> delim = 0, but embeded 0s, creating extra records, are OK. */
void lease_add_extradata(struct dhcp_lease *lease, unsigned char *data, unsigned int len, int delim) void lease_add_extradata(struct dhcp_lease *lease, unsigned char *data, unsigned int len, int delim)
{ {
unsigned int i; unsigned int i;
if (delim == -1)
delim = 0;
else
/* check for embeded NULLs */ /* check for embeded NULLs */
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
if (data[i] == 0) if (data[i] == 0)
......
...@@ -1308,7 +1308,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index, ...@@ -1308,7 +1308,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
/* If the user-class option started as counted strings, the first byte will be zero. */ /* If the user-class option started as counted strings, the first byte will be zero. */
if (len != 0 && ucp[0] == 0) if (len != 0 && ucp[0] == 0)
ucp++, len--; ucp++, len--;
lease_add_extradata(lease, ucp, len, 0); lease_add_extradata(lease, ucp, len, -1);
} }
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment