radius.patch

Wojtek Slusarczyk wojtek w SHADOW.EU.ORG
Wto, 22 Wrz 1998, 10:33:24 CEST


Hej,
	W attachu idzie patch na radiusa.. Jets to zmodyfikowany patch
Grzeska z "supportem" na glibc-2.1 + mozliwoscia budowania pakietu z konta
nie roota. Przygotowywany byl w trybie przyspieszonym wiec moze nie
wygladac zbyt elegancko -> ale spelnia swoje zadanie...

na razie

Wojciech Slusarczyk (091)4494148
Technical University of Szczecin
PGP KeyServer pgpkeys.mit.edu
-------------- następna część ---------
diff -Nur radius/Makefile radius.orig/Makefile
--- radius/Makefile	Mon Jul 13 17:19:54 1998
+++ radius.orig/Makefile	Tue Sep 22 08:30:04 1998
@@ -51,19 +51,19 @@
 # Where the configuration files live.
 RADDB		= ./raddb
 # Some installation stuff.
-DAEMON_INSDIR	= /usr/private/etc
-BIN_INSDIR	= /usr/private/etc
-MAN_INSDIR	= /usr/local/man
-RADDB_INSDIR	= /usr/private/etc/raddb.new
-RADACCT_INSDIR	= /usr/private/etc/radacct
+DAEMON_INSDIR	= /usr/sbin
+BIN_INSDIR	= /usr/bin
+MAN_INSDIR	= /usr/man
+RADDB_INSDIR	= /etc/radius
+RADACCT_INSDIR	= /var/log/radius
 # The server does not need to be owned by root, unless some shadow password
 # scheme needs it.  You might create a user id "radius" for just this purpose.
 # The O G and M macros are for AIX, OSF/1 and HP-UX, see below.
 O		= -o
 G		= -g
 M		= -m
-RADOWN		= root
-RADGRP		= bin
+RADOWN		= `id -u`
+RADGRP		= `id -g`
 
 # Define COMPRESS to hold the pathname of your favourite compress program if
 # you need to override the default value of /usr/ucb/compress:
@@ -77,9 +77,9 @@
 #SRV	  = $(SRV1) $(SRV2) $(SRV3)
 
 # Define DIRS to hold any combination of directory names you'd like to override:
-#DIRS2	  = -DDEFAULT_DIR=\"../raddb\" -DDEFAULT_DIR2=\"$(RADDB_INSDIR)\"
-#DIRS1	  = -DRADIUS_DIR=\"$(RADDB_INSDIR)\" -DRADACCT_DIR=\"$(RADACCT_INSDIR)\"
-#DIRS	  = $(DIRS1) $(DIRS2)
+DIRS2	  = -DDEFAULT_DIR=\"/etc/radius\" -DDEFAULT_DIR2=\"$(RADDB_INSDIR)\"
+DIRS1	  = -DRADIUS_DIR=\"$(RADDB_INSDIR)\" -DRADACCT_DIR=\"$(RADACCT_INSDIR)\"
+DIRS	  = $(DIRS1) $(DIRS2)
 
 # Define CHK_SHELLS to enable /etc/shells checking:
 CHK_SHELLS	= -DCHK_SHELLS
@@ -93,7 +93,7 @@
 ASCEND	  = -DASCEND -DBINARY_FILTERS
 
 # Define USR_CCA to enable USR support:
-#USR	  = -DUSR_CCA
+USR	  = -DUSR_CCA
 
 # Define RAD_LOG_FMT to change how the logfile name changes:
 RAD_LOG_FMT	= -DRADIUS_LOG_FMT=\"logfile.%y%m%d\"
@@ -122,7 +122,7 @@
 # radiusd -- the default
 #
 #--------------------------------------------------------------------------
-DEFS	  = -DHAVE_SETVBUF -DNOSHADOW $(MERIT) $(STUFF) 
+DEFS	  = -DHAVE_SETVBUF $(MERIT) $(STUFF) 
 RADLIBS	  =
 INCS	  =
 
