Skip to content

Commit

Permalink
CID 1058551
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Mar 22, 2014
1 parent e4ba5f5 commit 4b2d5ed
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/lib/valuepair.c
Expand Up @@ -1692,7 +1692,7 @@ VALUE_PAIR *pairmake_ip(TALLOC_CTX *ctx, char const *value, DICT_ATTR *ipv4, DIC
DICT_ATTR *ipv4_prefix, DICT_ATTR *ipv6_prefix)
{
VALUE_PAIR *vp;
DICT_ATTR *da;
DICT_ATTR *da = NULL;

if (!fr_assert(ipv4 || ipv6 || ipv4_prefix || ipv6_prefix)) {
return NULL;
Expand All @@ -1713,14 +1713,17 @@ VALUE_PAIR *pairmake_ip(TALLOC_CTX *ctx, char const *value, DICT_ATTR *ipv4, DIC
da = ipv4_prefix;
goto finish;
}
da = ipv4;

if (!da) {
fr_strerror_printf("Invalid IP value specified, allowed types are %s%s%s%s",
ipv4 ? "ipaddr " : "", ipv6 ? "ipv6addr " : "",
ipv4_prefix ? "ipv4prefix " : "", ipv6_prefix ? "ipv6prefix" : "");
if (ipv4) {
da = ipv4;
goto finish;
}
finish:

fr_strerror_printf("Invalid IP value specified, allowed types are %s%s%s%s",
ipv4 ? "ipaddr " : "", ipv6 ? "ipv6addr " : "",
ipv4_prefix ? "ipv4prefix " : "", ipv6_prefix ? "ipv6prefix" : "");

finish:
vp = pairalloc(ctx, da);
if (!vp) return NULL;
if (!pairparsevalue(vp, value)) {
Expand Down

0 comments on commit 4b2d5ed

Please sign in to comment.