Make it build on non-IPv6-aware systems.
authoraland <aland>
Wed, 27 Apr 2005 10:51:10 +0000 (10:51 +0000)
committeraland <aland>
Wed, 27 Apr 2005 10:51:10 +0000 (10:51 +0000)
Note that we now depend on HAVE_STRUCT_SOCKADDR_IN6, which I'll
have to add to "configure", once I have access to a real machine

14 files changed:
src/lib/crypt.c
src/lib/dict.c
src/lib/filters.c
src/lib/hmac.c
src/lib/hmacsha1.c
src/lib/isaac.c
src/lib/log.c
src/lib/misc.c
src/lib/missing.c
src/lib/print.c
src/lib/radius.c
src/lib/rbtree.c
src/lib/sha1.c
src/lib/valuepair.c

index 447e5e5..da773ba 100644 (file)
@@ -18,7 +18,7 @@
  * Copyright 2000  The FreeRADIUS server project
  */
 
-#include "libradius.h"
+#include "autoconf.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
@@ -37,6 +37,9 @@ static int lrad_crypt_init = 0;
 static pthread_mutex_t lrad_crypt_mutex;
 #endif
 
+#include "missing.h"
+#include "libradius.h"
+
 /*
  * performs a crypt password check in an thread-safe way.
  *
index aca435e..b0376d5 100644 (file)
@@ -32,8 +32,8 @@ static const char rcsid[] = "$Id$";
 #include       <malloc.h>
 #endif
 
-#include       "libradius.h"
 #include       "missing.h"
+#include       "libradius.h"
 
 /*
  *     There are very few vendors, and they're looked up only when we
index 4a2170d..892b727 100644 (file)
 
 static const char rcsid[] = "$Id$";
 
+#include "autoconf.h"
+
 #include <string.h>
 #include <ctype.h>
 #include <stdlib.h>
 
-#include "libradius.h"
 
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
 
+#include "missing.h"
+#include "libradius.h"
+
 /*
  * Two types of filters are supported, GENERIC and IP.  The identifiers
  * are:
index e4f3228..d44608f 100644 (file)
 /*
 ** Function: hmac_md5
 */
+#include "autoconf.h"
 
 #include <string.h>
 #include "md5.h"
+#include "missing.h"
 #include "libradius.h"
 
 /*
index ba45a9d..a1aba70 100644 (file)
 
 #include <string.h>
 #include <sys/types.h>
-#include "libradius.h"
 #include "sha1.h"
 
+#include "missing.h"
+#include "libradius.h"
+
 /*
 unsigned char*  text;                pointer to data stream
 int             text_len;            length of data stream
index e19dc05..f94a8ee 100644 (file)
@@ -11,6 +11,7 @@ MODIFIED:
 */
 
 #include "autoconf.h"
+#include "missing.h"
 #include "libradius.h"
 
 #define RANDSIZL   (8)  /* I recommend 8 for crypto, 4 for simulations */
index 7dba7ac..b44f2f6 100644 (file)
@@ -30,6 +30,7 @@ static const char rcsid[] = "$Id$";
 #include <stdarg.h>
 #include <string.h>
 
+#include "missing.h"
 #include "libradius.h"
 
 char librad_errstr[1024];
index 172e089..ec33c8e 100644 (file)
@@ -39,8 +39,8 @@ static const char rcsid[] =
 #include       <fcntl.h>
 #include       <unistd.h>
 
-#include       "libradius.h"
 #include       "missing.h"
+#include       "libradius.h"
 
 int            librad_dodns = 0;
 int            librad_debug = 0;
index 59357ee..32d33bf 100644 (file)
@@ -33,8 +33,8 @@ static const char rcsid[] = "$Id$";
 #include       <arpa/inet.h>
 #include       <ctype.h>
 
-#include       "libradius.h"
 #include       "missing.h"
+#include       "libradius.h"
 
 #ifndef HAVE_CRYPT
 char *crypt(char *key, char *salt)
index 8f757c4..6ff6063 100644 (file)
@@ -30,6 +30,7 @@ static const char rcsid[] = "$Id$";
 #include       <ctype.h>
 #include       <string.h>
 
