Change a couple of Makefile.ins to plain Makefiles
authormiquels <miquels>
Sat, 18 Sep 1999 13:46:52 +0000 (13:46 +0000)
committermiquels <miquels>
Sat, 18 Sep 1999 13:46:52 +0000 (13:46 +0000)
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

20 files changed:
Make.inc.in
Makefile [moved from Makefile.in with 91% similarity]
acconfig.h
configure.in
doc/ChangeLog
src/Makefile [moved from src/Makefile.in with 81% similarity]
src/include/autoconf.h.in
src/include/missing.h [new file with mode: 0644]
src/include/radiusd.h
src/include/sysutmp.h
src/lib/Makefile.in
src/lib/filters.c
src/lib/missing.c [new file with mode: 0644]
src/main/Makefile [moved from src/main/Makefile.in with 94% similarity]
src/main/auth.c
src/main/makemodules.sh [new file with mode: 0755]
src/main/modules_static.h.in
src/main/radclient.c
src/modules/Makefile [moved from src/modules/Makefile.in with 81% similarity]
src/modules/rlm_pam/Makefile

index 3678348..8aa8461 100644 (file)
@@ -1,7 +1,7 @@
 #
 # 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.
similarity index 91%
rename from Makefile.in
rename to Makefile
index a7f7272..b4be426 100644 (file)
+++ b/Makefile
@@ -4,12 +4,11 @@
 #              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
 
index b70569f..047eae3 100644 (file)
@@ -8,6 +8,9 @@ config.h - created by autoconf; contains defines generated by autoconf
 
 @TOP@
 
+/* Do we have the crypt function ? */
+#undef HAVE_CRYPT
+
 /* Do we have shadow support? */
 #undef HAVE_GETSPNAM
 
index 2781a10..88d0905 100644 (file)
@@ -207,19 +207,6 @@ else
 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
@@ -238,6 +225,7 @@ AC_CHECK_HEADERS( \
        resource.h \
        getopt.h \
        malloc.h \
+       utmp.h \
        sys/select.h \
 )
 
@@ -260,9 +248,14 @@ AC_TRY_COMPILE([#include <sys/types.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,
@@ -280,15 +273,11 @@ AC_SUBST(NSLLIB)
 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 \
index db204f6..60e256a 100644 (file)
@@ -1,3 +1,11 @@
+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
similarity index 81%
rename from src/Makefile.in
rename to src/Makefile
index 6ba5acb..a358d1d 100644 (file)
@@ -1,10 +1,10 @@
 #
 # 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
index 3c081fd..9db351d 100644 (file)
@@ -11,6 +11,9 @@ config.h - created by autoconf; contains defines generated by autoconf
 /* 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
 
@@ -88,3 +91,6 @@ config.h - created by autoconf; contains defines generated by autoconf
 
 /* 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
diff --git a/src/include/missing.h b/src/include/missing.h
new file mode 100644 (file)
index 0000000..2c2c90e
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * 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
+
index 78b14ae..99d5400 100644 (file)
@@ -2,13 +2,14 @@
  * 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
 
index 3b9210a..46486c6 100644 (file)
@@ -1,12 +1,14 @@
 /*
  * 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 */
index 33e6e30..7b9d0a1 100644 (file)
@@ -2,10 +2,10 @@
 @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
 
@@ -39,6 +39,9 @@ misc.o: misc.c $(INCLUDES)
 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
 
index bc6d08f..93aeea6 100644 (file)
@@ -361,8 +361,8 @@ static char curString[512];
 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 );
@@ -516,7 +516,7 @@ char        *retBuf;
      */
 static char
 defaultNetmask(address)
-unsigned long  address;
+UINT4  address;
 {
     char netmask;
 
@@ -563,7 +563,7 @@ static char ipAddressDigits[] = "1234567890./";
      */
 
 static int
-ipAddressStringToValue(char *string, unsigned long *ipAddress,
+ipAddressStringToValue(char *string, UINT4 *ipAddress,
        char *netmask)
 {
     u_char*    dst;
diff --git a/src/lib/missing.c b/src/lib/missing.c
new file mode 100644 (file)
index 0000000..37ce1d3
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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
+
similarity index 94%
rename from src/main/Makefile.in
rename to src/main/Makefile
index 3279eaa..209ec67 100644 (file)
@@ -1,5 +1,8 @@
 
-@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 \
index e55e5f8..604ed0a 100644 (file)
@@ -63,7 +63,7 @@ char *auth_name(REQUEST *request, int do_cli)
 
        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;
 }
diff --git a/src/main/makemodules.sh b/src/main/makemodules.sh
new file mode 100755 (executable)
index 0000000..6627d53
--- /dev/null
@@ -0,0 +1,35 @@
+#! /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
+
index b9ddab9..631d4bc 100644 (file)
@@ -3,7 +3,7 @@
  *                     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$
  *
  */
 
index d487adb..34af86a 100644 (file)
@@ -62,7 +62,7 @@ VALUE_PAIR *readvp(FILE *fp)
 
 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);
 }
 
@@ -89,13 +89,14 @@ int main(int argc, char **argv)
        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;
@@ -108,9 +109,13 @@ int main(int argc, char **argv)
                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();
@@ -203,7 +208,7 @@ int main(int argc, char **argv)
                exit(1);
        }
 
-       for (i = 0; i < 10; i++) {
+       for (i = 0; i < retries; i++) {
                fd_set          rdfdesc;
 
                rad_send(req, s, secret);
@@ -212,8 +217,8 @@ int main(int argc, char **argv)
                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) {
@@ -230,7 +235,7 @@ int main(int argc, char **argv)
        }
 
        /* No response or no data read (?) */
-       if (i == 10) {
+       if (i == retries) {
                fprintf(stderr, "radclient: no response from server\n");
                exit(1);
        }
similarity index 81%
rename from src/modules/Makefile.in
rename to src/modules/Makefile
index d7778b5..6089ae4 100644 (file)
@@ -1,10 +1,10 @@
 #
 # 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
 
index 5d65d79..d9867fb 100644 (file)
@@ -1,7 +1,7 @@
 # must be first
 include config.mak
 
-TARGET = rlm_pam
+TARGET = #rlm_pam
 SRCS   = rlm_pam.c
 LIBS   = -lpam -ldl