diff options
author | Graham Leggett <minfrin@apache.org> | 2014-04-21 17:45:58 +0000 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2014-04-21 17:45:58 +0000 |
commit | 882e7b8852fd4af3decd4c93fd895155a5c25c95 (patch) | |
tree | 636100248ba3547f2661b93ef9487d4aca12e476 /tools | |
parent | d81ecb2730b3545f544016f1d9411cc4568b7bef (diff) | |
download | apr-882e7b8852fd4af3decd4c93fd895155a5c25c95.tar.gz |
Split the ability to filter LDAP escape sequences into DN escaping or filter
escaping, allowing the option to escape both at the same time.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1588937 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gen_test_char.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/gen_test_char.c b/tools/gen_test_char.c index 156b33145..c48d2cbe7 100644 --- a/tools/gen_test_char.c +++ b/tools/gen_test_char.c @@ -32,7 +32,8 @@ #define T_ESCAPE_ECHO (0x08) #define T_ESCAPE_URLENCODED (0x10) #define T_ESCAPE_XML (0x20) -#define T_ESCAPE_LDAP (0x40) +#define T_ESCAPE_LDAP_DN (0x40) +#define T_ESCAPE_LDAP_FILTER (0x80) int main(int argc, char *argv[]) { @@ -47,7 +48,8 @@ int main(int argc, char *argv[]) "#define T_ESCAPE_ECHO (%u)\n" "#define T_ESCAPE_URLENCODED (%u)\n" "#define T_ESCAPE_XML (%u)\n" - "#define T_ESCAPE_LDAP (%u)\n" + "#define T_ESCAPE_LDAP_DN (%u)\n" + "#define T_ESCAPE_LDAP_FILTER (%u)\n" "\n" "static const unsigned char test_char_table[256] = {", T_ESCAPE_SHELL_CMD, @@ -56,7 +58,8 @@ int main(int argc, char *argv[]) T_ESCAPE_ECHO, T_ESCAPE_URLENCODED, T_ESCAPE_XML, - T_ESCAPE_LDAP); + T_ESCAPE_LDAP_DN, + T_ESCAPE_LDAP_FILTER); for (c = 0; c < 256; ++c) { flags = 0; @@ -109,9 +112,14 @@ int main(int argc, char *argv[]) flags |= T_ESCAPE_XML; } - /* LDAP DN escaping (RFC4514) and LDAP filter escaping (RFC4515) */ - if (!isprint(c) || strchr("\"+,;<>\\", c) || strchr("*()\\", c)) { - flags |= T_ESCAPE_LDAP; + /* LDAP DN escaping (RFC4514) */ + if (!isprint(c) || strchr("\"+,;<>\\", c)) { + flags |= T_ESCAPE_LDAP_DN; + } + + /* LDAP filter escaping (RFC4515) */ + if (!isprint(c) || strchr("*()\\", c)) { + flags |= T_ESCAPE_LDAP_FILTER; } printf("%u%c", flags, (c < 255) ? ',' : ' '); |