Import of Ascend-modified RADIUS daemon.

Reviewed by:	chuckr@FreeBSD.ORG
This commit is contained in:
James FitzGibbon 1996-09-24 15:12:01 +00:00
parent 1b424cf434
commit c4017afbcb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=3857
13 changed files with 429 additions and 0 deletions

View File

@ -0,0 +1,59 @@
# New ports collection makefile for: ascend-radius
# Version required: 960919 (v1.16)
# Date created: August 28th 96
# Whom: James FitzGibbon <jfitz@FreeBSD.org>
#
# $Id$
#
DISTNAME= rad0919
PKGNAME= ascend-radius-960919
CATEGORIES+= net
MASTER_SITES= ftp://ftp.ascend.com/pub/Software-Releases/Radius/Current/
EXTRACT_SUFX= .gz
MAINTAINER= jfitz@FreeBSD.ORG
WRKPREFIX= radius-960919/radius-1.16-ascend
WRKSRC= ${WRKDIR}/${WRKPREFIX}/ascendd
ALL_TARGET= all dbm
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/radiusd ${PREFIX}/sbin
${INSTALL_PROGRAM} ${WRKSRC}/radiusd.dbm ${PREFIX}/sbin
${INSTALL_PROGRAM} ${WRKSRC}/builddbm ${PREFIX}/sbin
.ifdef NOMANCOMPRESS
${INSTALL_MAN} ${WRKDIR}/${WRKPREFIX}/man1/users-file-syntax.1 ${PREFIX}/man/man1
${INSTALL_MAN} ${WRKDIR}/${WRKPREFIX}/man1/builddbm.1 ${PREFIX}/man/man1
.else
@ ${CP} ${WRKDIR}/${WRKPREFIX}/man1/users-file-syntax.1 ${WRKSRC}
@ ${CP} ${WRKDIR}/${WRKPREFIX}/man1/builddbm.1 ${WRKSRC}
@ gzip -9nf ${WRKSRC}/users-file-syntax.1
@ gzip -9nf ${WRKSRC}/builddbm.1
${INSTALL_MAN} ${WRKSRC}/users-file-syntax.1.gz ${PREFIX}/man/man1
${INSTALL_MAN} ${WRKSRC}/builddbm.1.gz ${PREFIX}/man/man1
.endif
.ifndef NOPORTDOCS
@ mkdir -p ${PREFIX}/share/doc/ascend-radius
for file in ascend.doc draft-ietf-radius-accounting-01.txt draft-ietf-radius-radius-03.txt draft-ietf-radius-radius-04.txt; do \
${INSTALL_DATA} ${WRKDIR}/${WRKPREFIX}/doc/$$file ${PREFIX}/share/doc/ascend-radius; \
done
for file in ChangeLog README README.cexample README.dict; do \
${INSTALL_DATA} ${WRKDIR}/${WRKPREFIX}/$$file ${PREFIX}/share/doc/ascend-radius; \
done
.endif
@ mkdir -p ${PREFIX}/etc/raddb
@ chown root.wheel ${PREFIX}/etc/raddb
@ chmod 700 ${PREFIX}/etc/raddb
for file in clients.example dictionary users.example; do \
${INSTALL} -c -o root -g wheel -m 0400 ${WRKDIR}/${WRKPREFIX}/raddb/$$file ${PREFIX}/etc/raddb; \
done
@ mkdir -p /var/log/radacct
@ chown root.wheel /var/log/radacct
@ chmod 700 /var/log/radacct
pre-clean:
@ ${RM} -f ${PATCHDIR}/patch-zz
.include <bsd.port.mk>

View File

@ -0,0 +1 @@
MD5 (rad0919.gz) = 7b7de79fdc80088c27a023d1f4ef038a

View File

