Rename vp->lvalue to vp->vp_*, as appropriate.
authoraland <aland>
Tue, 17 Apr 2007 13:14:50 +0000 (13:14 +0000)
committeraland <aland>
Tue, 17 Apr 2007 13:14:50 +0000 (13:14 +0000)
Only the EAP module is left.  Once that's done, we can remove
vp->lvalue

27 files changed:
src/modules/rlm_acctlog/rlm_acctlog.c
src/modules/rlm_attr_rewrite/rlm_attr_rewrite.c
src/modules/rlm_checkval/rlm_checkval.c
src/modules/rlm_counter/rlm_counter.c
src/modules/rlm_dbm/rlm_dbm.c
src/modules/rlm_dbm/rlm_dbm_parser.c
src/modules/rlm_detail/rlm_detail.c
src/modules/rlm_expiration/rlm_expiration.c
src/modules/rlm_expr/paircmp.c
src/modules/rlm_fastusers/rlm_fastusers.c
src/modules/rlm_files/rlm_files.c
src/modules/rlm_ippool/rlm_ippool.c
src/modules/rlm_logintime/rlm_logintime.c
src/modules/rlm_mschap/rlm_mschap.c
src/modules/rlm_pap/rlm_pap.c
src/modules/rlm_passwd/rlm_passwd.c
src/modules/rlm_perl/rlm_perl.c
src/modules/rlm_preprocess/rlm_preprocess.c
src/modules/rlm_radutmp/rlm_radutmp.c
src/modules/rlm_radutmp/rlm_radutmp2.c
src/modules/rlm_realm/rlm_realm.c
src/modules/rlm_sql/rlm_sql.c
src/modules/rlm_sql_log/rlm_sql_log.c
src/modules/rlm_sqlcounter/rlm_sqlcounter.c
src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c
src/modules/rlm_sqlippool/rlm_sqlippool.c
src/modules/rlm_unix/rlm_unix.c

