Skip Menu |
 

Download (untitled) / with headers
text/plain 4.3KiB
From liebman@zod.com Sun Apr 20 19:42:27 2003
Received: from fort-point-station.mit.edu (FORT-POINT-STATION.MIT.EDU [18.7.7.76]) by krbdev.mit.edu (8.9.3) with ESMTP
id TAA18610; Sun, 20 Apr 2003 19:42:27 -0400 (EDT)
From: liebman@zod.com
Received: from zod.com (66-215-26-54.pas-mres.charterpipeline.net [66.215.26.54])
by fort-point-station.mit.edu (8.12.4/8.9.2) with ESMTP id h3KNgQGm002403
for <krb5-bugs@mit.edu>; Sun, 20 Apr 2003 19:42:27 -0400 (EDT)
Received: from liebman by zod.com with local (Exim 4.14)
id HDO1UE-0001HK-9S
for krb5-bugs@mit.edu; Sun, 20 Apr 2003 16:42:14 -0700
To: krb5-bugs@mit.edu
Subject: cygwin patch for keb5-current and 1.3alpha2 patch #2
Reply-To: liebman@zod.com
Cc:
X-send-pr-version: 3.99
Message-Id: <EHDO1UE-0001HK-9S@zod.com>
Date: Sun, 20 Apr 2003 16:42:14 -0700


Show quoted text
>Submitter-Id: net
>Originator: Christopher B. Liebman
>Organization:
none
Show quoted text
>Confidential: no
>Synopsis: cygwin does not have inet_ntop when compiling kdc
>Severity: non-critical
>Priority: low
>Category: krb5-kdc
>Class: sw-bug
>Release: krb5-current-20030419
>Environment:

System: CYGWIN_NT-5.0 XYZZY 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unknown unknown Cygwin


Show quoted text
>Description:
when compiling the kdc it fails with inet_ntop as undefined
Show quoted text
>How-To-Repeat:
configure and type make
Show quoted text
>Fix:
Only use inet_ntop if HAVE_INET_NTOP is defined. The following patch
edits the 4 files in the kdc that use inet_ntop.



diff -u -r krb5-current-dist/src/kdc/dispatch.c krb5-current/src/kdc/dispatch.c
--- krb5-current-dist/src/kdc/dispatch.c 2002-09-17 00:00:34.000000000 -0700
+++ krb5-current/src/kdc/dispatch.c 2003-04-20 14:03:26.000000000 -0700
@@ -55,8 +55,20 @@
const char *name = 0;
char buf[46];

