#
# Make.inc.in Common Makefile stuff for the cistron-radius package.
#
-# Version: @(#)Makefile.inc.in 1.00 01-Jul-1999 miquels@cistron.nl
+# Version: $Id$
#
# Location of files.
# NOTE: This top-level Makefile must not
# use GNU-make extensions. The lower ones can.
#
-# Version: @(#)Makefile 1.10 21-Aug-1999 miquels@cistron.nl
+# Version: $Id$
#
-@INCLUDE@ @IQUOTE@Make.inc@IQUOTE@
+include Make.inc
-MAKE = @MAKE@
SUBDIRS = src raddb doc scripts
WHAT_TO_MAKE = all
@TOP@
+/* Do we have the crypt function ? */
+#undef HAVE_CRYPT
+
/* Do we have shadow support? */
#undef HAVE_GETSPNAM
fi
AC_SUBST(LIBDL)
-dnl Modules to be built.
-for i in `( cd src/modules; ls -1d rlm_* )`
-do
- if test "$HAVE_LIBDL" = ""; then
- MODULES="$MODULES$i.a "
- MODULE_PATHS="$MODULE_PATHS../modules/$i/$i.a "
- else
- MODULES="$MODULES$i.so "
- fi
-done
-AC_SUBST(MODULES)
-AC_SUBST(MODULE_PATHS)
-
dnl Check for programs
AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
if test ! -x $ac_cv_path_PERL; then
resource.h \
getopt.h \
malloc.h \
+ utmp.h \
sys/select.h \
)
dnl Check for libcrypt
dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
AC_CHECK_LIB(crypt, crypt,
- CRYPTLIB="-lcrypt",
+ CRYPTLIB="-lcrypt"
)
AC_SUBST(CRYPTLIB)
+if test "$CRYPTLIB" != ""; then
+ AC_DEFINE(HAVE_CRYPT)
+else
+ AC_CHECK_FUNC(crypt)
+fi
dnl Check for -lsocket
AC_CHECK_LIB(socket, getsockname,
AC_OUTPUT(\
./Make.inc \
- ./Makefile
- ./src/Makefile \
./src/include/build-radpaths-h \
./src/lib/Makefile \
- ./src/main/Makefile \
./src/main/checkrad.pl \
./src/main/radlast \
./src/main/radtest \
- ./src/modules/Makefile \
./raddb/Makefile \
./doc/Makefile \
./scripts/Makefile \
+1999-09-18 Miquel van Smoorenburg (miquels@cistron.nl)
+
+ * Change a couple of Makefile.ins to plain Makefiles
+ * Added missing.c and missing.h
+ * Detect <utmp.h> and define replacements in sysutmp.h if missing
+ * New mechanism in main/Makefile to detect static modules
+ * Fix warnings in lib/filters.c
+
1999-08-23 Miquel van Smoorenburg (miquels@cistron.nl)
* src/main/auth.c: Login-Time check: set Session-Timeout to
#
# Makefile Makefile for the cistron-radius package.
#
-# Version: @(#)Makefile 1.00 01-Jul-1999 miquels@cistron.nl
+# Version: $Id$
#
-@INCLUDE@ @IQUOTE@../Make.inc@IQUOTE@
+include ../Make.inc
SUBDIRS = lib modules main
WHAT_TO_MAKE = all
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Do we have the crypt function ? */
+#undef HAVE_CRYPT
+
/* Do we have socklen_t? */
#undef HAVE_SOCKLEN_T
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <utmp.h> header file. */
+#undef HAVE_UTMP_H
--- /dev/null
+/*
+ * missing.h Replacements for functions that are or can be
+ * missing on some platforms.
+ *
+ * Version: $Id$
+ *
+ */
+
+#ifndef HAVE_CRYPT
+char *crypt(char *key, char *salt);
+#endif
+
* radiusd.h Structures, prototypes and global variables
* for the Cistron Radius server.
*
- * Version: @(#)radiusd.h 2.00 19-Jul-1999 miquels@cistron.nl
+ * Version: $Id$
*
*/
#include "libradius.h"
#include "radpaths.h"
#include "conf.h"
+#include "missing.h"
#define CHAP_VALUE_LENGTH 16
/*
* sysutmp.h Compatibility stuff for the different UTMP systems.
*
- * Version: @(#)sysutmp.h 1.0 01-Jul-1999
+ * Version: $Id$
*/
#ifndef SYSUTMP_H_INCLUDED
#define SYSUTMP_H_INCLUDED
+#ifdef HAVE_UTMP_H
+
/* UTMP stuff. Uses utmpx on svr4 */
#ifdef __svr4__
# include <utmpx.h>
# define ut_user ut_name
#endif
+#else /* HAVE_UTMP_H */
+
+/*
+ * No <utmp.h> file - define stuff ourselves (minimally).
+ */
+#define UT_LINESIZE 16
+#define UT_NAMESIZE 16
+#define UT_HOSTSIZE 16
+
+#define USER_PROCESS 7
+#define DEAD_PROCESS 8
+
+struct utmp {
+ short ut_type;
+ int ut_pid;
+ char ut_line[UT_LINESIZE];
+ char ut_id[4];
+ long ut_time;
+ char ut_user[UT_NAMESIZE];
+ char ut_host[UT_HOSTSIZE];
+ long ut_addr;
+};
+
+#endif /* HAVE_UTMP_H */
+
#endif /* SYSUTMP_H_INCLUDED */
@INCLUDE@ @IQUOTE@../../Make.inc@IQUOTE@
OBJS = dict.o md5.o print.o radius.o valuepair.o token.o misc.o \
- log.o filters.o
+ log.o filters.o missing.o
-INCLUDES = ../include/radius.h ../include/libradius.h
-BUILDDBM = @BUILDDBM@
+INCLUDES = ../include/radius.h ../include/libradius.h \
+ ../include/missing.h
CFLAGS += -D_LIBRADIUS -I../include
log.o: log.c $(INCLUDES)
$(CC) $(CFLAGS) -c log.c
+missing.o: missing.c $(INCLUDES)
+ $(CC) $(CFLAGS) -c missing.c
+
md5.o: md5.c md5.h
$(CC) $(CFLAGS) -c md5.c
static int findKey ( char *string, KeywordStruct *list );
static int isAllDigit ( char *token );
static short a2octet ( char *tok, char *retBuf );
-static char defaultNetmask ( unsigned long address );
-static int ipAddressStringToValue ( char *string, unsigned long *ipAddress,
+static char defaultNetmask ( UINT4 address );
+static int ipAddressStringToValue ( char *string, UINT4 *ipAddress,
char *netmask);
static int parseIpFilter ( RadFilter *curEntry );
static int parseGenericFilter ( RadFilter *curEntry );
*/
static char
defaultNetmask(address)
-unsigned long address;
+UINT4 address;
{
char netmask;
*/
static int
-ipAddressStringToValue(char *string, unsigned long *ipAddress,
+ipAddressStringToValue(char *string, UINT4 *ipAddress,
char *netmask)
{
u_char* dst;
--- /dev/null
+/*
+ * missing.c Replacements for functions that are or can be
+ * missing on some platforms.
+ *
+ * Version: $Id$
+ *
+ */
+
+static const char rcsid[] = "$Id$";
+
+#include "autoconf.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#include "missing.h"
+
+#ifndef HAVE_CRYPT
+char *crypt(char *key, char *salt)
+{
+ /*log(L_ERR, "crypt() called but not implemented");*/
+ return "____fnord____";
+}
+#endif
+
-@INCLUDE@ @IQUOTE@../../Make.inc@IQUOTE@
+include ../../Make.inc
+
+MODULES = $(shell ./makemodules.sh modules $(LIBDL))
+MODULE_PATHS = $(shell ./makemodules.sh paths $(LIBDL))
SERVER_OBJS = radiusd.o files.o util.o acct.o nas.o log.o valuepair.o \
version.o proxy.o exec.o auth.o timestr.o \
sprintf(buf, "from nas %.128s/S%d%s%.128s",
nas_name2(request->packet), port,
- do_cli ? " cli " : "", do_cli ? cli->strvalue : "");
+ (do_cli ? " cli " : ""), (do_cli ? (char *)cli->strvalue : ""));
return buf;
}
--- /dev/null
+#! /bin/sh
+#
+# makemodules.sh Helper script to generate a list of modules
+# to compile into the server.
+#
+# Version: $Id$
+#
+
+if [ "$2" != "" ]
+then
+ # $(LIBDL) is set, so no static modules.
+ exit 0
+fi
+
+for i in ../modules/rlm_*/rlm_*.a
+do
+ module=`basename $i`
+ module=`echo $module | sed 's/\.a$//'`
+ MODULE_PATHS="$MODULE_PATHS$i "
+ MODULES="$MODULES$module "
+done
+
+if [ "$1" = paths ]
+then
+ echo $MODULE_PATHS
+elif [ "$1" = modules ]
+then
+ echo $MODULES
+else
+ echo "Usage: $0 paths|modules [libdl]"
+ exit 1
+fi
+
+exit 0
+
* This is only used if the system doesn't
* support runtime linking of modules.
*
- * Version: @(#)modules_static.h 1.00 08-Aug-1999 miquels
+ * Version: $Id$
*
*/
void usage(void)
{
- fprintf(stderr, "Usage: radclient [-d raddb ] [-f file] [-t timeout] [-nx] server acct|auth <secret>\n");
+ fprintf(stderr, "Usage: radclient [-d raddb ] [-f file] [-r retries] [-t timeout] [-nx]\n server acct|auth <secret>\n");
exit(1);
}
int c;
int port = 0;
int s;
- int timeout = 3;
+ int retries = 10;
+ float timeout = 3;
int i;
char *radius_dir = RADDBDIR;
char *filename = NULL;
FILE *fp;
- while ((c = getopt(argc, argv, "d:f:nxt:")) != EOF) switch(c) {
+ while ((c = getopt(argc, argv, "d:f:nt:r:x")) != EOF) switch(c) {
case 'd':
radius_dir = optarg;
break;
case 'x':
librad_debug = 1;
break;
+ case 'r':
+ if (!isdigit(*optarg)) usage();
+ retries = atoi(optarg);
+ break;
case 't':
if (!isdigit(*optarg)) usage();
- timeout = atoi(optarg);
+ timeout = atof(optarg);
break;
default:
usage();
exit(1);
}
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < retries; i++) {
fd_set rdfdesc;
rad_send(req, s, secret);
FD_ZERO(&rdfdesc);
FD_SET(s, &rdfdesc);
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
+ tv.tv_sec = (int)timeout;
+ tv.tv_usec = 1000000 * (timeout - (int)timeout);
/* Something's wrong if we don't get exactly one fd. */
if (select(s+1, &rdfdesc, NULL, NULL, &tv) != 1) {
}
/* No response or no data read (?) */
- if (i == 10) {
+ if (i == retries) {
fprintf(stderr, "radclient: no response from server\n");
exit(1);
}
#
# Makefile Makefile for the cistron-radius package.
#
-# Version: @(#)Makefile 1.00 01-Jul-1999 miquels@cistron.nl
+# Version: $Id$
#
-@INCLUDE@ @IQUOTE@../../Make.inc@IQUOTE@
+include ../../Make.inc
WHAT_TO_MAKE = all
# must be first
include config.mak
-TARGET = rlm_pam
+TARGET = #rlm_pam
SRCS = rlm_pam.c
LIBS = -lpam -ldl