mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-18 19:41:03 +00:00
Fix broken DNSMASQ_USER<x> envvars in script with more than one class.
This commit is contained in:
1 parent
407a1f3e95
commit
a93bd4b016
2 files changed
+12
-8
No files matched your search
+11
-7
@@ -1110,17 +1110,21 @@ 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;
|
||||||
|
|
||||||
/* check for embeded NULLs */
|
if (delim == -1)
|
||||||
for (i = 0; i < len; i++)
|
delim = 0;
|
||||||
if (data[i] == 0)
|
else
|
||||||
{
|
/* check for embeded NULLs */
|
||||||
len = i;
|
for (i = 0; i < len; i++)
|
||||||
break;
|
if (data[i] == 0)
|
||||||
}
|
{
|
||||||
|
len = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ((lease->extradata_size - lease->extradata_len) < (len + 1))
|
if ((lease->extradata_size - lease->extradata_len) < (len + 1))
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
|
|||||||
Reference in new issue
Block a user