[4178] in Kerberos-V5-bugs
Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when
daemon@ATHENA.MIT.EDU (Ken Raeburn via RT)
Thu May 1 18:24:43 2003
Date: Thu, 1 May 2003 18:24:28 -0400 (EDT)
Mail-Followup-To: rt@krbdev.mit.edu
Message-Id: <rt-1435-5919.5.49182932804754@krbdev.mit.edu>
In-Reply-To: <rt-1435@krbdev.mit.edu>
From: "Ken Raeburn via RT" <rt-comment@krbdev.mit.edu>
Mail-Copies-To: never
To: liebman@zod.com
cc: krb5-prs@mit.edu
Reply-To: rt-comment@krbdev.mit.edu
Errors-To: krb5-bugs-bounces@mit.edu
Your patches aren't consistent. In dispatch.c, you treat
address->contents as a sockaddr_in, but it should be an in_addr, like
you've handled it in do_as_req.c and do_tgs_req.c.
Could you try this (untested) patch to include/port-sockets.h instead?
The files you were patching directly might need updating to include
port-sockets.h if they aren't including it already.
I haven't tried to do the IPv6 support; if Cygwin does include IPv6
support and just doesn't supply inet_ntop, let me know, and I can
extend this to include AF_INET6 as well. (At the moment, our
configure scripts turn off IPv6 support for krb5 if various types and
functions aren't available; inet_ntop is one of them, but that can be
changed.)
The intent of port-sockets.h is that source files including it should
be able to use a reasonably consistent interface to the socket API on
all platforms. It looks like all the UNIX systems we actively test on
right now do have inet_ntop. (We don't test on Cygwin, obviously.)
If it's not consistently available, though, either we shouldn't use
it, or we should be prepared to provide it.
I should go back and look at the network.c case more closely; perhaps
it should just be using getnameinfo instead of inet_ntop.
Index: port-sockets.h
===================================================================
RCS file: /cvs/krbdev/krb5/src/include/port-sockets.h,v
retrieving revision 1.18
diff -p -u -r1.18 port-sockets.h
--- port-sockets.h 2003/01/10 19:10:30 1.18
+++ port-sockets.h 2003/05/01 21:52:28
@@ -153,6 +153,21 @@ typedef struct iovec sg_buf;
#define SHUTDOWN_WRITE 1
#define SHUTDOWN_BOTH 2
+#ifndef HAVE_INET_NTOP
+#define inet_ntop(AF,SRC,DST,CNT) \
+ ((AF) == AF_INET \
+ ? ((CNT) < 16 \
+ ? (SOCKET_SET_ERRNO(ENOSPC), NULL) \
+ : (sprintf((DST), "%d.%d.%d.%d", \
+ ((const unsigned char *)(const void *)(SRC))[0] & 0xff, \
+ ((const unsigned char *)(const void *)(SRC))[1] & 0xff, \
+ ((const unsigned char *)(const void *)(SRC))[2] & 0xff, \
+ ((const unsigned char *)(const void *)(SRC))[3] & 0xff), \
+ (DST))) \
+ : (SOCKET_SET_ERRNO(EAFNOSUPPORT), NULL))
+#define HAVE_INET_NTOP
+#endif
+
#endif /* HAVE_MACSOCK_H */
#endif /* _WIN32 */
_______________________________________________
krb5-bugs mailing list
krb5-bugs@mit.edu
http://mailman.mit.edu/mailman/listinfo/krb5-bugs