done that often anyways, and it has significant overhead.
Instead, print the data as appropriate, IF it's needed for
regex stuff, which is the only need for IP addresses as strings.
a = buf;
break;
case PW_TYPE_IPADDR:
a = buf;
break;
case PW_TYPE_IPADDR:
- if (vp->vp_strvalue[0])
- a = (char *)vp->vp_strvalue;
- else
- a = inet_ntop(AF_INET, &(vp->lvalue),
- buf, sizeof(buf));
+ a = inet_ntop(AF_INET, &(vp->lvalue),
+ buf, sizeof(buf));
break;
case PW_TYPE_ABINARY:
#ifdef ASCEND_BINARY
break;
case PW_TYPE_ABINARY:
#ifdef ASCEND_BINARY
int i;
regmatch_t rxmatch[REQUEST_MAX_REGEX + 1];
int i;
regmatch_t rxmatch[REQUEST_MAX_REGEX + 1];
+ if ((auth_item->type == PW_TYPE_IPADDR) &&
+ (auth_item->vp_strvalue[0] == '\0')) {
+ inet_ntop(AF_INET, &(auth_item->lvalue),
+ auth_item->vp_strvalue,
+ sizeof(auth_item->vp_strvalue));
+ }
+
/*
* Include substring matches.
*/
/*
* Include substring matches.
*/
+ if ((auth_item->type == PW_TYPE_IPADDR) &&
+ (auth_item->vp_strvalue[0] == '\0')) {
+ inet_ntop(AF_INET, &(auth_item->lvalue),
+ auth_item->vp_strvalue,
+ sizeof(auth_item->vp_strvalue));
+ }
+
regcomp(®, (char *)check_item->vp_strvalue, REG_EXTENDED|REG_NOSUB);
compare = regexec(®, (char *)auth_item->vp_strvalue,
0, NULL, 0);
regcomp(®, (char *)check_item->vp_strvalue, REG_EXTENDED|REG_NOSUB);
compare = regexec(®, (char *)auth_item->vp_strvalue,
0, NULL, 0);
break;
#ifdef HAVE_REGEX_H
case T_OP_REG_EQ:
break;
#ifdef HAVE_REGEX_H
case T_OP_REG_EQ:
+ if ((reply_item->type == PW_TYPE_IPADDR) &&
+ (reply_item->vp_strvalue[0] == '\0')) {
+ inet_ntop(AF_INET, &(reply_item->lvalue),
+ reply_item->vp_strvalue,
+ sizeof(reply_item->vp_strvalue));
+ }
+
regcomp(®, (char *)check_item->vp_strvalue, REG_EXTENDED);
comp = regexec(®, (char *)reply_item->vp_strvalue,
0, NULL, 0);
regcomp(®, (char *)check_item->vp_strvalue, REG_EXTENDED);
comp = regexec(®, (char *)reply_item->vp_strvalue,
0, NULL, 0);
+ if ((reply_item->type == PW_TYPE_IPADDR) &&
+ (reply_item->vp_strvalue[0] == '\0')) {
+ inet_ntop(AF_INET, &(reply_item->lvalue),
+ reply_item->vp_strvalue,
+ sizeof(reply_item->vp_strvalue));
+ }
+
regcomp(®, (char *)check_item->vp_strvalue, REG_EXTENDED);
comp = regexec(®, (char *)reply_item->vp_strvalue,
0, NULL, 0);
regcomp(®, (char *)check_item->vp_strvalue, REG_EXTENDED);
comp = regexec(®, (char *)reply_item->vp_strvalue,
0, NULL, 0);
DEBUG2("rlm_attr_rewrite: regcomp() returned error: %s",err_msg);
return ret;
}
DEBUG2("rlm_attr_rewrite: regcomp() returned error: %s",err_msg);
return ret;
}
+
+ if ((attr_vp->type == PW_TYPE_IPADDR) &&
+ (attr_vp->vp_strvalue[0] == '\0')) {
+ inet_ntop(AF_INET, &(attr_vp->lvalue),
+ attr_vp->vp_strvalue,
+ sizeof(attr_vp->vp_strvalue));
+ }
+
ptr = new_str;
ptr2 = attr_vp->vp_strvalue;
counter = 0;
ptr = new_str;
ptr2 = attr_vp->vp_strvalue;
counter = 0;
radlog(L_ERR, "No memory");
return -1;
}
radlog(L_ERR, "No memory");
return -1;
}
-
- ip_ntoh(&request->packet->src_ipaddr,
- nas->vp_strvalue, sizeof(nas->vp_strvalue));
nas->lvalue = request->packet->src_ipaddr.ipaddr.ip4addr.s_addr;
pairadd(&request->packet->vps, nas);
}
nas->lvalue = request->packet->src_ipaddr.ipaddr.ip4addr.s_addr;
pairadd(&request->packet->vps, nas);
}