@@ -228,12 +228,12 @@
 #
 #--------------------------------------------------------------------------
 
-CC	  = cc
-CFLAGS	  = -g $(DEFS) $(INCS)
-LDFLAGS	  =
-LIBS	  =
-RANLIB	  = ranlib
-INSTALL	  = /bin/install
+#CC	  = cc
+#CFLAGS	  = -g $(DEFS) $(INCS)
+#LDFLAGS	  =
+#LIBS	  =
+#RANLIB	  = ranlib
+#INSTALL	  = /bin/install
 
 #
 # Solaris 2.x [[NB: if BIND/named not SMCC, try CFLAGS = ... -DBSD=1 ...]]
@@ -270,14 +270,14 @@
 #
 #--------------------------------------------------------------------------
 
-#CC	  = cc
-#CFLAGS	  = -g $(DEFS) $(INCS)
-#LDFLAGS	  =
+CC	  = cc
+CFLAGS	  = -g $(DEFS) $(INCS)
+LDFLAGS	  =
 # pick one
-#LIBS	  = -lshadow
-#LIBS	  =
-#RANLIB	  = ranlib
-#INSTALL	  = /usr/bin/install
+#LIBS	  = -lshadow -lcrypt
+LIBS	  = -lcrypt
+RANLIB	  = ranlib
+INSTALL	  = /usr/bin/install
 
 #
 # HP-UX 9.05 or 10.x (the "O" macro is for HP version of install, -lsec opt.)
@@ -459,7 +459,7 @@
 	$(CC) $(CFLAGS) -o $(OBJ)/radiusd.o -c $(SRC)/radiusd.c
 
 $(OBJ)/fsm.o: $(SRC)/fsm.c $(SRC)/radius.h Makefile
-	$(CC) $(CFLAGS) -o $(OBJ)/fsm.o -c $(SRC)/fsm.c
+	$(CC) $(CFLAGS) -o $(OBJ)/fsm.o -c $(SRC)/fsm.c 2>/dev/null
 
 $(OBJ)/authenticate.o: $(SRC)/authenticate.c $(RAD_INCS) Makefile
 	$(CC) $(CFLAGS) -o $(OBJ)/authenticate.o \
@@ -627,79 +627,83 @@
 install-all: install util-install config-install man-install
 
 install: $(RADIUS)
-	-if [ ! -d $(DAEMON_INSDIR) ] ;\
+	-if [ ! -d $(BUILD_ROOT)/$(DAEMON_INSDIR) ] ;\
 	then \
-		/bin/mkdir -p $(DAEMON_INSDIR) ;\
+		/bin/mkdir -p $(BUILD_ROOT)/$(DAEMON_INSDIR) ;\
 	fi
 	$(INSTALL) $(M) 755 $(O) $(RADOWN) $(G) $(RADGRP) $(RADIUS) \
-						$(DAEMON_INSDIR)/$(SERVER)
+				$(BUILD_ROOT)/$(DAEMON_INSDIR)/$(SERVER)
 
 util-install: $(UTILS)
-	-if [ ! -d $(BIN_INSDIR) ] ;\
+	-if [ ! -d $(BUILD_ROOT)/$(BIN_INSDIR) ] ;\
 	then \
-		/bin/mkdir -p $(BIN_INSDIR) ;\
+		/bin/mkdir -p $(BUILD_ROOT)/$(BIN_INSDIR) ;\
 	fi
 	$(INSTALL) $(M) 755 $(O) $(RADOWN) $(G) $(RADGRP) $(RADCHECK) \
-						$(BIN_INSDIR)/radcheck
+					$(BUILD_ROOT)/$(BIN_INSDIR)/radcheck
 	$(INSTALL) $(M) 755 $(O) $(RADOWN) $(G) $(RADGRP) $(RADPWTST) \
