From b02232ffdf69f75caaf10c78e00a9fa8f93b3286 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Tue, 4 Jun 2002 06:59:28 +0000 Subject: Add capability of looking up TCP addresses for KDC in DNS; not enabled yet. Internal "addrlist" structure now includes socket type, by way of using struct addrinfo where struct sockaddr was used before; updated uses. No support for noting TCP/UDP vs UDP-only addresses in config files. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14465 dc483132-0cff-0310-8789-dd5450dbe970 --- src/krb524/sendmsg.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/krb524/sendmsg.c') diff --git a/src/krb524/sendmsg.c b/src/krb524/sendmsg.c index 00c55f0d2..2335dad31 100644 --- a/src/krb524/sendmsg.c +++ b/src/krb524/sendmsg.c @@ -28,6 +28,7 @@ /* Grab socket stuff. This might want to go away later. */ #define NEED_SOCKETS #define NEED_LOWLEVEL_IO +#include "fake-addrinfo.h" /* for custom addrinfo if needed */ #include "k5-int.h" #ifndef _WIN32 @@ -101,8 +102,8 @@ krb524_sendto_kdc (context, message, realm, reply) */ if (retval == 0) for (i = 0; i < al.naddrs; i++) { - if (al.addrs[i]->sa_family == AF_INET) - sa2sin (al.addrs[i])->sin_port = port; + if (al.addrs[i]->ai_family == AF_INET) + sa2sin (al.addrs[i]->ai_addr)->sin_port = port; } } if (retval) @@ -163,7 +164,7 @@ krb524_sendto_kdc (context, message, realm, reply) * protocol exists to support a particular socket type * within a given protocol family. */ - socklist[host] = socket(al.addrs[host]->sa_family, SOCK_DGRAM, + socklist[host] = socket(al.addrs[host]->ai_family, SOCK_DGRAM, 0); if (socklist[host] == INVALID_SOCKET) continue; /* try other hosts */ @@ -173,8 +174,8 @@ krb524_sendto_kdc (context, message, realm, reply) socket will time out, so use connect, send, recv instead of sendto, recvfrom. The connect here may return an error if the destination host is known to be unreachable. */ - if (connect(socklist[host], al.addrs[host], - socklen(al.addrs[host])) == SOCKET_ERROR) + if (connect(socklist[host], al.addrs[host]->ai_addr, + al.addrs[host]->ai_addrlen) == SOCKET_ERROR) continue; } if (send(socklist[host], message->data, (int) message->length, 0) -- cgit