]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add whitespace and blank character classes
authorAlan T. DeKok <aland@freeradius.org>
Mon, 14 Dec 2020 17:35:42 +0000 (12:35 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 14 Dec 2020 18:33:15 +0000 (13:33 -0500)
whitespace skips \n, blank does not

src/lib/util/sbuff.c
src/lib/util/sbuff.h

index c0045cf72276a176490392b417460094779c7dbf..dfac44dc6a45f94b679e567cc0109e11c47769a1 100644 (file)
@@ -71,6 +71,12 @@ bool const sbuff_char_class_float[UINT8_MAX + 1] = {
 
 bool const sbuff_char_class_hex[UINT8_MAX + 1] = { SBUFF_CHAR_CLASS_HEX };
 bool const sbuff_char_alpha_num[UINT8_MAX + 1] = { SBUFF_CHAR_CLASS_ALPHA_NUM };
+bool const sbuff_char_whitespace[UINT8_MAX + 1] = {
+       ['\t'] = true, ['\n'] = true, ['\r'] = true, ['\f'] = true, ['\v'] = true, [' '] = true,
+};
+bool const sbuff_char_blank[UINT8_MAX + 1] = {
+       ['\t'] = true, [' '] = true,
+};
 
 /** Escape rules to use when an escape_rules pointer is NULL
  */
index 7f25b1ae8ebe6f63f859fe67732b97fddc914cfa..e18a2443c97848d04564256c6e48bee109eb5763 100644 (file)
@@ -239,6 +239,8 @@ extern bool const sbuff_char_class_int[UINT8_MAX + 1];
 extern bool const sbuff_char_class_float[UINT8_MAX + 1];
 extern bool const sbuff_char_class_hex[UINT8_MAX + 1];
 extern bool const sbuff_char_alpha_num[UINT8_MAX + 1];
+extern bool const sbuff_char_whitespace[UINT8_MAX + 1];
+extern bool const sbuff_char_blank[UINT8_MAX + 1];
 
 /** Matches a-z,A-Z
  */