-						$(BIN_INSDIR)/radpwtst
+					$(BUILD_ROOT)/$(BIN_INSDIR)/radpwtst
 	$(INSTALL) $(M) 755 $(O) $(RADOWN) $(G) $(RADGRP) $(RADPASS) \
-						$(BIN_INSDIR)/radpass
+					$(BUILD_ROOT)/$(BIN_INSDIR)/radpass
 	$(INSTALL) $(M) 755 $(O) $(RADOWN) $(G) $(RADGRP) $(DNSCHECK) \
-						$(BIN_INSDIR)/dnscheck
+					$(BUILD_ROOT)/$(BIN_INSDIR)/dnscheck
 
 man-install:
-	-if [ ! -d $(MAN_INSDIR) ] ;\
+	-if [ ! -d $(BUILD_ROOT)/$(MAN_INSDIR)/man5 ] ;\
+	then \
+		/bin/mkdir -p $(BUILD_ROOT)/$(MAN_INSDIR)/man5 ;\
+	fi
+	-if [ ! -d $(BUILD_ROOT)/$(MAN_INSDIR)/man8 ] ;\
 	then \
-		/bin/mkdir -p $(MAN_INSDIR) ;\
+		/bin/mkdir -p $(BUILD_ROOT)/$(MAN_INSDIR)/man8 ;\
 	fi
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/authfile.5 \
-						$(MAN_INSDIR)/man5/authfile.5
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man5/authfile.5
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/clients.5 \
-						$(MAN_INSDIR)/man5/clients.5
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man5/clients.5
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/dictionary.5 \
-						$(MAN_INSDIR)/man5/dictionary.5
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man5/dictionary.5
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/engine.config.5 \
-						$(MAN_INSDIR)/man5/engine.config.5
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man5/engine.config.5
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/radius.fsm.5 \
-						$(MAN_INSDIR)/man5/radius.fsm.5
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man5/radius.fsm.5
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/users.5 \
-						$(MAN_INSDIR)/man5/users.5
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man5/users.5
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/vendors.5 \
-						$(MAN_INSDIR)/man5/vendors.5
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man5/vendors.5
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/builddbm.8 \
-						$(MAN_INSDIR)/man8/builddbm.8
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man8/builddbm.8
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/dnscheck.8 \
-						$(MAN_INSDIR)/man8/dnscheck.8
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man8/dnscheck.8
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/radcheck.8 \
-						$(MAN_INSDIR)/man8/radcheck.8
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man8/radcheck.8
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/radiusd.8 \
-						$(MAN_INSDIR)/man8/radiusd.8
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man8/radiusd.8
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(MAN)/radpwtst.8 \
-						$(MAN_INSDIR)/man8/radpwtst.8
+					$(BUILD_ROOT)/$(MAN_INSDIR)/man8/radpwtst.8
 
 config-install: $(CONFIGS)
-	-if [ ! -d $(RADDB_INSDIR) ] ;\
+	-if [ ! -d $(BUILD_ROOT)/$(RADDB_INSDIR) ] ;\
 	then \
-		/bin/mkdir -p $(RADDB_INSDIR) ;\
+		/bin/mkdir -p $(BUILD_ROOT)/$(RADDB_INSDIR) ;\
 	fi
 	$(INSTALL) $(M) 660 $(O) $(RADOWN) $(G) $(RADGRP) $(RADDB)/authfile \
-						$(RADDB_INSDIR)/authfile
+					$(BUILD_ROOT)/$(RADDB_INSDIR)/authfile
 	$(INSTALL) $(M) 660 $(O) $(RADOWN) $(G) $(RADGRP) $(RADDB)/clients \
-						$(RADDB_INSDIR)/clients
+					$(BUILD_ROOT)/$(RADDB_INSDIR)/clients
 	$(INSTALL) $(M) 755 $(O) $(RADOWN) $(G) $(RADGRP) $(RADDB)/conversion.pl \
