When doing Add-Port-To-IP-Address, do NOT over-write the 'tmp'
authoraland <aland>
Thu, 12 Apr 2001 15:26:46 +0000 (15:26 +0000)
committeraland <aland>
Thu, 12 Apr 2001 15:26:46 +0000 (15:26 +0000)
variable with another value-pair.  This bug probably comes from
using names for variables like 'tmp', which makes it hard to
remember which variable is what.

Patch from "Paul Coward" <paul@asgard.net.au>

src/main/auth.c

index 08bf17a..b9a25a1 100644 (file)
@@ -664,18 +664,19 @@ int rad_authenticate(REQUEST *request)
         */
        if ((tmp = pairfind(request->reply->vps, 
                        PW_FRAMED_IP_ADDRESS)) != NULL) {
-               VALUE_PAIR *tmp2;
+               VALUE_PAIR *vpPortId;
+               VALUE_PAIR *vpAddPort;
 
                /*
                 *  Find the NAS port ID.
                 */
-               if ((tmp = pairfind(request->packet->vps,
+               if ((vpPortId = pairfind(request->packet->vps,
                                PW_NAS_PORT_ID)) != NULL)
-                       nas_port = tmp->lvalue;
+                       nas_port = vpPortId->lvalue;
 
-               if((tmp2 = pairfind(request->reply->vps,
+               if((vpAddPort = pairfind(request->reply->vps,
                                PW_ADD_PORT_TO_IP_ADDRESS)) != NULL) {
-                       if (tmp->addport || (tmp2 && tmp2->lvalue)) {
+                       if (tmp->addport || (vpAddPort && vpAddPort->lvalue)) {
                                tmp->lvalue = htonl(ntohl(tmp->lvalue) + nas_port);
                                tmp->addport = 0;
                        }