1 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/acconfig.h cyrus-sasl-1.5.27.ipv6/acconfig.h
2 --- cyrus-sasl-1.5.27.orig/acconfig.h Thu Apr 26 18:33:15 2001
3 +++ cyrus-sasl-1.5.27.ipv6/acconfig.h Thu Apr 26 18:33:48 2001
5 /* define if your system has getpid() */
8 +/* define if your system has struct sockaddr_storage */
9 +#undef HAVE_SOCKADDR_STORAGE
13 +/* define if your system has getnameinfo() */
14 +#undef HAVE_GETNAMEINFO
16 +/* Define if you have ss_family in struct sockaddr_storage. */
17 +#undef HAVE_SS_FAMILY
19 +/* do we have socklen_t? */
20 +#undef HAVE_SOCKLEN_T
22 /* location of the random number generator */
24 #define DEV_RANDOM "/dev/random"
29 +#if defined(HAVE_SOCKADDR_STORAGE) && defined(HAVE_GETNAMEINFO)
33 +#include <sys/socket.h>
34 +#ifndef NI_WITHSCOPEID
35 +#define NI_WITHSCOPEID 0
37 +#ifndef HAVE_SS_FAMILY
38 +#define ss_family __ss_family
41 #include <netinet/in.h>
43 +#ifndef HAVE_SOCKLEN_T
44 +typedef int socklen_t;
48 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/aclocal.m4 cyrus-sasl-1.5.27.ipv6/aclocal.m4
49 --- cyrus-sasl-1.5.27.orig/aclocal.m4 Sat Mar 24 02:48:12 2001
50 +++ cyrus-sasl-1.5.27.ipv6/aclocal.m4 Thu Apr 26 18:33:48 2001
55 +dnl See whether we can use IPv6 related functions
56 +AC_DEFUN(IPv6_CHECK_FUNC, [
58 +ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
59 + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
61 +AC_CHECK_FUNC($1, [dnl
62 + AC_DEFINE_UNQUOTED($ac_tr_lib)
63 + ac_cv_lib_socket_$1=no
64 + ac_cv_lib_inet6_$1=no
66 + AC_CHECK_LIB(socket, $1, [dnl
67 + AC_DEFINE_UNQUOTED($ac_tr_lib)
68 + LIBS="$LIBS -lsocket"
69 + ac_cv_lib_inet6_$1=no
71 + AC_MSG_CHECKING([whether your system has IPv6 directory])
72 + AC_CACHE_VAL(ipv6_cv_dir, [dnl
73 + for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
74 + if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
78 + AC_MSG_RESULT($ipv6_cv_dir)
79 + if test $ipv6_cv_dir = no; then
80 + ac_cv_lib_inet6_$1=no
82 + if test x$ipv6_libinet6 = x; then
84 + SAVELDFLAGS="$LDFLAGS"
85 + LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
87 + AC_CHECK_LIB(inet6, $1, [dnl
88 + AC_DEFINE_UNQUOTED($ac_tr_lib)
89 + if test $ipv6_libinet6 = no; then
91 + LIBS="$LIBS -linet6"
93 + if test $ipv6_libinet6 = no; then
94 + LDFLAGS="$SAVELDFLAGS"
98 +if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \
99 + -o $ac_cv_lib_inet6_$1 = yes
102 + ifelse([$2], , :, [$2])
105 + ifelse([$3], , :, [$3])
109 +dnl See whether we have ss_family in sockaddr_storage
110 +AC_DEFUN(IPv6_CHECK_SS_FAMILY, [
111 +AC_MSG_CHECKING([whether you have ss_family in struct sockaddr_storage])
112 +AC_CACHE_VAL(ipv6_cv_ss_family, [dnl
113 +AC_TRY_COMPILE([#include <sys/types.h>
114 +#include <sys/socket.h>],
115 + [struct sockaddr_storage ss; int i = ss.ss_family;],
116 + [ipv6_cv_ss_family=yes], [ipv6_cv_ss_family=no])])dnl
117 +if test $ipv6_cv_ss_family = yes; then
118 + ifelse([$1], , AC_DEFINE(HAVE_SS_FAMILY), [$1])
120 + ifelse([$2], , :, [$2])
122 +AC_MSG_RESULT($ipv6_cv_ss_family)])
124 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/cmulocal/ipv6.m4 cyrus-sasl-1.5.27.ipv6/cmulocal/ipv6.m4
125 --- cyrus-sasl-1.5.27.orig/cmulocal/ipv6.m4 Thu Jan 1 01:00:00 1970
126 +++ cyrus-sasl-1.5.27.ipv6/cmulocal/ipv6.m4 Thu Apr 26 18:33:48 2001
128 +dnl See whether we can use IPv6 related functions
129 +AC_DEFUN(IPv6_CHECK_FUNC, [
131 +ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
132 + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
133 +changequote([, ])dnl
134 +AC_CHECK_FUNC($1, [dnl
135 + AC_DEFINE_UNQUOTED($ac_tr_lib)
136 + ac_cv_lib_socket_$1=no
137 + ac_cv_lib_inet6_$1=no
139 + AC_CHECK_LIB(socket, $1, [dnl
140 + AC_DEFINE_UNQUOTED($ac_tr_lib)
141 + LIBS="$LIBS -lsocket"
142 + ac_cv_lib_inet6_$1=no
144 + AC_MSG_CHECKING([whether your system has IPv6 directory])
145 + AC_CACHE_VAL(ipv6_cv_dir, [dnl
146 + for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
147 + if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
151 + AC_MSG_RESULT($ipv6_cv_dir)
152 + if test $ipv6_cv_dir = no; then
153 + ac_cv_lib_inet6_$1=no
155 + if test x$ipv6_libinet6 = x; then
157 + SAVELDFLAGS="$LDFLAGS"
158 + LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
160 + AC_CHECK_LIB(inet6, $1, [dnl
161 + AC_DEFINE_UNQUOTED($ac_tr_lib)
162 + if test $ipv6_libinet6 = no; then
164 + LIBS="$LIBS -linet6"
166 + if test $ipv6_libinet6 = no; then
167 + LDFLAGS="$SAVELDFLAGS"
171 +if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \
172 + -o $ac_cv_lib_inet6_$1 = yes
175 + ifelse([$2], , :, [$2])
178 + ifelse([$3], , :, [$3])
182 +dnl See whether we have ss_family in sockaddr_storage
183 +AC_DEFUN(IPv6_CHECK_SS_FAMILY, [
184 +AC_MSG_CHECKING([whether you have ss_family in struct sockaddr_storage])
185 +AC_CACHE_VAL(ipv6_cv_ss_family, [dnl
186 +AC_TRY_COMPILE([#include <sys/types.h>
187 +#include <sys/socket.h>],
188 + [struct sockaddr_storage ss; int i = ss.ss_family;],
189 + [ipv6_cv_ss_family=yes], [ipv6_cv_ss_family=no])])dnl
190 +if test $ipv6_cv_ss_family = yes; then
191 + ifelse([$1], , AC_DEFINE(HAVE_SS_FAMILY), [$1])
193 + ifelse([$2], , :, [$2])
195 +AC_MSG_RESULT($ipv6_cv_ss_family)])
196 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/config.h.in cyrus-sasl-1.5.27.ipv6/config.h.in
197 --- cyrus-sasl-1.5.27.orig/config.h.in Wed Mar 14 05:49:33 2001
198 +++ cyrus-sasl-1.5.27.ipv6/config.h.in Thu Apr 26 18:33:48 2001
200 /* do we have a preferred mechanism, or should we just pick the highest ssf? */
203 +/* define if your system has struct sockaddr_storage */
204 +#undef HAVE_SOCKADDR_STORAGE
206 /* Define if you have the getdomainname function. */
207 #undef HAVE_GETDOMAINNAME
210 #undef HAVE___ATTRIBUTE__
213 +/* define if your system has getnameinfo() */
214 +#undef HAVE_GETNAMEINFO
216 +/* Define if you have ss_family in struct sockaddr_storage. */
217 +#undef HAVE_SS_FAMILY
219 +/* do we have socklen_t? */
220 +#undef HAVE_SOCKLEN_T
222 /* location of the random number generator */
224 #define DEV_RANDOM "/dev/random"
229 +#if defined(HAVE_SOCKADDR_STORAGE) && defined(HAVE_GETNAMEINFO)
233 +#include <sys/socket.h>
234 +#ifndef NI_WITHSCOPEID
235 +#define NI_WITHSCOPEID 0
237 +#ifndef HAVE_SS_FAMILY
238 +#define ss_family __ss_family
241 #include <netinet/in.h>
243 +#ifndef HAVE_SOCKLEN_T
244 +typedef int socklen_t;
247 #endif /* CONFIG_H */
248 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/configure.in cyrus-sasl-1.5.27.ipv6/configure.in
249 --- cyrus-sasl-1.5.27.orig/configure.in Thu Apr 26 18:33:15 2001
250 +++ cyrus-sasl-1.5.27.ipv6/configure.in Thu Apr 26 19:24:16 2001
252 AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4")
255 +AC_ARG_ENABLE(ipv6, [ --disable-ipv6 Don't compile in IPv6 support],
256 + ipv6="$enableval", ipv6="yes")
257 +if test "$ipv6" != "yes"; then
258 + AC_MSG_RESULT(IPv6 support is disabled)
259 + SASL_IPVSIX="#undef SASL_IPV6"
261 + IPv6_CHECK_FUNC(getnameinfo)
262 + AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, [
263 + AC_DEFINE(HAVE_SOCKADDR_STORAGE)
264 + have_sockaddr_storage="yes" ])
265 + IPv6_CHECK_SS_FAMILY()
266 + if test "x$have_sockaddr_storage" = "xyes" -a "x$ac_cv_func_getnameinfo" = "xyes"; then
267 + SASL_IPVSIX="#define SASL_IPV6 1"
269 + SASL_IPVSIX="#undef SASL_IPV6"
272 +AC_SUBST(SASL_IPVSIX)
274 +AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_DEFINE(HAVE_SOCKLEN_T))
282 saslauthd/saslauthd.8
285 +include/saslconfig.h)
286 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/include/Makefile.am cyrus-sasl-1.5.27.ipv6/include/Makefile.am
287 --- cyrus-sasl-1.5.27.orig/include/Makefile.am Tue Mar 7 06:19:52 2000
288 +++ cyrus-sasl-1.5.27.ipv6/include/Makefile.am Thu Apr 26 18:44:08 2001
291 ################################################################
293 -include_HEADERS = hmac-md5.h md5.h md5global.h sasl.h saslplug.h saslutil.h
294 +include_HEADERS = hmac-md5.h md5.h md5global.h sasl.h saslplug.h saslutil.h saslconfig.h
296 noinst_PROGRAMS = makemd5
298 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/include/sasl.h cyrus-sasl-1.5.27.ipv6/include/sasl.h
299 --- cyrus-sasl-1.5.27.orig/include/sasl.h Thu Apr 26 18:33:15 2001
300 +++ cyrus-sasl-1.5.27.ipv6/include/sasl.h Thu Apr 26 18:35:58 2001
305 +#include <saslconfig.h>
307 #define SASL_VERSION_MAJOR 1
308 #define SASL_VERSION_MINOR 5
309 #define SASL_VERSION_STEP 27
310 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/include/saslconfig.h.in cyrus-sasl-1.5.27.ipv6/include/saslconfig.h.in
311 --- cyrus-sasl-1.5.27.orig/include/saslconfig.h.in Thu Jan 1 01:00:00 1970
312 +++ cyrus-sasl-1.5.27.ipv6/include/saslconfig.h.in Thu Apr 26 19:15:42 2001
314 +#ifndef SASLCONFIG_H
315 +#define SASLCONFIG_H
320 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/lib/checkpw.c cyrus-sasl-1.5.27.ipv6/lib/checkpw.c
321 --- cyrus-sasl-1.5.27.orig/lib/checkpw.c Thu Apr 26 18:33:15 2001
322 +++ cyrus-sasl-1.5.27.ipv6/lib/checkpw.c Thu Apr 26 18:33:48 2001
328 + struct sockaddr *addr;
331 struct sockaddr_in *addr;
333 char *argv[2], *argv0 = "SASL";
337 /* Get the remote host */
338 if (sasl_getprop(conn, SASL_IP_REMOTE, (void **) &addr) != SASL_OK)
344 + salen = addr->sa_len;
346 + salen = (addr->sa_family == AF_INET) ? sizeof(struct sockaddr_in)
347 + : sizeof(struct sockaddr_in6);
349 + getnameinfo(addr, salen, hbuf, sizeof(hbuf), NULL, 0,
350 + NI_NUMERICHOST | NI_WITHSCOPEID);
353 host = inet_ntoa(*addr);
357 /* Try to validate */
358 if (sia_ses_init (&ent, 1, argv, host, userid, NULL, 0, NULL) != SIASUCCESS)
359 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/lib/common.c cyrus-sasl-1.5.27.ipv6/lib/common.c
360 --- cyrus-sasl-1.5.27.orig/lib/common.c Thu Apr 26 18:33:15 2001
361 +++ cyrus-sasl-1.5.27.ipv6/lib/common.c Thu Apr 26 18:33:48 2001
362 @@ -359,13 +359,21 @@
363 if (! conn->got_ip_local)
364 result = SASL_NOTDONE;
367 + *(struct sockaddr **)pvalue = (struct sockaddr *)&conn->ip_local;
369 *(struct sockaddr_in **)pvalue = &conn->ip_local;
373 if (! conn->got_ip_remote)
374 result = SASL_NOTDONE;
377 + *(struct sockaddr **)pvalue = (struct sockaddr *)&conn->ip_remote;
379 *(struct sockaddr_in **)pvalue = &conn->ip_remote;
383 result = SASL_BADPARAM;
386 int result = SASL_OK;
393 /* make sure the sasl context is valid */
395 @@ -413,12 +425,40 @@
396 sizeof(sasl_security_properties_t));
399 - conn->got_ip_local = 1;
401 + /* XXX: Yes, this is ugly. But, there is such code, eg. testsuite.c */
402 + family = ((struct sockaddr *)value)->sa_family;
403 + if (family!= AF_INET && family != AF_INET6)
405 + salen = (family == AF_INET) ? sizeof(struct sockaddr_in)
406 + : sizeof(struct sockaddr_in6);
407 + memcpy(&conn->ip_local, value, salen);
408 + conn->ip_local.ss_family = family;
410 + conn->ip_local.ss_len = salen;
413 conn->ip_local= *(struct sockaddr_in *) value;
415 + conn->got_ip_local = 1;
418 - conn->got_ip_remote = 1;
420 + /* XXX: Yes, this is ugly. But, there is such code, eg. testsuite.c */
421 + family = ((struct sockaddr *)value)->sa_family;
422 + if (family!= AF_INET && family != AF_INET6)
424 + salen = (family == AF_INET) ? sizeof(struct sockaddr_in)
425 + : sizeof(struct sockaddr_in6);
426 + memcpy(&conn->ip_remote, value, salen);
427 + conn->ip_remote.ss_family = family;
429 + conn->ip_remote.ss_len = salen;
432 conn->ip_remote= *(struct sockaddr_in *) value;
434 + conn->got_ip_remote = 1;
437 result = SASL_BADPARAM;
438 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/lib/saslint.h cyrus-sasl-1.5.27.ipv6/lib/saslint.h
439 --- cyrus-sasl-1.5.27.orig/lib/saslint.h Thu Apr 26 18:33:15 2001
440 +++ cyrus-sasl-1.5.27.ipv6/lib/saslint.h Thu Apr 26 18:33:48 2001
443 int secflags; /* security layer flags passed to sasl_*_new */
444 int got_ip_local, got_ip_remote;
446 + struct sockaddr_storage ip_local, ip_remote;
448 struct sockaddr_in ip_local, ip_remote;
450 sasl_external_properties_t external;
453 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/plugins/anonymous.c cyrus-sasl-1.5.27.ipv6/plugins/anonymous.c
454 --- cyrus-sasl-1.5.27.orig/plugins/anonymous.c Sat Mar 10 06:56:44 2001
455 +++ cyrus-sasl-1.5.27.ipv6/plugins/anonymous.c Thu Apr 26 18:33:48 2001
461 + struct sockaddr *remote_addr;
463 struct sockaddr_in *remote_addr;
469 SASL_IP_REMOTE, (void **)&remote_addr);
471 if (result==SASL_OK) {
474 + char hbuf[NI_MAXHOST];
477 + salen = remote_addr->sa_len;
479 + salen = (remote_addr->sa_family == AF_INET)
480 + ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
482 + getnameinfo(remote_addr, salen, hbuf, sizeof(hbuf), NULL, 0,
483 + NI_NUMERICHOST | NI_WITHSCOPEID);
484 + sparams->utils->log(sparams->utils->conn,
487 + "login: \"%s\" from [%s]", clientdata, hbuf);
489 int ipnum = remote_addr->sin_addr.s_addr;
491 sparams->utils->log(sparams->utils->conn,
498 sparams->utils->log(sparams->utils->conn,
500 diff -ruN --exclude *.orig --exclude configure cyrus-sasl-1.5.27.orig/plugins/kerberos4.c cyrus-sasl-1.5.27.ipv6/plugins/kerberos4.c
501 --- cyrus-sasl-1.5.27.orig/plugins/kerberos4.c Thu Apr 26 18:33:15 2001
502 +++ cyrus-sasl-1.5.27.ipv6/plugins/kerberos4.c Thu Apr 26 18:33:48 2001
503 @@ -131,10 +131,17 @@
504 des_key_schedule dec_keysched; /* decryption key schedule */
508 + struct sockaddr *ip_local; /* local ip address and port.
509 + needed for layers */
510 + struct sockaddr *ip_remote; /* remote ip address and port.
511 + needed for layers */
513 struct sockaddr_in *ip_local; /* local ip address and port.
515 struct sockaddr_in *ip_remote; /* remote ip address and port.
519 sasl_malloc_t *malloc; /* encode and decode need these */
520 sasl_realloc_t *realloc;
526 + struct sockaddr *addr;
528 struct sockaddr_in *addr;
531 VL(("KERBEROS_V4 Step 2\n"));
538 + if (addr->sa_family != AF_INET) {
540 + *errstr = "unsupported address family";
541 + return SASL_BADAUTH;
545 result = krb_rd_req(&ticket, (char *) sparams->service, text->instance,
546 - addr ? addr->sin_addr.s_addr : 0L, &ad, srvtab);
547 + addr ? ((struct sockaddr_in *)addr)->sin_addr.s_addr
548 + : 0L, &ad, srvtab);
550 if (result) { /* if fails mechanism fails */
551 VL(("krb_rd_req failed service=%s instance=%s error code=%i\n",