Fix issues in config parser relating to lun serial numbers.

Without this fix some serial numbers needed to be quoted
to avoid the config parser bailing out.

Submitted by:	delphij
Sponsored by:	iXsystems
This commit is contained in:
Josh Paetzel 2014-06-24 19:12:55 +00:00
parent d627d450b3
commit c9593e36b4
2 changed files with 16 additions and 2 deletions

View File

@ -659,6 +659,19 @@ lun_serial: SERIAL STR
}
lun_set_serial(lun, $2);
free($2);
} | SERIAL NUM
{
char *str = NULL;
if (lun->l_serial != NULL) {
log_warnx("serial for lun %d, target \"%s\" "
"specified more than once",
lun->l_lun, target->t_name);
return (1);
}
asprintf(&str, "%ju", $2);
lun_set_serial(lun, str);
free(str);
}
;

View File

@ -74,8 +74,9 @@ target { return TARGET; }
timeout { return TIMEOUT; }
[0-9]+[kKmMgGtTpPeE]? { if (expand_number(yytext, &yylval.num) == 0)
return NUM;
else
return STR;
else {
yylval.str = strdup(yytext); return STR;
}
}
\"[^"]+\" { yylval.str = strndup(yytext + 1,
strlen(yytext) - 2); return STR; }