index fee4979..59b8c26 100644 (file)
@@ -86,7 +86,7 @@ static int do_acctlog_acct(void *instance, REQUEST *request)
        inst = (rlm_acctlog_t*) instance;
 
     if ((pair = pairfind(request->packet->vps, PW_ACCT_STATUS_TYPE)) != NULL) {
-        acctstatustype = pair->lvalue;
+        acctstatustype = pair->vp_integer;
     } else {
         radius_xlat(logstr, sizeof(logstr), "packet has no accounting status type. [user '%{User-Name}', nas '%{NAS-IP-Address}']", request, NULL);
         radlog(L_ERR, "rlm_acctlog (%s)", logstr);
index 4fb55fd..de5eeb6 100644 (file)
@@ -285,7 +285,7 @@ do_again:
                
                if ((attr_vp->type == PW_TYPE_IPADDR) &&
                    (attr_vp->vp_strvalue[0] == '\0')) {
-                 inet_ntop(AF_INET, &(attr_vp->lvalue),
+                 inet_ntop(AF_INET, &(attr_vp->vp_ipaddr),
                            attr_vp->vp_strvalue,
                            sizeof(attr_vp->vp_strvalue));
                }
index 267b3e0..60b9994 100644 (file)
@@ -230,6 +230,8 @@ static int do_checkval(void *instance, REQUEST *request)
 
                /*
                * Check if item != check
+               *
+               *       FIXME:  !!! Call normal API functions!
                */
                found = 1;
                if (data->dat_type == PW_TYPE_STRING ||
@@ -244,10 +246,13 @@ static int do_checkval(void *instance, REQUEST *request)
                                else
                                        ret = RLM_MODULE_REJECT;
                        }
-               }
-               else{   /* Integer or Date */
-
-                       if (item_vp->lvalue == chk_vp->lvalue)
+               } else if (data->dat_type == PW_TYPE_DATE) {
+                       if (item_vp->vp_date == chk_vp->vp_date)
+                               ret = RLM_MODULE_OK;
+                       else
+                               ret = RLM_MODULE_REJECT;
+               } else if (data->dat_type == PW_TYPE_INTEGER) {
+                       if (item_vp->vp_integer == chk_vp->vp_integer)
                                ret = RLM_MODULE_OK;
                        else
                                ret = RLM_MODULE_REJECT;
index 5dae38a..e9d5e51 100644 (file)
@@ -161,7 +161,7 @@ static int counter_cmp(void *instance,
        memcpy(&counter, count_datum.dptr, sizeof(rad_counter));
        free(count_datum.dptr);
 
-       return counter.user_counter - check->lvalue;
+       return counter.user_counter - check->vp_integer;
 }
 
 
@@ -573,7 +573,7 @@ static int counter_accounting(void *instance, REQUEST *request)
        time_t diff;
 
        if ((key_vp = pairfind(request->packet->vps, PW_ACCT_STATUS_TYPE)) != NULL)
-               acctstatustype = key_vp->lvalue;
+               acctstatustype = key_vp->vp_integer;
        else {
                DEBUG("rlm_counter: Could not find account status type in packet.");
                return RLM_MODULE_NOOP;
@@ -610,7 +610,7 @@ static int counter_accounting(void *instance, REQUEST *request)
                        DEBUG("rlm_counter: Could not find Service-Type attribute in the request. Returning NOOP.");
                        return RLM_MODULE_NOOP;
                }
-               if ((unsigned)proto_vp->lvalue != data->service_val){
+               if ((unsigned)proto_vp->vp_integer != data->service_val){
                        DEBUG("rlm_counter: This Service-Type is not allowed. Returning NOOP.");
                        return RLM_MODULE_NOOP;
                }
@@ -621,8 +621,8 @@ static int counter_accounting(void *instance, REQUEST *request)
         */
        key_vp = pairfind(request->packet->vps, PW_ACCT_DELAY_TIME);
        if (key_vp != NULL){
-               if (key_vp->lvalue != 0 &&
-                   (request->timestamp - key_vp->lvalue) < data->last_reset){
+               if (key_vp->vp_integer != 0 &&
+                   (request->timestamp - key_vp->vp_integer) < data->last_reset){
                        DEBUG("rlm_counter: This packet is too old. Returning NOOP.");
                        return RLM_MODULE_NOOP;
                }
@@ -695,14 +695,14 @@ static int counter_accounting(void *instance, REQUEST *request)
                 *      day). That is the right thing
                 */
                diff = request->timestamp - data->last_reset;
-               counter.user_counter += (count_vp->lvalue < diff) ? count_vp->lvalue : diff;
+               counter.user_counter += (count_vp->vp_integer < diff) ? count_vp->vp_integer : diff;
 
        } else if (count_vp->type == PW_TYPE_INTEGER) {
                /*
                 *      Integers get counted, without worrying about
                 *      reset dates.
                 */
-               counter.user_counter += count_vp->lvalue;
+               counter.user_counter += count_vp->vp_integer;
 
        } else {
                /*
@@ -813,8 +813,8 @@ static int counter_authorize(void *instance, REQUEST *request)
        /*
         * Check if check item > counter
         */
-       DEBUG("rlm_counter: Check item = %d, Count = %d",check_vp->lvalue,counter.user_counter);
-       res=check_vp->lvalue - counter.user_counter;
+       DEBUG("rlm_counter: Check item = %d, Count = %d",check_vp->vp_integer,counter.user_counter);
+       res=check_vp->vp_integer - counter.user_counter;
        if (res > 0) {
                DEBUG("rlm_counter: res is greater than zero");
                if (data->count_attr == PW_ACCT_SESSION_TIME) {
@@ -845,32 +845,32 @@ static int counter_authorize(void *instance, REQUEST *request)
                        if (data->reset_time && (
                                res >= (data->reset_time - request->timestamp))) {
                                res = data->reset_time - request->timestamp;
-                               res += check_vp->lvalue;
+                               res += check_vp->vp_integer;
                        }
 
                        if ((reply_item = pairfind(request->reply->vps, PW_SESSION_TIMEOUT)) != NULL) {
-                               if (reply_item->lvalue > res)
-                                       reply_item->lvalue = res;
+                               if (reply_item->vp_integer > res)
+                                       reply_item->vp_integer = res;
                        } else {
                                if ((reply_item = paircreate(PW_SESSION_TIMEOUT, PW_TYPE_INTEGER)) == NULL) {
                                        radlog(L_ERR|L_CONS, "no memory");
                                        return RLM_MODULE_NOOP;
                                }
-                               reply_item->lvalue = res;
+                               reply_item->vp_integer = res;
                                pairadd(&request->reply->vps, reply_item);
                        }
                }
                else if (data->reply_attr) {
                        if ((reply_item = pairfind(request->reply->vps, data->reply_attr)) != NULL) {
-                               if (reply_item->lvalue > res)
-                                       reply_item->lvalue = res;
+                               if (reply_item->vp_integer > res)
+                                       reply_item->vp_integer = res;
                        }
                        else {
                                if ((reply_item = paircreate(data->reply_attr, PW_TYPE_INTEGER)) == NULL) {
                                        radlog(L_ERR|L_CONS, "no memory");
                                        return RLM_MODULE_NOOP;
                                }
-                               reply_item->lvalue = res;
+                               reply_item->vp_integer = res;
                                pairadd(&request->reply->vps, reply_item);
                        }
                }
@@ -879,7 +879,7 @@ static int counter_authorize(void *instance, REQUEST *request)
 
                DEBUG2("rlm_counter: (Check item - counter) is greater than zero");
                DEBUG2("rlm_counter: Authorized user %s, check_item=%d, counter=%d",
-                               key_vp->vp_strvalue,check_vp->lvalue,counter.user_counter);
+                               key_vp->vp_strvalue,check_vp->vp_integer,counter.user_counter);
                DEBUG2("rlm_counter: Sent Reply-Item for user %s, Type=Session-Timeout, value=%d",
                                key_vp->vp_strvalue,res);
        }
@@ -901,7 +901,7 @@ static int counter_authorize(void *instance, REQUEST *request)
                ret=RLM_MODULE_REJECT;
 
                DEBUG2("rlm_counter: Rejected user %s, check_item=%d, counter=%d",
-                               key_vp->vp_strvalue,check_vp->lvalue,counter.user_counter);
+                               key_vp->vp_strvalue,check_vp->vp_integer,counter.user_counter);
        }
 
        return ret;
index 94c0471..ed48ff3 100644 (file)
@@ -132,7 +132,7 @@ static int isfallthrough(VALUE_PAIR *vp) {
   VALUE_PAIR * tmp;
 
   tmp = pairfind(vp, PW_FALL_THROUGH);
-  return tmp ? tmp -> lvalue : 1; /* if no  FALL_THROUGH - keep looking */
+  return tmp ? tmp -> vp_integer : 1; /* if no  FALL_THROUGH - keep looking */
 }
 
 /* sm_parse_user
index b443fee..7c7cfd3 100644 (file)
@@ -72,14 +72,13 @@ unsigned long       st_errors = 0,
 
 /*  test
 
-int dumplist(VALUE_PAIR *vp) {
-
+int dumplist(VALUE_PAIR *vp)
+{
+       char buffer[1024];
        while (vp != NULL) {
-
-               printf("VP: name: %s\nattribute: %d\ntype: %d\nlvalue: %lu"
-                       "\noperator %d\naddport: %d\nValue: %s\n",
-                       vp -> name, vp -> attribute, vp -> type, vp -> lvalue,
-                       vp -> operator, vp -> addport, (char*)vp -> strvalue);
+               vp_prints(buffer, sizeof(buffer), vp);
+       
+               printf("\t%s\n", buffer);
                vp = vp -> next;
        }
        return 0;
index a7df46b..650844c 100644 (file)
@@ -376,10 +376,10 @@ static int do_detail(void *instance, REQUEST *request, RADIUS_PACKET *packet,
                case AF_INET:
                        src_vp.type = PW_TYPE_IPADDR;
                        src_vp.attribute = PW_PACKET_SRC_IP_ADDRESS;
-                       src_vp.lvalue = packet->src_ipaddr.ipaddr.ip4addr.s_addr;
+                       src_vp.vp_ipaddr = packet->src_ipaddr.ipaddr.ip4addr.s_addr;
                        dst_vp.type = PW_TYPE_IPADDR;
                        dst_vp.attribute = PW_PACKET_DST_IP_ADDRESS;
-                       dst_vp.lvalue = packet->dst_ipaddr.ipaddr.ip4addr.s_addr;
+                       dst_vp.vp_ipaddr = packet->dst_ipaddr.ipaddr.ip4addr.s_addr;
                        break;
                case AF_INET6:
                        src_vp.type = PW_TYPE_IPV6ADDR; 
@@ -406,10 +406,10 @@ static int do_detail(void *instance, REQUEST *request, RADIUS_PACKET *packet,
 
                src_vp.attribute = PW_PACKET_SRC_PORT;
                src_vp.type = PW_TYPE_INTEGER;
-               src_vp.lvalue = packet->src_port;
+               src_vp.vp_integer = packet->src_port;
                dst_vp.attribute = PW_PACKET_DST_PORT;
                dst_vp.type = PW_TYPE_INTEGER;
-               dst_vp.lvalue = packet->dst_port;
+               dst_vp.vp_integer = packet->dst_port;
 
                fputs("\t", outfp);
                vp_print(outfp, &src_vp);
index 5b89b0f..0d039b4 100644 (file)
@@ -73,7 +73,7 @@ static int expiration_authorize(void *instance, REQUEST *request)
                *      why they're being rejected.
                */
                DEBUG("rlm_expiration: Checking Expiration time: '%s'",check_item->vp_strvalue);
-               if (((time_t) check_item->lvalue) <= request->timestamp) {
+               if (((time_t) check_item->vp_date) <= request->timestamp) {
                        char logstr[MAX_STRING_LEN];
                        VALUE_PAIR *module_fmsg_vp;
 
@@ -107,10 +107,10 @@ static int expiration_authorize(void *instance, REQUEST *request)
                                return RLM_MODULE_FAIL;
                        }
                        pairadd(&request->reply->vps, vp);
-                       vp->lvalue = (uint32_t) (((time_t) check_item->lvalue) - request->timestamp);
+                       vp->vp_date = (uint32_t) (((time_t) check_item->vp_date) - request->timestamp);
 
-               } else if (vp->lvalue > ((uint32_t) (((time_t) check_item->lvalue) - request->timestamp))) {
-                       vp->lvalue = (uint32_t) (((time_t) check_item->lvalue) - request->timestamp);
+               } else if (vp->vp_date > ((uint32_t) (((time_t) check_item->vp_date) - request->timestamp))) {
+                       vp->vp_date = (uint32_t) (((time_t) check_item->vp_date) - request->timestamp);
                }
        }
        else
