]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
scanner: allow strings starting by underscores and dots
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Aug 2016 21:22:51 +0000 (23:22 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 18 Aug 2016 01:14:57 +0000 (03:14 +0200)
POSIX.1-2008 (which is simultaneously IEEE Std 1003.1-2008) says:

"The set of characters from which portable filenames are constructed.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 . _ -"

On top of that it says:

"The <hyphen> character should not be used as the first character of a
portable user name."

This allows a bit more things that NAME_REGEX though, but this still
looks fine to me.

For more info, see:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_431
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_278

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/scanner.l

index 3ad4dd9c1705cad4c047464671a8af59b6bd24eb..6f497e8467f4cde2d1e255df806f302afe6ac28a 100644 (file)
@@ -112,7 +112,7 @@ decstring   {digit}+
 hexstring      0[xX]{hexdigit}+
 range          ({decstring}?:{decstring}?)
 letter         [a-zA-Z]
-string         ({letter})({letter}|{digit}|[/\-_\.])*
+string         ({letter}|[_.])({letter}|{digit}|[/\-_\.])*
 quotedstring   \"[^"]*\"
 asteriskstring ({string}\*|{string}\\\*)
 comment                #.*$