@ -0,0 +1,45 @@
--- Makefile.orig Thu Sep 19 20:20:38 1996
+++ Makefile Mon Sep 23 21:37:19 1996
@@ -108,8 +108,8 @@
# Pick your compiler
#
#CC= gcc -ansi -Wall # set the GCC compiler to ANSI mode and picky
-CC= gcc -ansi # set the GCC compiler to ANSI mode
-#CC= gcc # set the GCC compiler for BSDI and friends
+#CC= gcc -ansi # set the GCC compiler to ANSI mode
+CC= gcc # set the GCC compiler for BSDI and friends
#CC= cc -Xc -v -fd # set the SUN compiler to full-whine ANSI mode
#CC= cc -Xc -v # set the SUN compiler to partial-whine ANSI mode
#CC= cc -Xc # set the SUN compiler to ANSI mode
@@ -129,13 +129,15 @@
# use this for BSDI
#CFLAGS= -O -DNOSHADOW -DBSDI -DBINARY_FILTERS -DASCEND_SECRET -DASCEND_LOGOUT $(AUTH_SERVERS)
# use this for SunOS
-CFLAGS= -O -DNOSHADOW -DOSUN -DBINARY_FILTERS -DASCEND_SECRET -DASCEND_LOGOUT $(AUTH_SERVERS)
+#CFLAGS= -O -DNOSHADOW -DOSUN -DBINARY_FILTERS -DASCEND_SECRET -DASCEND_LOGOUT $(AUTH_SERVERS)
# use this for Solaris 2.1 - 2.4
#CFLAGS= -O -Dsys5 -DSOLARIS -D_SVID_GETTOD -DBINARY_FILTERS -DASCEND_SECRET -DASCEND_LOGOUT $(AUTH_SERVERS)
# use this for Solaris 2.5
#CFLAGS= -O -Dsys5 -DSOLARIS -DBINARY_FILTERS -DASCEND_SECRET -DASCEND_LOGOUT $(AUTH_SERVERS)
# use this for Linux
#CFLAGS= -O -Dsys5 -DNOSHADOW -DBINARY_FILTERS -DASCEND_SECRET -DASCEND_LOGOUT $(AUTH_SERVERS)
+# use this for FreeBSD
+CFLAGS= -O -DNOSHADOW -D_HAVE_PARAM_H -DUSE_NDBM -DBINARY_FILTERS -DASCEND_SECRET -DASCEND_LOGOUT $(AUTH_SERVERS)
# Pick any load options and the load libraries. The AUTH_LIBS
# are selected above
@@ -145,11 +147,12 @@
# See above for the things you may need to add here
#
#LIBS= $(AUTH_LIBS) # use this for Linux, BSDI and friends
-LIBS= -lnsl $(AUTH_LIBS) # use this for SunOS
+LIBS= $(AUTH_LIBS) -lcrypt # use this for FreeBSD
+#LIBS= -lnsl $(AUTH_LIBS) # use this for SunOS
#LIBS= -lnsl -lsocket $(AUTH_LIBS) # use this for Solaris 2.x
# use this for SunOs. Linux, BSDI
-DBMLIBS= -ldbm
+DBMLIBS=
# use this for Solaris
#DBMLIBS=

View File

@ -0,0 +1,24 @@
--- cache.c.orig Sun Sep 1 02:31:42 1996
+++ cache.c Mon Sep 23 21:38:20 1996
@@ -12,13 +12,21 @@
* FOR A PARTICULAR PURPOSE.
*/
+#if defined(_HAVE_PARAM_H)
+#include <sys/param.h>
+#endif
+
#include <sys/types.h>
#include <ctype.h>
#if defined(BSDI)
# include <memory.h>
# include <stdlib.h>
#else
+#if defined(__FreeBSD__)
+# include <stdlib.h>
+#else
# include <malloc.h>
+#endif
#endif
#include <string.h>
#include <sys/time.h>

View File

@ -0,0 +1,29 @@
--- conf.h.orig Thu Sep 19 20:04:29 1996
+++ conf.h Mon Sep 23 21:40:25 1996
@@ -27,6 +27,10 @@
*
*/
+#if defined(_HAVE_PARAM_H)
+#include <sys/param.h>
+#endif
+
#ifndef _conf_h_
#define _conf_h_
@@ -56,11 +60,14 @@
#endif
#endif /* unixware */
+#if (defined(BSD) && (BSD >= 199306))
+#include <stdlib.h>
+#include <sys/types.h>
#if defined(BSDI)
#include <sys/types.h>
#include <machine/inline.h>
#include <machine/endian.h>
-#include <stdlib.h>
+#endif
#else /* BSDI */
#include <malloc.h>
#endif /* BSDI */

View File

