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);
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));
}
/*
* Check if item != check
+ *
+ * FIXME: !!! Call normal API functions!
*/
found = 1;
if (data->dat_type == PW_TYPE_STRING ||
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;
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;
}
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;
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;
}
*/
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;
}
* 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 {
/*
/*
* 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) {
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);
}
}
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);
}
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;
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
/* 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;
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;
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);
* 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;
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
now = (req) ? req->timestamp : time(NULL);
- if (now <= ((time_t) check->lvalue))
+ if (now <= ((time_t) check->vp_date))
return 0;
return +1;
}
static int expiration_detach(void *instance)
{
- rlm_expiration_t *data = (rlm_expiration_t *) instance;
-
paircompare_unregister(PW_EXPIRATION, expirecmp);
free(instance);
return 0;
reply_pairs = reply_pairs;
rate = atoi((char *)request->vp_strvalue);
- return rate - check->lvalue;
+ return rate - check->vp_integer;
}
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 */
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 */
* 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.
/*
- * 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,
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;
}
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;
}
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);
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);
{
VALUE_PAIR *tmp;
tmp = pairfind(vp, PW_FALL_THROUGH);
- return tmp ? tmp->lvalue : 0;
+ return tmp ? tmp->vp_integer : 0;
}
/*
*/
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;
}
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[] = {
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;
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)
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);
/*
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);
}
}
*/
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);
*/
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
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);
}
}
/*
* 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;
}
* 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);
/*
* 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);
* 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;
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:
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;
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;
}
}
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);
}
}
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;
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.
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 &&
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:
/*
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)
* 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;
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.
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 &&
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:
/*
}
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)
* 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;
*/
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;
}
VALUE_PAIR *tmp;
tmp = pairfind(vp, PW_FALL_THROUGH);
- return tmp ? tmp->lvalue : 0;
+ return tmp ? tmp->vp_integer : 0;
}
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
* 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",
* 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);
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;
}
/* 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) {
counter = atoi(querystr);
- return counter - check->lvalue;
+ return counter - check->vp_integer;
}
/*
* 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");
/*
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];
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;
/* 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;
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",
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(): "
return RLM_MODULE_FAIL;
}
- framedip = ntohl(vp->lvalue);
+ framedip = ntohl(vp->vp_ipaddr);
if (!nvp_query(__LINE__, data, sqlsock,
"UPDATE `%s`.`ips` "
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;
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);
/*
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:
}
}
-static int sqlippool_detach(void *instance)
+static int sqlippool_detach(UNUSED void *instance)
{
- rlm_sqlippool_t * data = (rlm_sqlippool_t *) instance;
return 0;
}
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.
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;
}
}