INCLUDE =
CFLAGS = $(INCLUDE) @CFLAGS@
LDFLAGS = @LDFLAGS@
+RDYNAMIC = @RDYNAMIC@
LCRYPT = @CRYPTLIB@
LDBM = @DBMLIB@
snprintf \
vsnprintf \
setsid \
+ strncasecmp \
+ strcasecmp \
+ inet_aton \
+ gethostname \
+ setlinebuf \
)
dnl Check for socklen_t
AC_DEFINE(HAVE_SOCKLEN_T),
)
+dnl Check if the C compiler supports -rdynamic
+AC_MSG_CHECKING(whether $CC accepts -rdynamic...)
+OFLAGS="$CLAGS"
+CFLAGS="$CFLAGS -rdynamic"
+AC_TRY_COMPILE([], [int x = 0],RDYNAMIC=-rdynamic)
+AC_SUBST(RDYNAMIC)
+if test -n "$RDYNAMIC"; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+CFLAGS="$OFLAGS"
+
dnl Check for libcrypt
dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
AC_CHECK_LIB(crypt, crypt,
/* Make dictionary case-independant */
#undef WITH_DICT_NOCASE
+/* Define if you have the gethostname function. */
+#undef HAVE_GETHOSTNAME
+
/* Define if you have the getopt_long function. */
#undef HAVE_GETOPT_LONG
+/* Define if you have the inet_aton function. */
+#undef HAVE_INET_ATON
+
/* Define if you have the lockf function. */
#undef HAVE_LOCKF
+/* Define if you have the setlinebuf function. */
+#undef HAVE_SETLINEBUF
+
/* Define if you have the setsid function. */
#undef HAVE_SETSID
/* Define if you have the snprintf function. */
#undef HAVE_SNPRINTF
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the strncasecmp function. */
+#undef HAVE_STRNCASECMP
+
/* Define if you have the strsignal function. */
#undef HAVE_STRSIGNAL
char *crypt(char *key, char *salt);
#endif
-#ifdef __EMX__
-#define OS2
-/* EMX does not have SIGIOT */
-#define SIGIOT SIGTERM
+#ifndef HAVE_STRNCASECMP
+int strncasecmp(char *s1, char *s2, int n);
+#endif
-/* EMX does not have this functions and must be implemented */
-#define strncasecmp strncmp
-#define strcasecmp strcmp
-#define inet_aton(x,y) 0
-#define setlinebuf(x) 0
-#define gethostname(x,y) strncpy(x,getenv("HOSTNAME"),y)
+#ifndef HAVE_STRCASECMP
+int strcasecmp(char *s1, char *s2);
+#endif
+
+#ifndef HAVE_INET_ATON
+struct in_addr;
+int inet_aton(char *cp, struct in_addr *inp);
+#endif
+
+#ifndef HAVE_GETHOSTNAME
+int gethostname(char *name, int len);
+#endif
+#ifndef HAVE_SETLINEBUF
+#define setlinebuf(x) 0
#endif
#endif
#include "libradius.h"
-#include "missing.h"
+#include "missing.h"
static DICT_ATTR *dictionary_attributes;
static DICT_VALUE *dictionary_values;
/*
* misc.c Various miscellaneous functions.
*
- * Version: @(#)misc.c 1.00 19-Jul-1999 miquels@cistron.nl
+ * Version: $Id$
*/
-char misc_sccsid[] =
-"@(#)misc.c 1.00 Copyright 1999 Cistron Internet Services B.V.";
+static const char rcsid[] =
+"$Id$";
#include "autoconf.h"
+#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <signal.h>
#include "libradius.h"
-#include "missing.h"
+#include "missing.h"
int librad_dodns = 1;
int librad_debug = 0;
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include "missing.h"
}
#endif
+#ifndef HAVE_STRNCASECMP
+int strncasecmp(char *s1, char *s2, int n)
+{
+ int dif;
+ unsigned char *p1, *p2;
+
+ p1 = (unsigned char *)s1;
+ p2 = (unsigned char *)s2;
+ dif = 0;
+
+ while (n != 0) {
+ if (*p1 == 0 && *p2 == 0)
+ break;
+ if ((dif = s1 - s2) != 0)
+ break;
+ p1++;
+ p2++;
+ n--;
+ }
+ return dif;
+}
+#endif
+
+#ifndef HAVE_STRCASECMP
+int strcasecmp(char *s1, char *s2)
+{
+ int l1, l2;
+
+ l1 = strlen(s1);
+ l2 = strlen(s2);
+ if (l2 > l1) l1 = l2;
+
+ return strncasecmp(s1, s2, l1);
+}
+#endif
+
+#ifndef HAVE_INET_ATON
+int inet_aton(char *cp, struct in_addr *inp)
+{
+ int a1, a2, a3, a4;
+
+ if (sscanf(cp, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4)
+ return 0;
+
+ inp->s_addr = htonl((a1 << 24) + (a2 << 16) + (a3 << 8) + a4);
+ return 1;
+}
+#endif
+
+#ifndef HAVE_GETHOSTNAME
+int gethostname(char *name, int len)
+{
+ char *h;
+
+ h = getenv("HOSTNAME");
+ if (strlen(h) + 1 > len)
+ return -1;
+ strcpy(name, h);
+ return 0;
+}
+#endif
+
#include <ctype.h>
#include "libradius.h"
-#include "missing.h"
+#include "missing.h"
#if HAVE_MALLOC_H
# include <malloc.h>
INCLUDES = ../include/radiusd.h ../include/conf.h ../include/modules.h
CFLAGS += -I../include
-LDFLAGS += -L../lib -rdynamic
+LDFLAGS += -L../lib $(RDYNAMIC)
LIBS += -lradius
all: radiusd radwho radzap raduse radclient $(BUILDDBM)
signal(SIGHUP, sig_hup);
signal(SIGINT, sig_fatal);
signal(SIGQUIT, sig_fatal);
+#ifdef SIGTRAP
signal(SIGTRAP, sig_fatal);
+#endif
+#ifdef SIGIOT
signal(SIGIOT, sig_fatal);
+#endif
signal(SIGTERM, sig_fatal);
signal(SIGCHLD, sig_cleanup);
#if 0