]>
Commit | Line | Data |
---|---|---|
eb35c262 AF |
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 | |
63acf4af AF |
4 | @@ -137,8 +137,20 @@ |
5 | /* define if your system has getpid() */ | |
6 | #undef HAVE_GETPID | |
7 | ||
8 | +/* define if your system has struct sockaddr_storage */ | |
9 | +#undef HAVE_SOCKADDR_STORAGE | |
10 | + | |
11 | @BOTTOM@ | |
12 | ||
13 | +/* define if your system has getnameinfo() */ | |
14 | +#undef HAVE_GETNAMEINFO | |
15 | + | |
16 | +/* Define if you have ss_family in struct sockaddr_storage. */ | |
17 | +#undef HAVE_SS_FAMILY | |
18 | + | |
19 | +/* do we have socklen_t? */ | |
20 | +#undef HAVE_SOCKLEN_T | |
21 | + | |
22 | /* location of the random number generator */ | |
23 | #ifndef DEV_RANDOM | |
24 | #define DEV_RANDOM "/dev/random" | |
25 | @@ -181,6 +193,22 @@ | |
26 | #endif /* WIN32 */ | |
27 | #include <string.h> | |
28 | ||
29 | +#if defined(HAVE_SOCKADDR_STORAGE) && defined(HAVE_GETNAMEINFO) | |
30 | +#define INET6 | |
31 | +#endif | |
32 | +#ifdef INET6 | |
33 | +#include <sys/socket.h> | |
34 | +#ifndef NI_WITHSCOPEID | |
35 | +#define NI_WITHSCOPEID 0 | |
36 | +#endif | |
37 | +#ifndef HAVE_SS_FAMILY | |
38 | +#define ss_family __ss_family | |
39 | +#endif | |
40 | +#endif | |
41 | #include <netinet/in.h> | |
42 | + | |
43 | +#ifndef HAVE_SOCKLEN_T | |
44 | +typedef int socklen_t; | |
45 | +#endif | |
46 | ||
47 | #endif /* CONFIG_H */ | |
eb35c262 AF |
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 | |
63acf4af AF |
51 | @@ -692,3 +692,72 @@ |
52 | AC_SUBST(LIB_SOCKET) | |
53 | ]) | |
54 | ||
55 | +dnl See whether we can use IPv6 related functions | |
56 | +AC_DEFUN(IPv6_CHECK_FUNC, [ | |
57 | +changequote(, )dnl | |
58 | +ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ | |
59 | + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` | |
60 | +changequote([, ])dnl | |
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 | |
65 | +], [dnl | |
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 | |
70 | + ], [dnl | |
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 | |
75 | + break | |
76 | + fi | |
77 | + done])dnl | |
78 | + AC_MSG_RESULT($ipv6_cv_dir) | |
79 | + if test $ipv6_cv_dir = no; then | |
80 | + ac_cv_lib_inet6_$1=no | |
81 | + else | |
82 | + if test x$ipv6_libinet6 = x; then | |
83 | + ipv6_libinet6=no | |
84 | + SAVELDFLAGS="$LDFLAGS" | |
85 | + LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" | |
86 | + fi | |
87 | + AC_CHECK_LIB(inet6, $1, [dnl | |
88 | + AC_DEFINE_UNQUOTED($ac_tr_lib) | |
89 | + if test $ipv6_libinet6 = no; then | |
90 | + ipv6_libinet6=yes | |
91 | + LIBS="$LIBS -linet6" | |
92 | + fi],)dnl | |
93 | + if test $ipv6_libinet6 = no; then | |
94 | + LDFLAGS="$SAVELDFLAGS" | |
95 | + fi | |
96 | + fi])dnl | |
97 | +])dnl | |
98 | +if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \ | |
99 | + -o $ac_cv_lib_inet6_$1 = yes | |
100 | +then | |
101 | + ipv6_cv_$1=yes | |
102 | + ifelse([$2], , :, [$2]) | |
103 | +else | |
104 | + ipv6_cv_$1=no | |
105 | + ifelse([$3], , :, [$3]) | |
106 | +fi]) | |
107 | + | |
108 | + | |
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]) | |
119 | +else | |
120 | + ifelse([$2], , :, [$2]) | |
121 | +fi | |
122 | +AC_MSG_RESULT($ipv6_cv_ss_family)]) | |
123 | + | |
eb35c262 AF |
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 | |
63acf4af AF |
127 | @@ -0,0 +1,68 @@ |
128 | +dnl See whether we can use IPv6 related functions | |
129 | +AC_DEFUN(IPv6_CHECK_FUNC, [ | |
130 | +changequote(, )dnl | |
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 | |
138 | +], [dnl | |
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 | |
143 | + ], [dnl | |
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 | |
148 | + break | |
149 | + fi | |
150 | + done])dnl | |
151 | + AC_MSG_RESULT($ipv6_cv_dir) | |
152 | + if test $ipv6_cv_dir = no; then | |
153 | + ac_cv_lib_inet6_$1=no | |
154 | + else | |
155 | + if test x$ipv6_libinet6 = x; then | |
156 | + ipv6_libinet6=no | |
157 | + SAVELDFLAGS="$LDFLAGS" | |
158 | + LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" | |
159 | + fi | |
160 | + AC_CHECK_LIB(inet6, $1, [dnl | |
161 | + AC_DEFINE_UNQUOTED($ac_tr_lib) | |
162 | + if test $ipv6_libinet6 = no; then | |
163 | + ipv6_libinet6=yes | |
164 | + LIBS="$LIBS -linet6" | |
165 | + fi],)dnl | |
166 | + if test $ipv6_libinet6 = no; then | |
167 | + LDFLAGS="$SAVELDFLAGS" | |
168 | + fi | |
169 | + fi])dnl | |
170 | +])dnl | |
171 | +if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \ | |
172 | + -o $ac_cv_lib_inet6_$1 = yes | |
173 | +then | |
174 | + ipv6_cv_$1=yes | |
175 | + ifelse([$2], , :, [$2]) | |
176 | +else | |
177 | + ipv6_cv_$1=no | |
178 | + ifelse([$3], , :, [$3]) | |
179 | +fi]) | |
180 | + | |
181 | + | |
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]) | |
192 | +else | |
193 | + ifelse([$2], , :, [$2]) | |
194 | +fi | |
195 | +AC_MSG_RESULT($ipv6_cv_ss_family)]) | |
eb35c262 AF |
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 | |
63acf4af AF |
199 | @@ -119,6 +119,9 @@ |
200 | /* do we have a preferred mechanism, or should we just pick the highest ssf? */ | |
201 | #undef PREFER_MECH | |
202 | ||
203 | +/* define if your system has struct sockaddr_storage */ | |
204 | +#undef HAVE_SOCKADDR_STORAGE | |
205 | + | |
206 | /* Define if you have the getdomainname function. */ | |
207 | #undef HAVE_GETDOMAINNAME | |
208 | ||
209 | @@ -198,6 +201,15 @@ | |
210 | #undef HAVE___ATTRIBUTE__ | |
211 | ||
212 | ||
213 | +/* define if your system has getnameinfo() */ | |
214 | +#undef HAVE_GETNAMEINFO | |
215 | + | |
216 | +/* Define if you have ss_family in struct sockaddr_storage. */ | |
217 | +#undef HAVE_SS_FAMILY | |
218 | + | |
219 | +/* do we have socklen_t? */ | |
220 | +#undef HAVE_SOCKLEN_T | |
221 | + | |
222 | /* location of the random number generator */ | |
223 | #ifndef DEV_RANDOM | |
224 | #define DEV_RANDOM "/dev/random" | |
225 | @@ -239,6 +251,22 @@ | |
226 | #endif /* WIN32 */ | |
227 | #include <string.h> | |
228 | ||
229 | +#if defined(HAVE_SOCKADDR_STORAGE) && defined(HAVE_GETNAMEINFO) | |
230 | +#define INET6 | |
231 | +#endif | |
232 | +#ifdef INET6 | |
233 | +#include <sys/socket.h> | |
234 | +#ifndef NI_WITHSCOPEID | |
235 | +#define NI_WITHSCOPEID 0 | |
236 | +#endif | |
237 | +#ifndef HAVE_SS_FAMILY | |
238 | +#define ss_family __ss_family | |
239 | +#endif | |
240 | +#endif | |
241 | #include <netinet/in.h> | |
242 | + | |
243 | +#ifndef HAVE_SOCKLEN_T | |
244 | +typedef int socklen_t; | |
245 | +#endif | |
246 | ||
247 | #endif /* CONFIG_H */ | |
eb35c262 AF |
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 | |
251 | @@ -782,6 +782,27 @@ | |
63acf4af AF |
252 | AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4") |
253 | fi | |
254 | ||
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) | |
eb35c262 | 259 | + SASL_IPVSIX="#undef SASL_IPV6" |
63acf4af AF |
260 | +else |
261 | + IPv6_CHECK_FUNC(getnameinfo) | |
eb35c262 AF |
262 | + AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, [ |
263 | + AC_DEFINE(HAVE_SOCKADDR_STORAGE) | |
264 | + have_sockaddr_storage="yes" ]) | |
63acf4af | 265 | + IPv6_CHECK_SS_FAMILY() |
eb35c262 AF |
266 | + if test "x$have_sockaddr_storage" = "xyes" -a "x$ac_cv_func_getnameinfo" = "xyes"; then |
267 | + SASL_IPVSIX="#define SASL_IPV6 1" | |
268 | + else | |
269 | + SASL_IPVSIX="#undef SASL_IPV6" | |
270 | + fi | |
63acf4af | 271 | +fi |
eb35c262 | 272 | +AC_SUBST(SASL_IPVSIX) |
63acf4af AF |
273 | + |
274 | +AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_DEFINE(HAVE_SOCKLEN_T)) | |
275 | + | |
276 | AC_SUBST(DIRS) | |
277 | ||
278 | AC_OUTPUT(Makefile | |
eb35c262 AF |
279 | @@ -800,4 +821,5 @@ |
280 | pwcheck/Makefile | |
281 | saslauthd/Makefile | |
282 | saslauthd/saslauthd.8 | |
283 | -man/Makefile) | |
284 | +man/Makefile | |
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 | |
289 | @@ -42,7 +42,7 @@ | |
290 | # | |
291 | ################################################################ | |
292 | ||
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 | |
295 | ||
296 | noinst_PROGRAMS = makemd5 | |
297 | ||
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 | |
301 | @@ -88,6 +88,8 @@ | |
302 | #ifndef SASL_H | |
303 | #define SASL_H 1 | |
304 | ||
305 | +#include <saslconfig.h> | |
306 | + | |
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 | |
313 | @@ -0,0 +1,6 @@ | |
314 | +#ifndef SASLCONFIG_H | |
315 | +#define SASLCONFIG_H | |
316 | + | |
317 | +@SASL_IPVSIX@ | |
318 | + | |
319 | +#endif | |
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 | |
63acf4af AF |
323 | @@ -571,7 +571,12 @@ |
324 | const char **reply) | |
325 | { | |
326 | char *host; | |
327 | +#ifdef INET6 | |
328 | + struct sockaddr *addr; | |
329 | + socklen_t salen; | |
330 | +#else | |
331 | struct sockaddr_in *addr; | |
332 | +#endif | |
333 | char *argv[2], *argv0 = "SASL"; | |
334 | SIAENTITY *ent; | |
335 | int ret; | |
336 | @@ -586,8 +591,21 @@ | |
337 | /* Get the remote host */ | |
338 | if (sasl_getprop(conn, SASL_IP_REMOTE, (void **) &addr) != SASL_OK) | |
339 | host = NULL; | |
340 | - else | |
341 | + else { | |
342 | +#ifdef INET6 | |
343 | +#ifdef SIN6_LEN | |
344 | + salen = addr->sa_len; | |
345 | +#else | |
346 | + salen = (addr->sa_family == AF_INET) ? sizeof(struct sockaddr_in) | |
347 | + : sizeof(struct sockaddr_in6); | |
348 | +#endif | |
349 | + getnameinfo(addr, salen, hbuf, sizeof(hbuf), NULL, 0, | |
350 | + NI_NUMERICHOST | NI_WITHSCOPEID); | |
351 | + host = hbuf; | |
352 | +#else | |
353 | host = inet_ntoa(*addr); | |
354 | +#endif | |
355 | + } | |
356 | ||
357 | /* Try to validate */ | |
358 | if (sia_ses_init (&ent, 1, argv, host, userid, NULL, 0, NULL) != SIASUCCESS) | |
eb35c262 AF |
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 | |
63acf4af AF |
362 | @@ -359,13 +359,21 @@ |
363 | if (! conn->got_ip_local) | |
364 | result = SASL_NOTDONE; | |
365 | else | |
366 | +#ifdef INET6 | |
367 | + *(struct sockaddr **)pvalue = (struct sockaddr *)&conn->ip_local; | |
368 | +#else | |
369 | *(struct sockaddr_in **)pvalue = &conn->ip_local; | |
370 | +#endif | |
371 | break; | |
372 | case SASL_IP_REMOTE: | |
373 | if (! conn->got_ip_remote) | |
374 | result = SASL_NOTDONE; | |
375 | else | |
376 | +#ifdef INET6 | |
377 | + *(struct sockaddr **)pvalue = (struct sockaddr *)&conn->ip_remote; | |
378 | +#else | |
379 | *(struct sockaddr_in **)pvalue = &conn->ip_remote; | |
380 | +#endif | |
381 | break; | |
382 | default: | |
383 | result = SASL_BADPARAM; | |
384 | @@ -382,6 +390,10 @@ | |
385 | { | |
386 | int result = SASL_OK; | |
387 | char *str; | |
388 | +#ifdef INET6 | |
389 | + int family; | |
390 | + socklen_t salen; | |
391 | +#endif | |
392 | ||
393 | /* make sure the sasl context is valid */ | |
394 | if (!conn) | |
395 | @@ -413,12 +425,40 @@ | |
396 | sizeof(sasl_security_properties_t)); | |
397 | break; | |
398 | case SASL_IP_LOCAL: | |
399 | - conn->got_ip_local = 1; | |
400 | +#ifdef INET6 | |
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) | |
404 | + family = AF_INET; | |
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; | |
409 | +#ifdef SIN6_LEN | |
410 | + conn->ip_local.ss_len = salen; | |
411 | +#endif | |
412 | +#else | |
413 | conn->ip_local= *(struct sockaddr_in *) value; | |
414 | +#endif | |
415 | + conn->got_ip_local = 1; | |
416 | break; | |
417 | case SASL_IP_REMOTE: | |
418 | - conn->got_ip_remote = 1; | |
419 | +#ifdef INET6 | |
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) | |
423 | + family = AF_INET; | |
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; | |
428 | +#ifdef SIN6_LEN | |
429 | + conn->ip_remote.ss_len = salen; | |
430 | +#endif | |
431 | +#else | |
432 | conn->ip_remote= *(struct sockaddr_in *) value; | |
433 | +#endif | |
434 | + conn->got_ip_remote = 1; | |
435 | break; | |
436 | default: | |
437 | result = SASL_BADPARAM; | |
eb35c262 AF |
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 | |
63acf4af AF |
441 | @@ -95,7 +95,11 @@ |
442 | ||
443 | int secflags; /* security layer flags passed to sasl_*_new */ | |
444 | int got_ip_local, got_ip_remote; | |
445 | +#ifdef INET6 | |
446 | + struct sockaddr_storage ip_local, ip_remote; | |
447 | +#else | |
448 | struct sockaddr_in ip_local, ip_remote; | |
449 | +#endif | |
450 | sasl_external_properties_t external; | |
451 | ||
452 | void *context; | |
eb35c262 AF |
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 | |
63acf4af AF |
456 | @@ -101,7 +101,11 @@ |
457 | const char **errstr) | |
458 | { | |
459 | int result; | |
460 | +#ifdef INET6 | |
461 | + struct sockaddr *remote_addr; | |
462 | +#else | |
463 | struct sockaddr_in *remote_addr; | |
464 | +#endif | |
465 | char *clientdata; | |
466 | ||
467 | if (!sparams | |
468 | @@ -133,6 +137,23 @@ | |
469 | SASL_IP_REMOTE, (void **)&remote_addr); | |
470 | ||
471 | if (result==SASL_OK) { | |
472 | +#ifdef INET6 | |
473 | + socklen_t salen; | |
474 | + char hbuf[NI_MAXHOST]; | |
475 | + | |
476 | +#ifdef SIN6_LEN | |
477 | + salen = remote_addr->sa_len; | |
478 | +#else | |
479 | + salen = (remote_addr->sa_family == AF_INET) | |
480 | + ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); | |
481 | +#endif | |
482 | + getnameinfo(remote_addr, salen, hbuf, sizeof(hbuf), NULL, 0, | |
483 | + NI_NUMERICHOST | NI_WITHSCOPEID); | |
484 | + sparams->utils->log(sparams->utils->conn, | |
485 | + SASL_LOG_INFO, | |
486 | + "ANONYMOUS", 0, 0, | |
487 | + "login: \"%s\" from [%s]", clientdata, hbuf); | |
488 | +#else | |
489 | int ipnum = remote_addr->sin_addr.s_addr; | |
490 | ||
491 | sparams->utils->log(sparams->utils->conn, | |
492 | @@ -144,6 +165,7 @@ | |
493 | ipnum >> 16 & 0xFF, | |
494 | ipnum >> 8 &0xFF, | |
495 | ipnum & 0xFF); | |
496 | +#endif | |
497 | } else { | |
498 | sparams->utils->log(sparams->utils->conn, | |
499 | SASL_LOG_INFO, | |
eb35c262 AF |
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 | |
63acf4af AF |
503 | @@ -131,10 +131,17 @@ |
504 | des_key_schedule dec_keysched; /* decryption key schedule */ | |
505 | ||
506 | ||
507 | +#ifdef INET6 | |
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 */ | |
512 | +#else | |
513 | struct sockaddr_in *ip_local; /* local ip address and port. | |
514 | needed for layers */ | |
515 | struct sockaddr_in *ip_remote; /* remote ip address and port. | |
516 | needed for layers */ | |
517 | +#endif | |
518 | ||
519 | sasl_malloc_t *malloc; /* encode and decode need these */ | |
520 | sasl_realloc_t *realloc; | |
521 | @@ -580,7 +587,11 @@ | |
522 | AUTH_DAT ad; | |
523 | KTEXT_ST ticket; | |
524 | int lup; | |
525 | +#ifdef INET6 | |
526 | + struct sockaddr *addr; | |
527 | +#else | |
528 | struct sockaddr_in *addr; | |
529 | +#endif | |
530 | ||
531 | VL(("KERBEROS_V4 Step 2\n")); | |
532 | ||
533 | @@ -619,9 +630,17 @@ | |
534 | return SASL_BADAUTH; | |
535 | } | |
536 | #endif | |
537 | +#ifdef INET6 | |
538 | + if (addr->sa_family != AF_INET) { | |
539 | + if (errstr) | |
540 | + *errstr = "unsupported address family"; | |
541 | + return SASL_BADAUTH; | |
542 | + } | |
543 | +#endif | |
544 | /* check ticket */ | |
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); | |
549 | ||
550 | if (result) { /* if fails mechanism fails */ | |
551 | VL(("krb_rd_req failed service=%s instance=%s error code=%i\n", |