From owner-svn-src-head@FreeBSD.ORG Tue Jun 24 19:12:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B1F93FD; Tue, 24 Jun 2014 19:12:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ED282E49; Tue, 24 Jun 2014 19:12:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5OJCuPq094975; Tue, 24 Jun 2014 19:12:56 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5OJCuGC094973; Tue, 24 Jun 2014 19:12:56 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201406241912.s5OJCuGC094973@svn.freebsd.org> From: Josh Paetzel Date: Tue, 24 Jun 2014 19:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267833 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jun 2014 19:12:56 -0000 Author: jpaetzel Date: Tue Jun 24 19:12:55 2014 New Revision: 267833 URL: http://svnweb.freebsd.org/changeset/base/267833 Log: 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 Modified: head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Tue Jun 24 19:05:47 2014 (r267832) +++ head/usr.sbin/ctld/parse.y Tue Jun 24 19:12:55 2014 (r267833) @@ -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); } ; Modified: head/usr.sbin/ctld/token.l ============================================================================== --- head/usr.sbin/ctld/token.l Tue Jun 24 19:05:47 2014 (r267832) +++ head/usr.sbin/ctld/token.l Tue Jun 24 19:12:55 2014 (r267833) @@ -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; }