We do not use the received DHCP hostname option (12) if system
config file setting says so.

Fixes BMC#25597
---
 src/dhcp.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/dhcp.c b/src/dhcp.c
index 3425b6d..9d1a95e 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include <connman/ipconfig.h>
+#include <include/setting.h>
 
 #include <gdhcp/gdhcp.h>
 
@@ -258,9 +259,12 @@ static void lease_available_cb(GDHCPClient *dhcp_client, 
gpointer user_data)
        if (option != NULL)
                domainname = g_strdup(option->data);
 
-       option = g_dhcp_client_get_option(dhcp_client, G_DHCP_HOST_NAME);
-       if (option != NULL)
-               hostname = g_strdup(option->data);
+       if (connman_setting_get_bool("AllowHostnameUpdates") == TRUE) {
+               option = g_dhcp_client_get_option(dhcp_client,
+                                               G_DHCP_HOST_NAME);
+               if (option != NULL)
+                       hostname = g_strdup(option->data);
+       }
 
        option = g_dhcp_client_get_option(dhcp_client, G_DHCP_NTP_SERVER);
        ns_entries = g_list_length(option);
-- 
1.7.9.5

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to