dhclient: allow single hex digits in hexadecimal dhcp_client_id
When checking whether the dhcp-client-identifier is a hex string, we expected pairs of hexadecimal digits separated by colon. Relax this check to also allow single hex digits. https://bugzilla.gnome.org/show_bug.cgi?id=737727 Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
@@ -74,16 +74,24 @@ add_hostname (GString *str, const char *format, const char *hostname)
|
||||
static void
|
||||
add_ip4_config (GString *str, const char *dhcp_client_id, const char *hostname)
|
||||
{
|
||||
if (dhcp_client_id) {
|
||||
if (dhcp_client_id && *dhcp_client_id) {
|
||||
gboolean is_octets = TRUE;
|
||||
int i = 0;
|
||||
|
||||
while (dhcp_client_id[i]) {
|
||||
if ((i % 3) != 2 && !g_ascii_isxdigit (dhcp_client_id[i])) {
|
||||
if (!g_ascii_isxdigit (dhcp_client_id[i])) {
|
||||
is_octets = FALSE;
|
||||
break;
|
||||
}
|
||||
if ((i % 3) == 2 && dhcp_client_id[i] != ':') {
|
||||
i++;
|
||||
if (!dhcp_client_id[i])
|
||||
break;
|
||||
if (g_ascii_isxdigit (dhcp_client_id[i])) {
|
||||
i++;
|
||||
if (!dhcp_client_id[i])
|
||||
break;
|
||||
}
|
||||
if (dhcp_client_id[i] != ':') {
|
||||
is_octets = FALSE;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user