@@ -134,7 +134,7 @@ static int expirecmp(void *instance, REQUEST *req,
 
        now = (req) ? req->timestamp : time(NULL);
   
-       if (now <= ((time_t) check->lvalue))
+       if (now <= ((time_t) check->vp_date))
                return 0;
        return +1;
 }
@@ -142,8 +142,6 @@ static int expirecmp(void *instance, REQUEST *req,
 
 static int expiration_detach(void *instance)
 {
-       rlm_expiration_t *data = (rlm_expiration_t *) instance;
-
        paircompare_unregister(PW_EXPIRATION, expirecmp);
        free(instance);
        return 0;
index 9c101ec..b933530 100644 (file)
@@ -43,7 +43,7 @@ static int connectcmp(void *instance,
        reply_pairs = reply_pairs;
 
        rate = atoi((char *)request->vp_strvalue);
-       return rate - check->lvalue;
+       return rate - check->vp_integer;
 }
 
 
@@ -57,7 +57,7 @@ static int portcmp(void *instance,
        char buf[MAX_STRING_LEN];
        char *s, *p;
        uint32_t lo, hi;
-       uint32_t port = request->lvalue;
+       uint32_t port = request->vp_integer;
 
        instance = instance;
        check_pairs = check_pairs; /* shut the compiler up */
@@ -65,7 +65,7 @@ static int portcmp(void *instance,
 
        if ((strchr((char *)check->vp_strvalue, ',') == NULL) &&
                        (strchr((char *)check->vp_strvalue, '-') == NULL)) {
-               return (request->lvalue - check->lvalue);
+               return (request->vp_integer - check->vp_integer);
        }
 
        /* Same size */
@@ -141,7 +141,7 @@ static int presufcmp(void *instance,
         *      If Strip-User-Name == No, then don't do any more.
         */
        vp = pairfind(check_pairs, PW_STRIP_USER_NAME);
-       if (vp && !vp->lvalue) return ret;
+       if (vp && !vp->vp_integer) return ret;
 
        /*
         *      See where to put the stripped user name.
@@ -162,50 +162,6 @@ static int presufcmp(void *instance,
 
 
 /*
- *     Matches if there is NO SUCH ATTRIBUTE as the one named
- *     in check->vp_strvalue.  If there IS such an attribute, it
- *     doesn't match.
- *
- *     This is ugly, and definitely non-optimal.  We should be
- *     doing the lookup only ONCE, and storing the result
- *     in check->lvalue...
- */
-static int attrcmp(void *instance,
-                  REQUEST *req UNUSED,
-                  VALUE_PAIR *request, VALUE_PAIR *check,
-                  VALUE_PAIR *check_pairs, VALUE_PAIR **reply_pairs)
-{
-       VALUE_PAIR *pair;
-       DICT_ATTR  *dict;
-       int attr;
-
-       instance = instance;
-       check_pairs = check_pairs; /* shut the compiler up */
-       reply_pairs = reply_pairs;
-
-       if (check->lvalue == 0) {
-               dict = dict_attrbyname((char *)check->vp_strvalue);
-               if (dict == NULL) {
-                       return -1;
-               }
-               attr = dict->attr;
-       } else {
-               attr = check->lvalue;
-       }
-
-       /*
-        *      If there's no such attribute, then return MATCH,
-        *      else FAILURE.
-        */
-       pair = pairfind(request, attr);
-       if (pair == NULL) {
-               return 0;
-       }
-
-       return -1;
-}
-
-/*
  *     Compare the request packet type.
  */
 static int packetcmp(void *instance UNUSED, REQUEST *req,
@@ -214,7 +170,7 @@ static int packetcmp(void *instance UNUSED, REQUEST *req,
                     VALUE_PAIR *check_pairs UNUSED,
                     VALUE_PAIR **reply_pairs UNUSED)
 {
-       if (req->packet->code == check->lvalue) {
+       if (req->packet->code == check->vp_integer) {
                return 0;
        }
 
@@ -231,7 +187,7 @@ static int responsecmp(void *instance UNUSED,
                       VALUE_PAIR *check_pairs UNUSED,
                       VALUE_PAIR **reply_pairs UNUSED)
 {
-       if (req->reply->code == check->lvalue) {
+       if (req->reply->code == check->vp_integer) {
                return 0;
        }
 
@@ -296,7 +252,6 @@ void pair_builtincompare_init(void)
        paircompare_register(PW_PREFIX, PW_USER_NAME, presufcmp, NULL);
        paircompare_register(PW_SUFFIX, PW_USER_NAME, presufcmp, NULL);
        paircompare_register(PW_CONNECT_RATE, PW_CONNECT_INFO, connectcmp, NULL);
-       paircompare_register(PW_NO_SUCH_ATTRIBUTE, 0, attrcmp, NULL);
        paircompare_register(PW_PACKET_TYPE, 0, packetcmp, NULL);
        paircompare_register(PW_RESPONSE_PACKET_TYPE, 0, responsecmp, NULL);
 
@@ -313,7 +268,6 @@ void pair_builtincompare_detach(void)
        paircompare_unregister(PW_PREFIX, presufcmp);
        paircompare_unregister(PW_SUFFIX, presufcmp);
        paircompare_unregister(PW_CONNECT_RATE, connectcmp);
-       paircompare_unregister(PW_NO_SUCH_ATTRIBUTE, attrcmp);
        paircompare_unregister(PW_PACKET_TYPE, packetcmp);
        paircompare_unregister(PW_RESPONSE_PACKET_TYPE, responsecmp);
 
index 61731b9..e855ff0 100644 (file)
@@ -87,7 +87,7 @@ static int fallthrough(VALUE_PAIR *vp)
 {
        VALUE_PAIR *tmp;
        tmp = pairfind(vp, PW_FALL_THROUGH);
-       return tmp ? tmp->lvalue : 0;
+       return tmp ? tmp->vp_integer : 0;
 }
 
 /*
@@ -103,7 +103,7 @@ static int rad_check_return(VALUE_PAIR *list)
        */
 
       authtype = pairfind(list, PW_AUTHTYPE);
-      if((authtype) && authtype->lvalue == PW_AUTHTYPE_REJECT)  {
+      if((authtype) && authtype->vp_integer == PW_AUTHTYPE_REJECT)  {
               DEBUG2("rad_check_return:  Auth-Type is Reject");
               return RLM_MODULE_REJECT;
       }
index 47858fd..4746ac9 100644 (file)
@@ -70,7 +70,7 @@ static int fallthrough(VALUE_PAIR *vp)
        VALUE_PAIR *tmp;
        tmp = pairfind(vp, PW_FALL_THROUGH);
 
-       return tmp ? tmp->lvalue : 0;
+       return tmp ? tmp->vp_integer : 0;
 }
 
 static const CONF_PARSER module_config[] = {
index b8ac0cd..d9b707b 100644 (file)
@@ -327,7 +327,7 @@ static int ippool_accounting(void *instance, REQUEST *request)
 
 
        if ((vp = pairfind(request->packet->vps, PW_ACCT_STATUS_TYPE)) != NULL)
-               acctstatustype = vp->lvalue;
+               acctstatustype = vp->vp_integer;
        else {
                DEBUG("rlm_ippool: Could not find account status type in packet. Return NOOP.");
                return RLM_MODULE_NOOP;
@@ -731,7 +731,7 @@ static int ippool_postauth(void *instance, REQUEST *request)
                entry.active = 1;
                entry.timestamp = request->timestamp;
                if ((vp = pairfind(request->reply->vps, PW_SESSION_TIMEOUT)) != NULL)   
-                       entry.timeout = (time_t) vp->lvalue;
+                       entry.timeout = (time_t) vp->vp_integer;
                else
                        entry.timeout = 0;
                if (extra)
@@ -779,8 +779,8 @@ static int ippool_postauth(void *instance, REQUEST *request)
                        radlog(L_ERR|L_CONS, "no memory");
                        return RLM_MODULE_FAIL;
                }
-               vp->lvalue = entry.ipaddr;
-               ip_ntoa(vp->vp_strvalue, vp->lvalue);
+               vp->vp_ipaddr = entry.ipaddr;
+               ip_ntoa(vp->vp_strvalue, vp->vp_ipaddr);
                pairadd(&request->reply->vps, vp);
 
                /*
@@ -791,8 +791,8 @@ static int ippool_postauth(void *instance, REQUEST *request)
                        if ((vp = paircreate(PW_FRAMED_IP_NETMASK, PW_TYPE_IPADDR)) == NULL)
                                radlog(L_ERR|L_CONS, "no memory");
                        else {
-                               vp->lvalue = ntohl(data->netmask);
-                               ip_ntoa(vp->vp_strvalue, vp->lvalue);
+                               vp->vp_integer = ntohl(data->netmask);
+                               ip_ntoa(vp->vp_strvalue, vp->vp_integer);
                                pairadd(&request->reply->vps, vp);
                        }
                }
index 03ca05a..f23db7d 100644 (file)
@@ -221,14 +221,14 @@ static int logintime_authorize(void *instance, REQUEST *request)
                         */
                        DEBUG("rlm_logintime: timestr returned accept");
                        if ((reply_item = pairfind(request->reply->vps, PW_SESSION_TIMEOUT)) != NULL) {
-                               if (reply_item->lvalue > (unsigned) r)
-                                       reply_item->lvalue = r;
+                               if (reply_item->vp_integer > (unsigned) r)
+                                       reply_item->vp_integer = r;
                        } else {
                                if ((reply_item = paircreate( PW_SESSION_TIMEOUT, PW_TYPE_INTEGER)) == NULL) {
                                        radlog(L_ERR|L_CONS, "no memory");
                                        return RLM_MODULE_FAIL;
                                }
-                               reply_item->lvalue = r;
+                               reply_item->vp_integer = r;
                                pairadd(&request->reply->vps, reply_item);
                        }
                        DEBUG("rlm_logintime: Session-Timeout set to: %d",r);
index 3ce0c6d..8fdb8d3 100644 (file)
@@ -746,7 +746,7 @@ static int do_mschap(rlm_mschap_t *inst,
         */
        vp = pairfind(request->config_items,
                      PW_MS_CHAP_USE_NTLM_AUTH);
-       if (vp) do_ntlm_auth = vp->lvalue;
+       if (vp) do_ntlm_auth = vp->vp_integer;
 
        /*
         *      No ntlm_auth configured, attribute to tell us to
@@ -1040,7 +1040,7 @@ static int mschap_authenticate(void * instance, REQUEST *request)
                if (password) {
                        smb_ctrl = pairmake("SMB-Account-CTRL", "0", T_OP_SET);
                        pairadd(&request->config_items, smb_ctrl);
-                       smb_ctrl->lvalue = pdb_decode_acct_ctrl(password->vp_strvalue);
+                       smb_ctrl->vp_integer = pdb_decode_acct_ctrl(password->vp_strvalue);
                }
        }
 
@@ -1052,7 +1052,7 @@ static int mschap_authenticate(void * instance, REQUEST *request)
                /*
                 *      Password is not required.
                 */
-               if ((smb_ctrl->lvalue & ACB_PWNOTREQ) != 0) {
+               if ((smb_ctrl->vp_integer & ACB_PWNOTREQ) != 0) {
                        DEBUG2("  rlm_mschap: SMB-Account-Ctrl says no password is required.");
                        return RLM_MODULE_OK;
                }
@@ -1289,8 +1289,8 @@ static int mschap_authenticate(void * instance, REQUEST *request)
                 *      They're found, but they don't exist, so we
                 *      return 'not found'.
                 */
-               if (((smb_ctrl->lvalue & ACB_DISABLED) != 0) ||
-                   ((smb_ctrl->lvalue & ACB_NORMAL) == 0)) {
+               if (((smb_ctrl->vp_integer & ACB_DISABLED) != 0) ||
+                   ((smb_ctrl->vp_integer & ACB_NORMAL) == 0)) {
                        DEBUG2("  rlm_mschap: SMB-Account-Ctrl says that the account is disabled, or is not a normal account.");
                        add_reply( &request->reply->vps, *response->vp_octets,
                                   "MS-CHAP-Error", "E=691 R=1", 9);
@@ -1300,7 +1300,7 @@ static int mschap_authenticate(void * instance, REQUEST *request)
                /*
                 *      User is locked out.
                 */
-               if ((smb_ctrl->lvalue & ACB_AUTOLOCK) != 0) {
+               if ((smb_ctrl->vp_integer & ACB_AUTOLOCK) != 0) {
                        DEBUG2("  rlm_mschap: SMB-Account-Ctrl says that the account is locked out.");
                        add_reply( &request->reply->vps, *response->vp_octets,
                                   "MS-CHAP-Error", "E=647 R=0", 9);
index d7811a2..f847131 100644 (file)
@@ -385,8 +385,8 @@ static int pap_authorize(void *instance, REQUEST *request)
                         *      Auth-Type := Accept
                         *      Auth-Type := Reject
                         */
-                       if ((vp->lvalue == 254) ||
-                           (vp->lvalue == 4)) {
+                       if ((vp->vp_integer == 254) ||
+                           (vp->vp_integer == 4)) {
                            found_pw = 1;
                        }
                        break;
index 632f8d7..c2ed184 100644 (file)
@@ -521,7 +521,7 @@ static int passwd_authorize(void *instance, REQUEST *request)
          key = key->next ){
                switch (inst->keyattrtype) {
                        case PW_TYPE_INTEGER:
-                               snprintf(buffer, 1024, "%u", key->lvalue);
+                               snprintf(buffer, 1024, "%u", key->vp_integer);
                                name = buffer;
                                break;
                        default:
index 0917038..4552bca 100644 (file)
@@ -1124,7 +1124,7 @@ static int perl_accounting(void *instance, REQUEST *request)
        int             acctstatustype=0;
 
        if ((pair = pairfind(request->packet->vps, PW_ACCT_STATUS_TYPE)) != NULL) {
-                acctstatustype = pair->lvalue;
+                acctstatustype = pair->vp_integer
         } else {
                 radlog(L_ERR, "Invalid Accounting Packet");
                 return RLM_MODULE_INVALID;
index 967e10c..112a4ac 100644 (file)
@@ -87,11 +87,11 @@ static void ascend_nasport_hack(VALUE_PAIR *nas_port, int channels_per_line)
                return;
        }
 
-       if (nas_port->lvalue > 9999) {
-               service = nas_port->lvalue/10000; /* 1=digital 2=analog */
-               line = (nas_port->lvalue - (10000 * service)) / 100;
-               channel = nas_port->lvalue-((10000 * service)+(100 * line));
-               nas_port->lvalue =
+       if (nas_port->vp_integer > 9999) {
+               service = nas_port->vp_integer/10000; /* 1=digital 2=analog */
+               line = (nas_port->vp_integer - (10000 * service)) / 100;
+               channel = nas_port->vp_integer-((10000 * service)+(100 * line));
+               nas_port->vp_integer =
                        (channel - 1) + (line - 1) * channels_per_line;
        }
 }
@@ -253,7 +253,7 @@ static void rad_mangle(rlm_preprocess_t *data, REQUEST *request)
            pairfind(request_pairs, PW_SERVICE_TYPE) == NULL) {
                tmp = paircreate(PW_SERVICE_TYPE, PW_TYPE_INTEGER);
                if (tmp) {
-                       tmp->lvalue = PW_FRAMED_USER;
+                       tmp->vp_integer = PW_FRAMED_USER;
                        pairmove(&request_pairs, &tmp);
                }
        }
@@ -419,7 +419,7 @@ static int add_nas_attr(REQUEST *request)
                                radlog(L_ERR, "No memory");
                                return -1;
                        }
-                       nas->lvalue = request->packet->src_ipaddr.ipaddr.ip4addr.s_addr;
+                       nas->vp_ipaddr = request->packet->src_ipaddr.ipaddr.ip4addr.s_addr;
                        pairadd(&request->packet->vps, nas);
                }
                break;
index bc37f78..c798f4b 100644 (file)
@@ -212,7 +212,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                radlog(L_ERR, "rlm_radutmp: No Accounting-Status-Type record.");
                return RLM_MODULE_NOOP;
        }
-       status = vp->lvalue;
+       status = vp->vp_integer;
 
        /*
         *      Look for weird reboot packets.
@@ -232,7 +232,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                int check2 = 0;
 
                if ((vp = pairfind(request->packet->vps, PW_ACCT_SESSION_TIME))
-                    == NULL || vp->lvalue == 0)
+                    == NULL || vp->vp_date == 0)
                        check1 = 1;
                if ((vp = pairfind(request->packet->vps, PW_ACCT_SESSION_ID))
                     != NULL && vp->length == 8 &&
@@ -264,22 +264,22 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                switch (vp->attribute) {
                        case PW_LOGIN_IP_HOST:
                        case PW_FRAMED_IP_ADDRESS:
-                               framed_address = vp->lvalue;
-                               ut.framed_address = vp->lvalue;
+                               framed_address = vp->vp_ipaddr;
+                               ut.framed_address = vp->vp_ipaddr;
                                break;
                        case PW_FRAMED_PROTOCOL:
-                               protocol = vp->lvalue;
+                               protocol = vp->vp_integer;
                                break;
                        case PW_NAS_IP_ADDRESS:
-                               nas_address = vp->lvalue;
-                               ut.nas_address = vp->lvalue;
+                               nas_address = vp->vp_ipaddr;
+                               ut.nas_address = vp->vp_ipaddr;
                                break;
                        case PW_NAS_PORT:
-                               ut.nas_port = vp->lvalue;
+                               ut.nas_port = vp->vp_integer;
                                port_seen = 1;
                                break;
                        case PW_ACCT_DELAY_TIME:
-                               ut.delay = vp->lvalue;
+                               ut.delay = vp->vp_integer;
                                break;
                        case PW_ACCT_SESSION_ID:
                                /*
@@ -300,9 +300,9 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                                        sizeof(ut.session_id));
                                break;
                        case PW_NAS_PORT_TYPE:
-                               if (vp->lvalue <= 4)
-                                       ut.porttype = porttypes[vp->lvalue];
-                               nas_port_type = vp->lvalue;
+                               if (vp->vp_integer <= 4)
+                                       ut.porttype = porttypes[vp->vp_integer];
+                               nas_port_type = vp->vp_integer;
                                break;
                        case PW_CALLING_STATION_ID:
                                if(inst->callerid_ok)
@@ -650,7 +650,7 @@ static int radutmp_checksimul(void *instance, REQUEST *request)
         *      Setup some stuff, like for MPP detection.
         */
        if ((vp = pairfind(request->packet->vps, PW_FRAMED_IP_ADDRESS)) != NULL)
-               ipno = vp->lvalue;
+               ipno = vp->vp_ipaddr;
        if ((vp = pairfind(request->packet->vps, PW_CALLING_STATION_ID)) != NULL)
                call_num = vp->vp_strvalue;
 
index fbdae70..0b87cba 100644 (file)
@@ -735,7 +735,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                radlog(L_ERR, "rlm_radutmp: No Accounting-Status-Type record.");
                return RLM_MODULE_NOOP;
        }
-       status = vp->lvalue;
+       status = vp->vp_integer;
 
        /*
         *      Look for weird reboot packets.
@@ -755,7 +755,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                int check2 = 0;
 
                if ((vp = pairfind(request->packet->vps, PW_ACCT_SESSION_TIME))
-                    == NULL || vp->lvalue == 0)
+                    == NULL || vp->vp_date == 0)
                        check1 = 1;
                if ((vp = pairfind(request->packet->vps, PW_ACCT_SESSION_ID))
                     != NULL && vp->length == 8 &&
@@ -786,22 +786,22 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                switch (vp->attribute) {
                        case PW_LOGIN_IP_HOST:
                        case PW_FRAMED_IP_ADDRESS:
-                               framed_address = vp->lvalue;
-                               utmp.framed_address = vp->lvalue;
+                               framed_address = vp->vp_ipaddr;
+                               utmp.framed_address = vp->vp_ipaddr;
                                break;
                        case PW_FRAMED_PROTOCOL:
-                               protocol = vp->lvalue;
+                               protocol = vp->vp_integer;
                                break;
                        case PW_NAS_IP_ADDRESS:
-                               nas_address = vp->lvalue;
-                               utmp.nas_address = vp->lvalue;
+                               nas_address = vp->vp_ipaddr;
+                               utmp.nas_address = vp->vp_ipaddr;
                                break;
                        case PW_NAS_PORT:
-                               utmp.nas_port = vp->lvalue;
+                               utmp.nas_port = vp->vp_integer;
                                port_seen = 1;
                                break;
                        case PW_ACCT_DELAY_TIME:
-                               utmp.delay = vp->lvalue;
+                               utmp.delay = vp->vp_integer;
                                break;
                        case PW_ACCT_SESSION_ID:
                                /*
@@ -833,8 +833,8 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                                }
                                break;
                        case PW_NAS_PORT_TYPE:
-                               if (vp->lvalue <= 4)
-                                       utmp.porttype = porttypes[vp->lvalue];
+                               if (vp->vp_integer <= 4)
+                                       utmp.porttype = porttypes[vp->vp_integer];
                                break;
                        case PW_CALLING_STATION_ID:
                                if(inst->callerid_ok)
@@ -1398,7 +1398,7 @@ static int radutmp_checksimul(void *instance, REQUEST *request)
         *      Setup some stuff, like for MPP detection.
         */
        if ((vp = pairfind(request->packet->vps, PW_FRAMED_IP_ADDRESS)) != NULL)
-               ipno = vp->lvalue;
+               ipno = vp->vp_ipaddr;
        if ((vp = pairfind(request->packet->vps, PW_CALLING_STATION_ID)) != NULL)
                call_num = vp->vp_strvalue;
 
index dbbe7b1..87a3f67 100644 (file)
@@ -257,12 +257,12 @@ static int check_for_realm(void *instance, REQUEST *request, REALM **returnrealm
                 */
 
                if (request->packet->code == PW_AUTHENTICATION_REQUEST &&
-                   vp->lvalue == realm->home_auth->ipaddr.ipaddr.ip4addr.s_addr) {
+                   vp->vp_ipaddr == realm->home_auth->ipaddr.ipaddr.ip4addr.s_addr) {
                        DEBUG2("    rlm_realm: Request not proxied due to Freeradius-Proxied-To");
                        return 0;
                }
                if (request->packet->code == PW_ACCOUNTING_REQUEST &&
-                   vp->lvalue == realm->home_acct->ipaddr.ipaddr.ip4addr.s_addr) {
+                   vp->vp_ipaddr == realm->home_acct->ipaddr.ipaddr.ip4addr.s_addr) {
                        DEBUG2("    rlm_realm: Request not proxied due to Freeradius-Proxied-To");
                        return 0;
                }
index 6e90fe1..ac20e54 100644 (file)
@@ -114,7 +114,7 @@ static int fallthrough(VALUE_PAIR *vp)
        VALUE_PAIR *tmp;
        tmp = pairfind(vp, PW_FALL_THROUGH);
 
-       return tmp ? tmp->lvalue : 0;
+       return tmp ? tmp->vp_integer : 0;
 }
 
 
@@ -276,8 +276,8 @@ static int generate_sql_clients(SQL_INST *inst)
                DEBUG("rlm_sql (%s): Read entry nasname=%s,shortname=%s,secret=%s",inst->config->xlat_name,
                        row[1],row[2],row[4]);
 
-               c = rad_malloc(sizeof(RADCLIENT));
-               memset(c, 0, sizeof(RADCLIENT));
+               c = rad_malloc(sizeof(*c));
+               memset(c, 0, sizeof(*c));
 
                /*
                 *      Look for prefixes
@@ -1072,7 +1072,7 @@ static int rlm_sql_accounting(void *instance, REQUEST * request) {
         * Find the Acct Status Type
         */
        if ((pair = pairfind(request->packet->vps, PW_ACCT_STATUS_TYPE)) != NULL) {
-               acctstatustype = pair->lvalue;
+               acctstatustype = pair->vp_integer;
        } else {
                radius_xlat(logstr, sizeof(logstr), "packet has no accounting status type. [user '%{User-Name}', nas '%{NAS-IP-Address}']", request, NULL);
                radlog(L_ERR, "rlm_sql (%s) in sql_accounting: %s",
@@ -1240,7 +1240,7 @@ static int rlm_sql_accounting(void *instance, REQUEST * request) {
                                                 * table with bogus crap
                                                 */
                                                if ((pair = pairfind(request->packet->vps, PW_ACCT_SESSION_TIME)) != NULL)
-                                                       acctsessiontime = pair->lvalue;
+                                                       acctsessiontime = pair->vp_integer;
 
                                                if (acctsessiontime <= 0) {
                                                        radius_xlat(logstr, sizeof(logstr), "stop packet with zero session length. [user '%{User-Name}', nas '%{NAS-IP-Address}']", request, NULL);
@@ -1379,7 +1379,7 @@ static int rlm_sql_checksimul(void *instance, REQUEST * request) {
        request->simul_count = 0;
 
         if ((vp = pairfind(request->packet->vps, PW_FRAMED_IP_ADDRESS)) != NULL)
-                ipno = vp->lvalue;
+                ipno = vp->vp_ipaddr;
         if ((vp = pairfind(request->packet->vps, PW_CALLING_STATION_ID)) != NULL)
                 call_num = vp->vp_strvalue;
 
index 4628dc0..bd1c798 100644 (file)
@@ -372,9 +372,9 @@ static int sql_log_accounting(void *instance, REQUEST *request)
        }
 
        /* Search the query in conf section of the module */
-       if ((dval = dict_valbyattr(PW_ACCT_STATUS_TYPE, pair->lvalue)) == NULL) {
+       if ((dval = dict_valbyattr(PW_ACCT_STATUS_TYPE, pair->vp_integer)) == NULL) {
                radlog(L_ERR, "rlm_sql_log (%s): Unsupported Acct-Status-Type = %d",
-                      inst->name, pair->lvalue);
+                      inst->name, pair->vp_integer);
                return RLM_MODULE_NOOP;
        }
        if ((cp = cf_pair_find(inst->conf_section, dval->name)) == NULL) {
index 630f971..db9edf2 100644 (file)
@@ -409,7 +409,7 @@ static int sqlcounter_cmp(void *instance, REQUEST *req,
 
        counter = atoi(querystr);
 
-       return counter - check->lvalue;
+       return counter - check->vp_integer;
 }
 
 
@@ -685,7 +685,7 @@ static int sqlcounter_authorize(void *instance, REQUEST *request)
        /*
         * Check if check item > counter
         */
-       res=check_vp->lvalue - counter;
+       res=check_vp->vp_integer - counter;
        if (res > 0) {
                DEBUG2("rlm_sqlcounter: (Check item - counter) is greater than zero");
                /*
@@ -708,27 +708,27 @@ static int sqlcounter_authorize(void *instance, REQUEST *request)
                if (data->reset_time && (
                        res >= (data->reset_time - request->timestamp))) {
                        res = data->reset_time - request->timestamp;
-                       res += check_vp->lvalue;
+                       res += check_vp->vp_integer;
                }
 
                if ((reply_item = pairfind(request->reply->vps, data->reply_attr)) != NULL) {
-                       if (reply_item->lvalue > res)
-                               reply_item->lvalue = res;
+                       if (reply_item->vp_integer > res)
+                               reply_item->vp_integer = res;
                } else {
                        if ((reply_item = paircreate(data->reply_attr, PW_TYPE_INTEGER)) == NULL) {
                                radlog(L_ERR|L_CONS, "no memory");
                                return RLM_MODULE_NOOP;
                        }
-                       reply_item->lvalue = res;
+                       reply_item->vp_integer = res;
                        pairadd(&request->reply->vps, reply_item);
                }
 
                ret=RLM_MODULE_OK;
 
                DEBUG2("rlm_sqlcounter: Authorized user %s, check_item=%d, counter=%d",
-                               key_vp->vp_strvalue,check_vp->lvalue,counter);
+                               key_vp->vp_strvalue,check_vp->vp_integer,counter);
                DEBUG2("rlm_sqlcounter: Sent Reply-Item for user %s, Type=%s, value=%d",
-                               key_vp->vp_strvalue,data->reply_name,reply_item->lvalue);
+                               key_vp->vp_strvalue,data->reply_name,reply_item->vp_integer);
        }
        else{
                char module_fmsg[MAX_STRING_LEN];
@@ -750,7 +750,7 @@ static int sqlcounter_authorize(void *instance, REQUEST *request)
                ret=RLM_MODULE_REJECT;
 
                DEBUG2("rlm_sqlcounter: Rejected user %s, check_item=%d, counter=%d",
-                               key_vp->vp_strvalue,check_vp->lvalue,counter);
+                               key_vp->vp_strvalue,check_vp->vp_integer,counter);
        }
 
        return ret;
index a09db40..9543081 100644 (file)
@@ -393,7 +393,7 @@ static int sqlhpwippool_postauth(void *instance, REQUEST *request)
        /* if no NAS IP address, assign 0 */
        vp = pairfind(request->packet->vps, PW_NAS_IP_ADDRESS);
        if (vp) {
-               nasip = ntohl(vp->lvalue);
+               nasip = ntohl(vp->vp_ipaddr);
        }
        else {
                nasip = 0;
@@ -671,7 +671,7 @@ end_gid:
                return RLM_MODULE_FAIL;
        }
 
-       vp->lvalue = ip.s_addr;
+       vp->vp_ipaddr = ip.s_addr;
        pairadd(&request->reply->vps, vp);
 
        nvp_log(__LINE__, data, L_DBG, "sqlhpwippool_postauth(): returning %s",
@@ -704,7 +704,7 @@ static int sqlhpwippool_accounting(void *instance, REQUEST *request)
 
        vp = pairfind(request->packet->vps, PW_ACCT_STATUS_TYPE);
        if (vp) {
-               acct_type = vp->lvalue;
+               acct_type = vp->vp_integer;
        }
        else {
                nvp_log(__LINE__, data, L_ERR, "sqlhpwippool_accounting(): "
@@ -739,7 +739,7 @@ static int sqlhpwippool_accounting(void *instance, REQUEST *request)
                                return RLM_MODULE_FAIL;
                        }
 
-                       framedip = ntohl(vp->lvalue);
+                       framedip = ntohl(vp->vp_ipaddr);
 
                        if (!nvp_query(__LINE__, data, sqlsock,
                            "UPDATE `%s`.`ips` "
@@ -779,7 +779,7 @@ static int sqlhpwippool_accounting(void *instance, REQUEST *request)
                                return RLM_MODULE_FAIL;
                        }
 
-                       nasip.s_addr = vp->lvalue;
+                       nasip.s_addr = vp->vp_ipaddr;
                        strncpy(nasipstr, inet_ntoa(nasip), sizeof(nasipstr) - 1);
                        nasipstr[sizeof(nasipstr)] = 0;
 
index 39b5a58..914a126 100644 (file)
@@ -652,7 +652,7 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
                sql_release_socket(data->sql_inst, sqlsocket);
                return RLM_MODULE_NOOP;
        }
-       vp->lvalue = ip_allocation;
+       vp->vp_ipaddr = ip_allocation;
        pairadd(&request->reply->vps, vp);
 
        /*
@@ -894,7 +894,7 @@ static int sqlippool_accounting(void * instance, REQUEST * request)
                DEBUG("rlm_sqlippool: Could not find account status type in packet.");
                return RLM_MODULE_NOOP;
        }
-       acct_status_type = vp->lvalue;
+       acct_status_type = vp->vp_integer;
 
        switch (acct_status_type) {
        case PW_STATUS_START:
@@ -918,9 +918,8 @@ static int sqlippool_accounting(void * instance, REQUEST * request)
        }
 }
 
-static int sqlippool_detach(void *instance)
+static int sqlippool_detach(UNUSED void *instance)
 {
-       rlm_sqlippool_t * data = (rlm_sqlippool_t *) instance;
 
        return 0;
 }
index ec707c3..40a6401 100644 (file)
@@ -446,7 +446,7 @@ static int unix_accounting(void *instance, REQUEST *request)
                radlog(L_ERR, "rlm_unix: no Accounting-Status-Type attribute in request.");
                return RLM_MODULE_NOOP;
        }
-       status = vp->lvalue;
+       status = vp->vp_integer;
 
        /*
         *      FIXME: handle PW_STATUS_ALIVE like 1.5.4.3 did.
@@ -479,23 +479,23 @@ static int unix_accounting(void *instance, REQUEST *request)
                                break;
                        case PW_LOGIN_IP_HOST:
                        case PW_FRAMED_IP_ADDRESS:
-                               framed_address = vp->lvalue;
+                               framed_address = vp->vp_ipaddr;
                                break;
                        case PW_FRAMED_PROTOCOL:
-                               protocol = vp->lvalue;
+                               protocol = vp->vp_integer;
                                break;
                        case PW_NAS_IP_ADDRESS:
-                               nas_address = vp->lvalue;
+                               nas_address = vp->vp_ipaddr;
                                break;
                        case PW_NAS_PORT:
-                               nas_port = vp->lvalue;
+                               nas_port = vp->vp_integer;
                                port_seen = 1;
                                break;
                        case PW_ACCT_DELAY_TIME:
-                               delay = vp->lvalue;
+                               delay = vp->vp_ipaddr;
                                break;
                        case PW_NAS_PORT_TYPE:
-                               nas_port_type = vp->lvalue;
+                               nas_port_type = vp->vp_ipaddr;
                                break;
                }
        }