+#ifdef HAVE_INET_NTOP
name = inet_ntop (ADDRTYPE2FAMILY (from->address->addrtype),
from->address->contents, buf, sizeof (buf));
+#else
+ if (from->address->addrtype == ADDRTYPE_INET) {
+ struct sockaddr_in *sin
+ = (struct sockaddr_in *)from->address->contents;
+ if (name = inet_ntoa (sin->sin_addr))
+ {
+ strcpy (buf, name);
+ name = buf;
+ }
+ }
+#endif
if (name == 0)
name = "[unknown address type]";
krb5_klog_syslog(LOG_INFO,
diff -u -r krb5-current-dist/src/kdc/do_as_req.c krb5-current/src/kdc/do_as_req.c
--- krb5-current-dist/src/kdc/do_as_req.c 2002-11-04 00:00:44.000000000 -0800
+++ krb5-current/src/kdc/do_as_req.c 2003-04-20 13:57:28.000000000 -0700
@@ -89,9 +89,14 @@
ktypes2str(ktypestr, sizeof(ktypestr),
request->nktypes, request->ktype);

+#ifdef HAVE_INET_NTOP
fromstring = inet_ntop(ADDRTYPE2FAMILY (from->address->addrtype),
from->address->contents,
fromstringbuf, sizeof(fromstringbuf));
+#else
+ if (from->address->addrtype == ADDRTYPE_INET)
+ fromstring = (char *) inet_ntoa(*(struct in_addr *)from->address->contents);
+#endif
if (!fromstring)
fromstring = "<unknown>";

diff -u -r krb5-current-dist/src/kdc/do_tgs_req.c krb5-current/src/kdc/do_tgs_req.c
--- krb5-current-dist/src/kdc/do_tgs_req.c 2003-04-02 00:00:46.000000000 -0800
+++ krb5-current/src/kdc/do_tgs_req.c 2003-04-20 13:57:28.000000000 -0700
@@ -103,9 +103,15 @@
if ((retval = setup_server_realm(request->server)))
return retval;

+#ifdef HAVE_INET_NTOP
fromstring = inet_ntop(ADDRTYPE2FAMILY(from->address->addrtype),
from->address->contents,
fromstringbuf, sizeof(fromstringbuf));
+#else
+ if (from->address->addrtype == ADDRTYPE_INET)
+ fromstring =
+ (char *) inet_ntoa(*(struct in_addr *)from->address->contents);
+#endif
if (!fromstring)
fromstring = "<unknown>";

diff -u -r krb5-current-dist/src/kdc/network.c krb5-current/src/kdc/network.c
--- krb5-current-dist/src/kdc/network.c 2003-01-04 00:00:42.000000000 -0800
+++ krb5-current/src/kdc/network.c 2003-04-20 13:57:28.000000000 -0700
@@ -742,10 +742,24 @@
if (cc == -1) {
char addrbuf[46];
krb5_free_data(kdc_context, response);
+#ifdef HAVE_INET_NTOP
if (inet_ntop(((struct sockaddr *)&saddr)->sa_family,
addr.contents, addrbuf, sizeof(addrbuf)) == 0) {
strcpy(addrbuf, "?");
}
+#else
+ {
+ char* addrstr;
+ if (addrstr = inet_ntoa(((struct sockaddr_in *)&saddr)->sin_addr))
+ {
+ strncpy(addrbuf, addrstr, sizeof(addrbuf));
+ }
+ else
+ {
+ strcpy(addrbuf, "?");
+ }
+ }
+#endif
com_err(prog, errno, "while sending reply to %s/%d",
addrbuf, faddr.port);
return;
To: rt-comment@krbdev.mit.edu
Cc: krb5-prs@MIT.EDU
Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when compiling kdc
From: Ken Raeburn <raeburn@MIT.EDU>
Date: Wed, 23 Apr 2003 21:15:48 -0400
RT-Send-Cc:
If changes are needed in that many places, I'd rather have
port-sockets.h provide an inline version of inet_ntop, to keep the KDC
code simpler, that calls sprintf, since inet_ntoa isn't thread-safe.

Does Cygwin support IPv6 currently?
Do we need to worry about AF_INET6 addresses?

Ken
To: liebman@zod.com
Cc: krb5-bugs@MIT.EDU
Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when compiling kdc
From: Ken Raeburn <raeburn@MIT.EDU>
Date: Thu, 01 May 2003 18:24:23 -0400
RT-Send-Cc:
Download (untitled) / with headers
text/plain 2.2KiB
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 */
From: "Christopher B. Liebman" <liebman@zod.com>
To: "Ken Raeburn" <raeburn@mit.edu>
Cc: <krb5-bugs@mit.edu>
Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when compiling kdc
Date: Thu, 1 May 2003 20:55:18 -0700
RT-Send-Cc:
Download (untitled) / with headers
text/plain 2.5KiB
Ken,
I'll give it a try and let you know!
-- Chris

Show quoted text
----- Original Message -----
From: "Ken Raeburn" <raeburn@mit.edu>
To: <liebman@zod.com>
Cc: <krb5-bugs@mit.edu>
Sent: Thursday, May 01, 2003 3:24 PM
Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when
compiling kdc


> 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 */
>
From: "Christopher B. Liebman" <liebman@zod.com>
To: "Ken Raeburn" <raeburn@mit.edu>
Cc: <krb5-bugs@mit.edu>
Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when compiling kdc
Date: Thu, 1 May 2003 22:36:50 -0700
RT-Send-Cc:
Download (untitled) / with headers
text/plain 2.5KiB
OK, it compiles ok on cygwin.... now for the testing!

-- Chris

Show quoted text
----- Original Message -----
From: "Ken Raeburn" <raeburn@mit.edu>
To: <liebman@zod.com>
Cc: <krb5-bugs@mit.edu>
Sent: Thursday, May 01, 2003 3:24 PM
Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when
compiling kdc


> 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 */
>
>
>
From: "Christopher B. Liebman" <liebman@zod.com>
To: "Ken Raeburn" <raeburn@mit.edu>
Cc: <krb5-bugs@mit.edu>
Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when compiling kdc
Date: Thu, 1 May 2003 23:40:49 -0700
RT-Send-Cc:
Download (untitled) / with headers
text/plain 2.6KiB
Ken
It seems to be working. I've installed and authenticated! :-) FYI,
cygwin does not have ipv6 support. Thanks!

-- Chris

Show quoted text
----- Original Message -----
From: "Ken Raeburn" <raeburn@mit.edu>
To: <liebman@zod.com>
Cc: <krb5-bugs@mit.edu>
Sent: Thursday, May 01, 2003 3:24 PM
Subject: Re: [krbdev.mit.edu #1435] cygwin does not have inet_ntop when
compiling kdc


> 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 */
>
>
>
From: raeburn@mit.edu
Subject: CVS Commit
* port-sockets.h (inet_ntop) [!_WIN32 && !HAVE_MACSOCK_H]: Define as a macro if
not provided by the OS.


To generate a diff of this commit:



cvs diff -r1.354 -r1.355 krb5/src/include/ChangeLog
cvs diff -r1.18 -r1.19 krb5/src/include/port-sockets.h
From: tlyu@mit.edu
Subject: CVS Commit
pullup from trunk


To generate a diff of this commit:



cvs diff -r1.348.2.3 -r1.348.2.4 krb5/src/include/ChangeLog
cvs diff -r1.18 -r1.18.2.1 krb5/src/include/port-sockets.h