summaryrefslogtreecommitdiff
path: root/gweb
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@nokia.com>2011-04-05 13:57:41 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-04-11 21:37:58 +0200
commitb2e8ddc37278588c7364770a6e98cda76cc9b540 (patch)
tree7302dc4d5de6b8ca816f2d0de64a7358863967ac /gweb
parent8a67f04f02a8182a605a697764ab1535d1a75fe3 (diff)
downloadconnman-b2e8ddc37278588c7364770a6e98cda76cc9b540.tar.gz
connman-b2e8ddc37278588c7364770a6e98cda76cc9b540.tar.bz2
connman-b2e8ddc37278588c7364770a6e98cda76cc9b540.zip
gweb: numeric session address was not resolved properly.
Reported by: Sebastien Bianti <sebastien.bianti@linux.intel.com>
Diffstat (limited to 'gweb')
-rw-r--r--gweb/gweb.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gweb/gweb.c b/gweb/gweb.c
index 75e64d96..9c9fcd1b 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -1148,9 +1148,30 @@ static guint do_request(GWeb *web, const char *url,
return 0;
}
} else {
+ struct addrinfo hints;
+ char *port;
+ int ret;
+
if (session->address == NULL)
session->address = g_strdup(session->host);
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_flags = AI_NUMERICHOST;
+
+ if (session->addr != NULL) {
+ freeaddrinfo(session->addr);
+ session->addr = NULL;
+ }
+
+ port = g_strdup_printf("%u", session->port);
+ ret = getaddrinfo(session->address, port, &hints,
+ &session->addr);
+ g_free(port);
+ if (ret != 0 || session->addr == NULL) {
+ free_session(session);
+ return 0;
+ }
+
if (create_transport(session) < 0) {
free_session(session);
return 0;