Skip to content

Commit

Permalink
Fixed microsoft#623: getaddrinfo calls with a service name fail on Do…
Browse files Browse the repository at this point in the history
…cker images that lack /etc/services.
  • Loading branch information
danports committed May 7, 2019
1 parent 5a2a017 commit cad205a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Unix/http/httpclientauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,9 @@ static char *_BuildInitialGssAuthHeader(_In_ HttpClient_SR_SocketData * self, MI
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_CANONNAME;

if ((gai_result = getaddrinfo(self->hostname, "http", &hints, &info)) != 0)
// Use a port number rather than a service name (http), which relies on /etc/services, which may not be available.
// The port number is irrelevant anyway since we're only using info->ai_canonname below.
if ((gai_result = getaddrinfo(self->hostname, "80", &hints, &info)) != 0)
{
trace_HTTP_GetAddrInfoError(gai_strerror(gai_result));
return NULL;
Expand Down

0 comments on commit cad205a

Please sign in to comment.