};
static const attr_info_t attr_info[] = {
- { "internal_ip4_dns", VALUE_ADDR, INTERNAL_IP4_DNS, 0 },
- { "internal_ip6_dns", VALUE_ADDR, INTERNAL_IP6_DNS, 0 },
- { "dns", VALUE_ADDR, INTERNAL_IP4_DNS,
- INTERNAL_IP6_DNS },
{ "internal_ip4_netmask", VALUE_ADDR, INTERNAL_IP4_NETMASK, 0 },
{ "internal_ip6_netmask", VALUE_ADDR, INTERNAL_IP6_NETMASK, 0 },
{ "netmask", VALUE_ADDR, INTERNAL_IP4_NETMASK,
INTERNAL_IP6_NETMASK },
+ { "internal_ip4_dns", VALUE_ADDR, INTERNAL_IP4_DNS, 0 },
+ { "internal_ip6_dns", VALUE_ADDR, INTERNAL_IP6_DNS, 0 },
+ { "dns", VALUE_ADDR, INTERNAL_IP4_DNS,
+ INTERNAL_IP6_DNS },
{ "internal_ip4_nbns", VALUE_ADDR, INTERNAL_IP4_NBNS, 0 },
{ "internal_ip6_nbns", VALUE_ADDR, INTERNAL_IP6_NBNS, 0 },
{ "nbns", VALUE_ADDR, INTERNAL_IP4_NBNS,
{
if (strcaseeq(name, attr_info[i].keyword))
{
+ *type = attr_info[i].type;
+ *type_ip6 = attr_info[i].type_ip6;
+
if (*value_type == VALUE_NONE)
{
*value_type = attr_info[i].value_type;
- *type = attr_info[i].type;
- *type_ip6 = attr_info[i].type_ip6;
return TRUE;
}
+
if (*value_type != attr_info[i].value_type &&
*value_type != VALUE_HEX)
{
free(blob->ptr);
return FALSE;
}
+
if (*value_type == VALUE_ADDR)
{
*type = (addr->get_family(addr) == AF_INET) ?
attr_info[i].type : attr_info[i].type_ip6;
addr->destroy(addr);
}
- if (*value_type == VALUE_HEX)
+ else if (*value_type == VALUE_HEX)
{
*value_type = attr_info[i].value_type;
if (*value_type == VALUE_ADDR)
{
- if (blob->len == 4)
- {
- *type = attr_info[i].type;
- }
- else if (blob->len == 16)
+ if (blob->len == 16)
{
*type = attr_info[i].type_ip6;
}
- else
+ else if (blob->len != 4)
{
fprintf(stderr, "the %s attribute requires "
"a valid IP address.\n", name);
return FALSE;
}
}
- else
- {
- *type = attr_info[i].type;
- }
- }
- else
- {
- *type = attr_info[i].type;
}
return TRUE;
}
{
exit(EXIT_FAILURE);
}
+
success = db->execute(db, NULL,
"INSERT INTO attributes (type, value) VALUES (?, ?)",
DB_INT, type, DB_BLOB, blob) == 1;
{
exit(EXIT_FAILURE);
}
+
if (blob.len > 0)
{
query = db->query(db,
}
else
{
- fprintf(stderr, "the %s attribute (%N) with value '%*.s' "
+ fprintf(stderr, "the %s attribute (%N) with value '%.*s' "
"was not found.\n", name,
configuration_attribute_type_names, type,
blob.len, blob.ptr);