- pull in fix from latest snapshot for calc_acctdigest() overflow

- srand()/rand() changed to arc4random()
- bump PKGNAME
This commit is contained in:
danh 2001-11-20 18:54:55 +00:00
parent 981f2e137f
commit 3d9e62ce64
4 changed files with 84 additions and 2 deletions

View File

@ -1,8 +1,10 @@
# $OpenBSD: Makefile,v 1.12 2001/11/13 20:31:23 danh Exp $
# $OpenBSD: Makefile,v 1.13 2001/11/20 18:54:55 danh Exp $
COMMENT= "Cistron RADIUS server"
DISTNAME= radiusd-cistron-1.6.4
VERSION= 1.6.4
DISTNAME= radiusd-cistron-${VERSION}
PKGNAME= radiusd-cistron-${VERSION}p1
CATEGORIES= net
NEED_VERSION= 1.496
MASTER_SITES= ftp://ftp.radius.cistron.nl/pub/radius/ \

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_proxy_c,v 1.1 2001/11/20 18:54:55 danh Exp $
--- src/proxy.c.orig Tue Nov 20 12:59:28 2001
+++ src/proxy.c Tue Nov 20 13:00:39 2001
@@ -53,9 +53,8 @@ void random_vector(char *vector)
int randno;
int i;
- srand(time(0) + getpid());
for(i = 0;i < AUTH_VECTOR_LEN;) {
- randno = rand();
+ randno = arc4random();
memcpy(vector, &randno, sizeof(int));
vector += sizeof(int);
i += sizeof(int);

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-src_radius_c,v 1.1 2001/11/20 18:54:55 danh Exp $
--- src/radius.c.orig Tue Nov 20 13:26:31 2001
+++ src/radius.c Tue Nov 20 13:33:21 2001
@@ -267,10 +267,11 @@ int calc_digest(u_char *digest, AUTH_REQ
*/
int calc_acctdigest(u_char *digest, AUTH_REQ *authreq)
{
- int secretlen;
+ char zero[AUTH_VECTOR_LEN];
+ char *recvbuf = authreq->data;
+ char *tmpbuf;
CLIENT *cl;
- char zero[AUTH_VECTOR_LEN];
- char * recvbuf = authreq->data;
+ int secretlen;
int len = authreq->data_len;
/*
@@ -283,13 +284,6 @@ int calc_acctdigest(u_char *digest, AUTH
}
/*
- * Copy secret into authreq->secret so that we can
- * use it with send_acct_reply()
- */
- secretlen = strlen(cl->secret);
- strNcpy(authreq->secret, cl->secret, sizeof(authreq->secret));
-
- /*
* Older clients have the authentication vector set to
* all zeros. Return `1' in that case.
*/
@@ -303,9 +297,17 @@ int calc_acctdigest(u_char *digest, AUTH
* and calculate the MD5 sum. This must be the same
* as the original MD5 sum (authreq->vector).
*/
+ secretlen = strlen(authreq->secret);
memset(recvbuf + 4, 0, AUTH_VECTOR_LEN);
- memcpy(recvbuf + len, cl->secret, secretlen);
- md5_calc(digest, recvbuf, len + secretlen);
+
+ if ((tmpbuf = malloc(len + secretlen)) == NULL) {
+ log(L_ERR|L_CONS, "no memory");
+ exit(1);
+ }
+ memcpy(tmpbuf, recvbuf, len);
+ memcpy(tmpbuf + len, authreq->secret, secretlen);
+ md5_calc(digest, tmpbuf, len + secretlen);
+ free(tmpbuf);
/*
* Return 0 if OK, 2 if not OK.

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_radtest_c,v 1.1 2001/11/20 18:54:55 danh Exp $
--- src/radtest.c.orig Tue Nov 20 13:04:08 2001
+++ src/radtest.c Tue Nov 20 13:04:26 2001
@@ -262,9 +262,8 @@ static void random_vector(char *vector)
int randno;
int i;
- srand(time(0));
for(i = 0;i < AUTH_VECTOR_LEN;) {
- randno = rand();
+ randno = arc4random();
memcpy(vector, &randno, sizeof(int));
vector += sizeof(int);
i += sizeof(int);