-						$(RADDB_INSDIR)/conversion.pl
+					$(BUILD_ROOT)/$(RADDB_INSDIR)/conversion.pl
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(RADDB)/dictionary \
-						$(RADDB_INSDIR)/dictionary
+					$(BUILD_ROOT)/$(RADDB_INSDIR)/dictionary
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(RADDB)/engine.config \
-						$(RADDB_INSDIR)/engine.config
+					$(BUILD_ROOT)/$(RADDB_INSDIR)/engine.config
 	$(INSTALL) $(M) 660 $(O) $(RADOWN) $(G) $(RADGRP) $(RADDB)/users \
-						$(RADDB_INSDIR)/users
+					$(BUILD_ROOT)/$(RADDB_INSDIR)/users
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(RADDB)/vendors \
-						$(RADDB_INSDIR)/vendors
+					$(BUILD_ROOT)/$(RADDB_INSDIR)/vendors
 	$(INSTALL) $(M) 644 $(O) $(RADOWN) $(G) $(RADGRP) $(RADDB)/xas.fsm \
-						$(RADDB_INSDIR)/xas.fsm
-	-if [ ! -d $(RADACCT_INSDIR) ] ;\
+					$(BUILD_ROOT)/$(RADDB_INSDIR)/xas.fsm
+	-if [ ! -d $(BUILD_ROOT)/$(RADACCT_INSDIR) ] ;\
 	then \
-		/bin/mkdir -p $(RADACCT_INSDIR) ;\
+		/bin/mkdir -p $(BUILD_ROOT)/$(RADACCT_INSDIR) ;\
 	fi
diff -Nur radius/redhat/radiusd radius.orig/redhat/radiusd
--- radius/redhat/radiusd	Thu Jan  1 01:00:00 1970
+++ radius.orig/redhat/radiusd	Tue Sep 22 08:29:17 1998
@@ -0,0 +1,47 @@
+#! /bin/sh
+#
+# chkconfig: - 55 55
+# description: RADIUS authentication and accounting service  \
+#	       daemon.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Get config.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if [ ${NETWORKING} = "no" ]
+then
+	exit 0
+fi
+
+# See how we were called.
+case "$1" in
+  start)
+	echo -n "Starting RADIUS: "
+	daemon /usr/sbin/radiusd -g syslog
+
+	echo
+	touch /var/lock/subsys/radiusd
+	;;
+  stop)
+	echo -n "Stopping RADIUS: "
+	killproc radiusd
+
+	echo
+	rm -f /var/lock/subsys/radiusd
+	;;
+  status)
+	status radiusd
+	;;
+  restart)
+	$0 stop
+	$0 start
+	;;
+  *)
+	echo "Usage: radiusd {start|stop|status|restart}"
+	exit 1
+esac
+
+exit 0
diff -Nur radius/src/conf.h radius.orig/src/conf.h
--- radius/src/conf.h	Thu Jun 11 20:40:20 1998
+++ radius.orig/src/conf.h	Tue Sep 22 08:29:17 1998
@@ -174,8 +174,12 @@
 
 #if defined(linux)
 #include	<unistd.h>
+#if ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))
+/* We don't need nothing.. */
+#else
 #define	MIN(a, b)      ((a) < (b) ? (a) : (b))
 #define	MAX(a, b)      ((a) > (b) ? (a) : (b))
+#endif /* Gnu libc-2.1 */
 #endif	/* linux */
 
 #endif /* CONF_H */
diff -Nur radius/src/funcs.c radius.orig/src/funcs.c
--- radius/src/funcs.c	Mon Jul 27 22:53:38 1998
+++ radius.orig/src/funcs.c	Tue Sep 22 08:29:17 1998
@@ -236,7 +236,7 @@
 extern int       spawn_flag;
 extern int       zap_logfile;
 
-#if !defined(__FreeBSD__) && !defined(_BSDI_VERSION) && !defined(__NetBSD__)
+#if !defined(__FreeBSD__) && !defined(_BSDI_VERSION) && !defined(__NetBSD__) && !defined(linux)
 extern int       sys_nerr;
 extern char     *sys_errlist[];
 #endif	/* __FreeBSD__ */
