Received: from pacific-carrier-annex.mit.edu (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.7.21.83]) by krbdev.mit.edu (8.9.3) with ESMTP id SAA08686; Thu, 1 May 2003 18:24:24 -0400 (EDT) Received: from grand-central-station.mit.edu (GRAND-CENTRAL-STATION.MIT.EDU [18.7.21.82]) by pacific-carrier-annex.mit.edu (8.12.4/8.9.2) with ESMTP id h41MONd3013295; Thu, 1 May 2003 18:24:23 -0400 (EDT) Received: from manawatu-mail-centre.mit.edu (MANAWATU-MAIL-CENTRE.MIT.EDU [18.7.7.71]) by grand-central-station.mit.edu (8.12.4/8.9.2) with ESMTP id h41MONxq029592; Thu, 1 May 2003 18:24:23 -0400 (EDT) Received: from all-in-one.mit.edu (ALL-IN-ONE.MIT.EDU [18.18.1.71]) ) by manawatu-mail-centre.mit.edu (8.12.4/8.12.4) with ESMTP id h41MONFJ026630; Thu, 1 May 2003 18:24:23 -0400 (EDT) Received: (from raeburn@localhost) by all-in-one.mit.edu (8.9.3p2) id SAA03765; Thu, 1 May 2003 18:24:23 -0400 To: liebman@zod.com Cc: krb5-bugs@MIT.EDU Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when compiling kdc References: From: Ken Raeburn Date: Thu, 01 May 2003 18:24:23 -0400 In-Reply-To: (Ken Raeburn's message of "Wed, 23 Apr 2003 21:15:48 -0400") Message-Id: Lines: 54 User-Agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2 (i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii RT-Send-Cc: X-RT-Original-Encoding: us-ascii Content-Length: 2274 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 */