summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld
diff options
context:
space:
mode:
authorjpaetzel <jpaetzel@FreeBSD.org>2014-06-27 17:10:28 +0000
committerjpaetzel <jpaetzel@FreeBSD.org>2014-06-27 17:10:28 +0000
commit79ef481e2b33a1c7f8d214041fe5b51b47d6e9f9 (patch)
tree0dac65b593aa46ec26d878692190b00fb01c9730 /usr.sbin/ctld
parentc17570f4b122b08e9ad6dc2c7a694d42444fe19f (diff)
downloadFreeBSD-src-79ef481e2b33a1c7f8d214041fe5b51b47d6e9f9.zip
FreeBSD-src-79ef481e2b33a1c7f8d214041fe5b51b47d6e9f9.tar.gz
MFC: 267833
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
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r--usr.sbin/ctld/parse.y13
-rw-r--r--usr.sbin/ctld/token.l5
2 files changed, 16 insertions, 2 deletions
diff --git a/usr.sbin/ctld/parse.y b/usr.sbin/ctld/parse.y
index e4b160e..645201b 100644
--- a/usr.sbin/ctld/parse.y
+++ b/usr.sbin/ctld/parse.y
@@ -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);
}
;
diff --git a/usr.sbin/ctld/token.l b/usr.sbin/ctld/token.l
index 2846097..a47bf9a 100644
--- a/usr.sbin/ctld/token.l
+++ b/usr.sbin/ctld/token.l
@@ -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; }
OpenPOWER on IntegriCloud