char name[8192];
char *p;
+ if (cs == NULL)
+ goto no_such_item;
+
strlcpy(name, ptr, sizeof(name));
p = name;
const char *value;
fr_ipaddr_t ipaddr;
const CONF_PAIR *cp = NULL;
+ int depth;
char ipbuf[128];
- if (cs) cp = cf_pair_find(cs, name);
+ if (cs) {
+ depth = cs->depth;
+ cp = cf_pair_find(cs, name);
+ } else {
+ depth = 0;
+ }
+
if (cp) {
value = cp->value;
return -1;
}
cf_log_info(cs, "%.*s\t%s = %s",
- cs->depth, parse_spaces, name, value);
+ depth, parse_spaces, name, value);
break;
case PW_TYPE_INTEGER:
*(int *)data = strtol(value, 0, 0);
cf_log_info(cs, "%.*s\t%s = %d",
- cs->depth, parse_spaces, name, *(int *)data);
+ depth, parse_spaces, name, *(int *)data);
break;
case PW_TYPE_STRING_PTR:
}
cf_log_info(cs, "%.*s\t%s = \"%s\"",
- cs->depth, parse_spaces, name, value ? value : "(null)");
+ depth, parse_spaces, name, value ? value : "(null)");
*q = value ? strdup(value) : NULL;
break;
}
cf_log_info(cs, "%.*s\t%s = \"%s\"",
- cs->depth, parse_spaces, name, value ? value : "(null)");
+ depth, parse_spaces, name, value ? value : "(null)");
*q = value ? strdup(value) : NULL;
/*
if (strcmp(value, "*") == 0) {
*(uint32_t *) data = htonl(INADDR_ANY);
cf_log_info(cs, "%.*s\t%s = *",
- cs->depth, parse_spaces, name);
+ depth, parse_spaces, name);
break;
}
if (ip_hton(value, AF_INET, &ipaddr) < 0) {
if (strspn(value, "0123456789.") == strlen(value)) {
cf_log_info(cs, "%.*s\t%s = %s",
- cs->depth, parse_spaces, name, value);
+ depth, parse_spaces, name, value);
} else {
cf_log_info(cs, "%.*s\t%s = %s IP address [%s]",
- cs->depth, parse_spaces, name, value,
+ depth, parse_spaces, name, value,
ip_ntoh(&ipaddr, ipbuf, sizeof(ipbuf)));
}
*(uint32_t *) data = ipaddr.ipaddr.ip4addr.s_addr;
return -1;
}
cf_log_info(cs, "%.*s\t%s = %s IPv6 address [%s]",
- cs->depth, parse_spaces, name, value,
+ depth, parse_spaces, name, value,
ip_ntoh(&ipaddr, ipbuf, sizeof(ipbuf)));
memcpy(data, &ipaddr.ipaddr.ip6addr,
sizeof(ipaddr.ipaddr.ip6addr));