summaryrefslogtreecommitdiff
path: root/accel-pppd/extra/ippool.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-11-17 19:06:13 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-11-17 19:06:13 +0300
commit9f11527f6d2ab4f0e4cc9bd7222708a923e038c8 (patch)
treed9578fe1ffc5fff9a51089242a3ac421769dfd96 /accel-pppd/extra/ippool.c
parentb073cf1e9e36b25f808b899f12a1382c2903d672 (diff)
downloadaccel-ppp-9f11527f6d2ab4f0e4cc9bd7222708a923e038c8.tar.gz
accel-ppp-9f11527f6d2ab4f0e4cc9bd7222708a923e038c8.zip
ippool: properly handle Cisco-AVPair
Diffstat (limited to 'accel-pppd/extra/ippool.c')
-rw-r--r--accel-pppd/extra/ippool.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/accel-pppd/extra/ippool.c b/accel-pppd/extra/ippool.c
index c192e8d4..80e3c56a 100644
--- a/accel-pppd/extra/ippool.c
+++ b/accel-pppd/extra/ippool.c
@@ -449,16 +449,17 @@ static struct backup_module backup_mod = {
#ifdef RADIUS
static int parse_attr(struct ap_session *ses, struct rad_attr_t *attr)
{
- if (ses->ipv4_pool_name)
- _free(ses->ipv4_pool_name);
+ if (conf_vendor == 9) {
+ if (attr->len > sizeof("ip:addr-pool=") && memcmp(attr->val.string, "ip:addr-pool=", sizeof("ip:addr-pool=") - 1) == 0) {
+ if (ses->ipv4_pool_name)
+ _free(ses->ipv4_pool_name);
+ ses->ipv4_pool_name = _strdup(attr->val.string + sizeof("ip:addr-pool=") - 1);
+ }
+ } else {
+ if (ses->ipv4_pool_name)
+ _free(ses->ipv4_pool_name);
- if (attr->len > sizeof("ip:addr-pool=") && memcmp(attr->val.string, "ip:addr-pool=", sizeof("ip:addr-pool=") - 1) == 0)
- ses->ipv4_pool_name = _strdup(attr->val.string + sizeof("ip:addr-pool=") - 1);
- else if (!attr->vendor)
ses->ipv4_pool_name = _strdup(attr->val.string);
- else {
- ses->ipv4_pool_name = NULL;
- return -1;
}
return 0;
@@ -477,9 +478,7 @@ static void ev_radius_access_accept(struct ev_radius_t *ev)
continue;
if (attr->attr->id != conf_attr)
continue;
- if (parse_attr(ev->ses, attr))
- continue;
- break;
+ parse_attr(ev->ses, attr);
}
}