aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-29 05:29:24 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-29 05:29:24 +0000
commit84a4fd33317babb7f1fe2542aa040c26c3603971 (patch)
tree6aab3672de97fd34a5689eaa8071a8551c5bb7b0 /sysdeps/posix
parentf091f00a06a15454add413504e4855db24ab44a2 (diff)
downloadglibc-84a4fd33317babb7f1fe2542aa040c26c3603971.zip
glibc-84a4fd33317babb7f1fe2542aa040c26c3603971.tar.gz
glibc-84a4fd33317babb7f1fe2542aa040c26c3603971.tar.bz2
Update.
2000-09-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/posix/getaddrinfo.c (gaih_inet): Handle req->ai_socktype correctly. Reported by Felix von Leitner <leitner@convergence.de>.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 7a84cd3..bbd4dd1 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -356,6 +356,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0)
continue;
+ if (req->ai_socktype != 0
+ && req->ai_socktype != tp->socktype)
+ continue;
+
newp = (struct gaih_servtuple *)
__alloca (sizeof (struct gaih_servtuple));
@@ -382,6 +386,33 @@ gaih_inet (const char *name, const struct gaih_service *service,
st->port = htons (service->num);
}
}
+ else if (req->ai_socktype || req->ai_protocol)
+ {
+ st = __alloca (sizeof (struct gaih_servtuple));
+ st->next = NULL;
+ st->socktype = req->ai_socktype;
+ st->protocol = req->ai_protocol;
+ st->port = 0;
+ }
+ else
+ {
+ /* Neither socket type nor protocol is set. Return all socket types
+ we know about. */
+ struct gaih_servtuple **lastp = &st;
+ for (++tp; tp->name != NULL; ++tp)
+ {
+ struct gaih_servtuple *newp;
+
+ newp = __alloca (sizeof (struct gaih_servtuple));
+ newp->next = NULL;
+ newp->socktype = tp->socktype;
+ newp->protocol = tp->protocol;
+ newp->port = 0;
+
+ *lastp = newp;
+ lastp = &newp->next;
+ }
+ }
if (name != NULL)
{