+#include       "missing.h"
 #include       "libradius.h"
 
 /*
index 97aecf0..44d3f7f 100644 (file)
@@ -35,7 +35,6 @@ static const char rcsid[] = "$Id$";
 #include       <string.h>
 #include       <ctype.h>
 
-#include       "libradius.h"
 #ifdef WITH_UDPFROMTO
 #include       "udpfromto.h"
 #endif
@@ -54,6 +53,9 @@ static const char rcsid[] = "$Id$";
 #include       <process.h>
 #endif
 
+#include       "missing.h"
+#include       "libradius.h"
+
 /*
  *  The RFC says 4096 octets max, and most packets are less than 256.
  */
@@ -161,14 +163,14 @@ static int rad_sendto(int sockfd, void *data, size_t data_len, int flags,
        const struct sockaddr   *dst;
        socklen_t               sizeof_dst;
        struct  sockaddr_in     saremote;
-#ifdef AF_INET6
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
        struct sockaddr_in6     saremote6;
 #endif
 #ifdef WITH_UDPFROMTO
        struct sockaddr_in      salocal;
        const struct sockaddr   *src;
        socklen_t               sizeof_src;
-#ifdef AF_INET6
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
        struct sockaddr_in6     salocal6;
 #endif
 #endif
@@ -207,7 +209,7 @@ static int rad_sendto(int sockfd, void *data, size_t data_len, int flags,
                src_ipaddr = src_ipaddr; /* -Wunused */
 #endif
        }
-#ifdef AF_INET6
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
        /*
         *      IPv6 MAY be supported.
         */
@@ -257,7 +259,7 @@ static ssize_t rad_recvfrom(int sockfd, void *buf, size_t len, int flags,
        struct sockaddr_in      salocal;
        socklen_t               salen;
        struct sockaddr_in      saremote;
-#ifdef AF_INET6
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
        struct sockaddr_in6     saremote6;
        struct sockaddr_in6     salocal6;
 #endif
@@ -280,6 +282,7 @@ static ssize_t rad_recvfrom(int sockfd, void *buf, size_t len, int flags,
                dst = (struct sockaddr *) &salocal;
                sizeof_dst = sizeof(salocal);
 
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
        } else if (salocal.sin_family == AF_INET6) {
                memcpy(&salocal6, &salocal, sizeof(salocal6));
                
@@ -294,6 +297,7 @@ static ssize_t rad_recvfrom(int sockfd, void *buf, size_t len, int flags,
 #ifdef WITH_UDPFROMTO
                return -1;      /* not supported for IPv6 */
 #endif
+#endif
        }
 
        /*
@@ -328,7 +332,7 @@ static ssize_t rad_recvfrom(int sockfd, void *buf, size_t len, int flags,
                src_ipaddr->ipaddr.ip4addr = saremote.sin_addr;
                *src_port = ntohs(saremote.sin_port);
        }
-#ifdef AF_INET6
+#ifdef HVAE_STRUCT_SOCKADDR_IN6
        else if (dst_ipaddr->af == AF_INET6) {
                src_ipaddr->af = AF_INET6;
 #ifdef WITH_UDPFROMTO
index a079610..663579d 100644 (file)
@@ -27,6 +27,7 @@ static const char rcsid[] = "$Id$";
 #include <stdlib.h>
 #include <string.h>
 
+#include "missing.h"
 #include "libradius.h"
 
 /* red-black tree description */
index 534c24a..dd18c3d 100644 (file)
 #include <stdint.h>
 #endif
 
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
 #include "../include/sha1.h"
 
 #define blk0(i) (block->l[i] = htonl(block->l[i]))
index 5c6e3a1..52995af 100644 (file)
@@ -31,8 +31,6 @@ static const char rcsid[] = "$Id$";
 #include       <string.h>
 #include       <ctype.h>
 
-#include       "libradius.h"
-
 #ifdef HAVE_MALLOC_H
 #  include     <malloc.h>
 #endif
@@ -42,6 +40,7 @@ static const char rcsid[] = "$Id$";
 #endif
 
 #include       "missing.h"
+#include       "libradius.h"
 
 static const char *months[] = {
         "jan", "feb", "mar", "apr", "may", "jun",