2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-05 00:35:41 +00:00

[master] Fixed concatenation of "Dc" formatted options such as domain-search

Merges in rt20558.
This commit is contained in:
Thomas Markwalder
2014-11-25 15:21:39 -05:00
parent f3a44c1037
commit 04daf4fe4b
8 changed files with 414 additions and 1 deletions

View File

@@ -2267,6 +2267,29 @@ void set_option (universe, options, option, op)
break;
}
}
/* If we are trying to combine compressed domain-lists then
* we need to change the expression opcode. The lists must
* be decompressed, combined, and then recompressed to work
* correctly. You cannot simply add two compressed lists
* together. */
switch (((memcmp(option->option->format, "Dc", 2) == 0) +
(memcmp(oc->option->format, "Dc", 2) == 0))) {
case 1:
/* Only one is "Dc", this won't work
* Not sure if you make this occur, but just
* in case. */
log_error ("Both options must be Dc format");
return;
case 2:
/* Both are "Dc", change the code */
noc->expression->op = expr_concat_dclist;
break;
default:
/* Neither are "Dc", so as you were */
break;
}
option_reference(&(noc->option), oc->option, MDL);
save_option (universe, options, noc);
option_cache_dereference (&noc, MDL);