diff -Nur radius/src/radcheck.c radius.orig/src/radcheck.c
--- radius/src/radcheck.c	Mon Jul  6 19:43:22 1998
+++ radius.orig/src/radcheck.c	Tue Sep 22 08:29:17 1998
@@ -94,7 +94,7 @@
 AATVPTR         rad_ipc_aatv = (AATV *) NULL;
 AATV           *authtype_tv[PW_AUTH_MAX + 1];
 FILE           *ddt = NULL;
-FILE           *msgfd = stderr;
+FILE           *msgfd;
 extern void     dir_init ();
 
 static void     radcheck_usage ();
@@ -108,7 +108,6 @@
 
 int             argc;
 char           *argv[];
-
 {
 
 #ifdef	MERIT_TIMELEFT
@@ -130,7 +129,7 @@
 	int             zero = 0;
 	char           *huntgroup_name;
 	char           *subgroup_name;
-
+	
 #ifdef	MERIT_TIMELEFT
 	char            buf[256];
 	char            hgserver[MAXHOSTNAMELEN];
@@ -151,7 +150,7 @@
 	data.group = (char *) NULL;
 	data.arades = 0;
 	data.send_pairs = NULL_VP;
-
+	msgfd = stderr;
 	while (--argc > 0 && *(*++argv) == '-')
 	{
 		/* switch on char. after "-" */
diff -Nur radius/src/radpass.c radius.orig/src/radpass.c
--- radius/src/radpass.c	Mon Jul  6 19:43:31 1998
+++ radius.orig/src/radpass.c	Tue Sep 22 08:29:17 1998
@@ -124,7 +124,7 @@
 AATVPTR         rad_ipc_aatv = (AATV *) NULL;
 AATV           *authtype_tv[PW_AUTH_MAX + 1];
 FILE           *ddt = NULL;
-FILE           *msgfd = stderr;
+FILE           *msgfd;
 
 static u_char   vector[AUTH_VECTOR_LEN];
 static u_char   oldpass[AUTH_PASS_LEN];
@@ -156,7 +156,7 @@
 	int             total_length;
 	char           *getpass ();
 	int             length;
-
+	msgfd = stderr;
 	progname = (char *) argv[0];
 	radius_dir = RADIUS_DIR;
 
diff -Nur radius/src/radpwtst.c radius.orig/src/radpwtst.c
--- radius/src/radpwtst.c	Mon Jul  6 18:34:20 1998
+++ radius.orig/src/radpwtst.c	Tue Sep 22 08:29:17 1998
@@ -103,7 +103,7 @@
 AATVPTR         rad_ipc_aatv = (AATV *) NULL;
 AATV           *authtype_tv[PW_AUTH_MAX + 1];
 FILE           *ddt = NULL;
-FILE           *msgfd = stderr;
+FILE           *msgfd;
 extern void     dir_init();
 
 static void     radpwtst_usage ();
@@ -196,7 +196,7 @@
 	char            passwd[AUTH_PASS_LEN + 1];
 	char            msg[4096]; /* big enough to hold several messages */
 	SEND_DATA       data;
-
+	msgfd = stderr;
 	/*
 	 *	Determine what program we're running as...
 	 *	Strip off the path (if any).
diff -Nur radius/src/sendserver.c radius.orig/src/sendserver.c
--- radius/src/sendserver.c	Mon Jul  6 19:43:36 1998
+++ radius.orig/src/sendserver.c	Tue Sep 22 08:29:17 1998
@@ -83,7 +83,7 @@
 
 #include	"radius.h"
 
-#if !defined(__FreeBSD__) && !defined(_BSDI_VERSION) && !defined(__NetBSD__)
+#if !defined(__FreeBSD__) && !defined(_BSDI_VERSION) && !defined(__NetBSD__) && !defined(linux)
 extern char    *sys_errlist[];
 #endif	/* __FreeBSD__ */
 


Więcej informacji o liście dyskusyjnej pld-devel-pl