@ -0,0 +1,34 @@
--- radiusd.c.orig Thu Sep 19 20:20:38 1996
+++ radiusd.c Mon Sep 23 21:42:03 1996
@@ -40,6 +40,10 @@
static char sccsid[] =
"@(#)radiusd.c 1.17 Copyright 1992 Livingston Enterprises Inc";
+#if defined(_HAVE_PARAM_H)
+#include <sys/param.h>
+#endif
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/file.h>
@@ -151,8 +155,10 @@
#if defined(sys5) || defined(BSDI)
extern char *crypt P__((CONST char *, CONST char *));
#else
+#if ! defined(__FreeBSD__)
extern char *crypt P__((u_char *, u_char *));
#endif
+#endif
static void insertValuePair P__((VALUE_PAIR** list, VALUE_PAIR* pair));
static VALUE_PAIR *copyValuePair P__((VALUE_PAIR* source));
static AUTH_HDR *prepare_send_buffer P__((AUTH_REQ *authreq, int code));
@@ -1727,7 +1733,8 @@
VALUE_PAIR *checkList;
VALUE_PAIR *replyList;
{
- pairfree(authInfo->cutList);
+ if (authInfo->cutList != authInfo->authreq->request)
+ pairfree(authInfo->cutList);
authInfo->cutList = (VALUE_PAIR *)0;
pairfree( checkList );
pairfree( replyList );

View File

@ -0,0 +1,13 @@
--- radius.h.orig Tue Sep 3 03:42:48 1996
+++ radius.h Mon Sep 23 21:42:04 1996
@@ -224,8 +224,8 @@
/* Default Database File Names */
-#define RADIUS_DIR "/etc/raddb"
-#define RADACCT_DIR "/usr/adm/radacct"
+#define RADIUS_DIR "${PREFIX}/etc/raddb"
+#define RADACCT_DIR "/var/log/radacct"
#define RADIUS_DICTIONARY "dictionary"
#define RADIUS_CLIENTS "clients"

View File

@ -0,0 +1,96 @@
--- users.c.orig Thu Sep 19 20:04:29 1996
+++ users.c Mon Sep 23 21:44:51 1996
@@ -30,6 +30,10 @@
static char sccsid[] =
"@(#)users.c 1.12 Copyright 1992 Livingston Enterprises Inc";
+#if defined(_HAVE_PARAM_H)
+#include <sys/param.h>
+#endif
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -48,18 +52,30 @@
# if defined(SOLARIS)
# include </usr/ucbinclude/dbm.h>
# else
+# if defined(USE_NDBM)
+# include <ndbm.h>
+# else
# include <dbm.h>
+# endif
# endif /* SOLARIS */
#endif /* DBM_MODE */
#include "radius.h"
#include "protos.h"
+#if (defined(BSD) && (BSD>=199306))
+#include <fcntl.h>
+#endif
+
extern char *progname;
extern int debug_flag;
extern char *radius_dir;
extern char *radius_users;
+#if (defined(DBM_MODE) && defined(USE_NDBM))
+DBM *dbp;
+#endif
+
static int parse_record P__((char *name, char *linep,
VALUE_PAIR **check_first, VALUE_PAIR **reply_first));
extern int user_read P__((FILE **userfd, char *name, char *content));
@@ -97,7 +113,15 @@
{
#if defined(DBM_MODE)
(void)userfd;
+#if defined(USE_NDBM)
+ if(!(dbp=dbm_open(infoname, O_RDONLY, NULL))) {
+ return(-1);
+ } else {
+ return(0);
+ }
+#else
return dbminit(infoname);
+#endif
#else
*userfd = fopen(infoname, "r");
return *userfd == (FILE *)NULL;
@@ -120,7 +144,11 @@
{
#if defined(DBM_MODE)
(void)userfd;
+#if defined(USE_NDBM)
+ dbm_close(dbp);
+#else
dbmclose();
+#endif
#else
fclose(userfd);
#endif
@@ -210,7 +238,11 @@
#ifdef DBM_MODE
named.dptr = name;
named.dsize = strlen(name)+1;
+#if defined(USE_NDBM)
+ contentd = dbm_fetch(dbp,named);
+#else
contentd = fetch(named);
+#endif
if(contentd.dsize != 0) { /* name found */
*user_data = contentd.dptr;
userinfo_close(userfd);
@@ -219,7 +251,11 @@
named.dptr = "DEFAULT";
named.dsize = sizeof("DEFAULT");
+#if defined(USE_NDBM)
+ contentd = dbm_fetch(dbp,named);
+#else
contentd = fetch(named);
+#endif
if(contentd.dsize != 0) { /* DEFAULT found */
*user_data = contentd.dptr;
userinfo_close(userfd);

View File

@ -0,0 +1,103 @@
--- builddbm.c.orig Wed May 22 20:30:36 1996
+++ builddbm.c Mon Sep 23 21:48:02 1996
@@ -30,6 +30,10 @@
static char sccsid[] =
"@(#)builddbm.c 1.4 Copyright 1992 Livingston Enterprises Inc";
+#if defined(_HAVE_PARAM_H)
+#include <sys/param.h>
+#endif
+
#if defined(SOLARIS)
# include <sys/uio.h>
# include <unistd.h>
@@ -37,7 +41,11 @@
# include <fcntl.h>
# include </usr/ucbinclude/dbm.h>
#else
+#if defined(USE_NDBM)
+# include <ndbm.h>
+#else
# include <dbm.h>
+#endif
#endif /* SOLARIS */
#include <sys/types.h>
@@ -59,8 +67,13 @@
char *progname;
char *radius_dir;
char *radius_users;
+#if defined(USE_NDBM)
+char dbfile[256];
+DBM *dbp;
+#else
char pagfile[256];
char dirfile[256];
+#endif
char dbmname[256];
FILE *userfd;
FILE *errf;
@@ -124,6 +137,20 @@
}
}
+#if defined(USE_NDBM)
+ sprintf(dbfile, "%s/%s.db", radius_dir, radius_users);
+ if((fd = open(dbfile, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0) {
+ fprintf(errf, "%s: Couldn't open %s for writing\n",
+ progname, dbfile);
+ exit(-1);
+ }
+ close(fd);
+ sprintf(dbmname, "%s/%s", radius_dir, radius_users);
+ if(!(dbp=dbm_open(dbmname, O_RDWR | O_CREAT | O_TRUNC, 0600))) {
+ fprintf(errf, "%s: Couldn't dbm_open(%s)\n",
+ progname, dbmname);
+ }
+#else
sprintf(pagfile, "%s/%s.pag", radius_dir, radius_users);
if((fd = open(pagfile, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0) {
fprintf(errf, "%s: Couldn't open %s for writing\n",
@@ -143,7 +170,7 @@
fprintf(errf, "%s: Couldn't dbminit(%s)\n", progname, dbmname);
exit(-1);
}
-
+#endif
userfd = (FILE *)NULL;
curParseLine = 0;
while(user_read(&userfd, name, content) == 0) {
@@ -153,7 +180,11 @@
}
named.dptr = name;
named.dsize = strlen(name)+1;
+#if defined(USE_NDBM)
+ contentd = dbm_fetch(dbp,named);
+#else
contentd = fetch(named);
+#endif
if(contentd.dsize != 0) { /* name found */
warn("Skipping duplicate record\n\tfor user '%s'", name);
continue;
@@ -162,13 +193,21 @@
named.dsize = strlen(name)+1;
contentd.dptr = content;
contentd.dsize = strlen(content)+1;
+#if defined(USE_NDBM)
+ if(dbm_store(dbp, named, contentd, DBM_INSERT) < 0) {
+#else
if(store(named, contentd) != 0) {
+#endif
fprintf(errf, "%s: Couldn't store datum for %s\n",
progname, name);
exit(-1);
}
}
+#if defined(USE_NDBM)
+ dbm_close(dbp);
+#else
dbmclose();
+#endif
exit(0);
}

View File

@ -0,0 +1 @@
The Ascend modified Radius Daemon

View File

View File

@ -0,0 +1,18 @@
sbin/radiusd
sbin/radiusd.dbm
sbin/builddbm
man/man1/users-file-syntax.1.gz
man/man1/builddbm.1.gz
share/doc/ascend-radius/ascend.doc
share/doc/ascend-radius/draft-ietf-radius-accounting-01.txt
share/doc/ascend-radius/draft-ietf-radius-radius-03.txt
share/doc/ascend-radius/draft-ietf-radius-radius-04.txt
share/doc/ascend-radius/ChangeLog
share/doc/ascend-radius/README
share/doc/ascend-radius/README.cexample
share/doc/ascend-radius/README.dict
etc/raddb/clients.example
etc/raddb/dictionary
etc/raddb/users.example
@dirrm share/doc/ascend-radius
@dirrm etc/raddb

6
net/ascend-radius/scripts/configure vendored Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
cd $WRKSRC || exit 1
cp radius.h radius.h.old
sed -e "s:@@PREFIX@@:$PREFIX:g" < radius.h.old > radius.h