properly convert boolean flags when parsing ipsec.conf

This commit is contained in:
Tobias Brunner 2009-05-07 17:43:16 +02:00
parent 723534283c
commit 5533a88936
1 changed files with 11 additions and 3 deletions

View File

@ -365,15 +365,23 @@ assign_arg(kw_token_t token, kw_token_t first, kw_list_t *kw, char *base
return FALSE;
case ARG_ENUM:
{
int *i = (int *)p;
if (index < 0)
{
plog("# bad enumeration value: %s=%s (%d)"
, kw->entry->name, kw->value, index);
return FALSE;
}
*i = index;
if (token_info[token].list == LST_bool)
{
bool *b = (bool *)p;
*b = (index > 0);
}
else
{
int *i = (int *)p;
*i = index;
}
}
break;