X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/afc8f4c6c019f3cd4c8c28fbf7948b594de08658..6a4b3f3e9805660fca80d56799b7b6d421383165:/radius.c diff --git a/radius.c b/radius.c index 8799622..ce1d39e 100644 --- a/radius.c +++ b/radius.c @@ -1,6 +1,6 @@ // L2TPNS Radius Stuff -char const *cvs_id_radius = "$Id: radius.c,v 1.37 2005/07/31 10:04:10 bodea Exp $"; +char const *cvs_id_radius = "$Id: radius.c,v 1.41 2005/08/31 12:41:09 bodea Exp $"; #include #include @@ -13,7 +13,7 @@ char const *cvs_id_radius = "$Id: radius.c,v 1.37 2005/07/31 10:04:10 bodea Exp #include #include #include -#include +#include "md5.h" #include "constants.h" #include "l2tpns.h" #include "plugin.h" @@ -265,13 +265,11 @@ void radiussend(uint16_t r, uint8_t state) p[1] = 6; *(uint32_t *) (p + 2) = htonl(session[s].cout); p += p[1]; - if (state == RADIUSSTOP) - { - *p = 46; // session time - p[1] = 6; - *(uint32_t *) (p + 2) = htonl(time(NULL) - session[s].opened); - p += p[1]; - } + + *p = 46; // session time + p[1] = 6; + *(uint32_t *) (p + 2) = htonl(time(NULL) - session[s].opened); + p += p[1]; *p = 47; // input packets p[1] = 6; @@ -416,7 +414,7 @@ static void handle_avpair(sessionidt s, uint8_t *avp, int len) // process RADIUS response void processrad(uint8_t *buf, int len, char socket_index) { - uint8_t b[MAXCONTROL]; + uint8_t b[MAXETHER]; MD5_CTX ctx; uint16_t r; sessionidt s; @@ -495,7 +493,7 @@ void processrad(uint8_t *buf, int len, char socket_index) if (radius[r].chap) { // CHAP - uint8_t *p = makeppp(b, sizeof(b), 0, 0, t, s, PPPCHAP); + uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPCHAP); if (!p) return; // Abort! *p = (r_code == AccessAccept) ? 3 : 4; // ack/nak @@ -509,7 +507,7 @@ void processrad(uint8_t *buf, int len, char socket_index) else { // PAP - uint8_t *p = makeppp(b, sizeof(b), 0, 0, t, s, PPPPAP); + uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPPAP); if (!p) return; // Abort! // ack/nak @@ -714,7 +712,7 @@ void processrad(uint8_t *buf, int len, char socket_index) // Valid Session, set it up session[s].unique_id = 0; - sessionsetup(t, s); + sessionsetup(s, t); } else { @@ -741,7 +739,7 @@ void radiusretry(uint16_t r) switch (radius[r].state) { case RADIUSCHAP: // sending CHAP down PPP - sendchap(t, s); + sendchap(s, t); break; case RADIUSAUTH: // sending auth to RADIUS server case RADIUSSTART: // sending start accounting to RADIUS server