wispr: using only the nameservers from requested service
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Thu, 29 Dec 2011 11:02:22 +0000 (13:02 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 5 Jan 2012 10:03:39 +0000 (11:03 +0100)
src/wispr.c

index 84df2bc..85ee857 100644 (file)
@@ -625,8 +625,10 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
 {
        enum connman_service_type service_type;
        char *interface = NULL;
+       char **nameservers;
        int if_index;
        int err = 0;
+       int i;
 
        DBG("wispr/portal context %p", wp_context);
        DBG("service %p", wp_context->service);
@@ -660,6 +662,12 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
                goto done;
        }
 
+       nameservers = connman_service_get_nameservers(wp_context->service);
+       if (nameservers == NULL) {
+               err = -EINVAL;
+               goto done;
+       }
+
        wp_context->web = g_web_new(if_index);
        if (wp_context->web == NULL) {
                err = -ENOMEM;
@@ -674,6 +682,9 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
                wp_context->status_url = STATUS_URL_IPV6;
        }
 
+       for (i = 0; nameservers[i] != NULL; i++)
+               g_web_add_nameserver(wp_context->web, nameservers[i]);
+
        wp_context->token = connman_proxy_lookup(interface,
                                        wp_context->status_url,
                                        wp_context->service,