diff options
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r-- | source4/lib/ldb/common/ldb_parse.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c index 5824a8d003..25e4b727df 100644 --- a/source4/lib/ldb/common/ldb_parse.c +++ b/source4/lib/ldb/common/ldb_parse.c @@ -127,6 +127,19 @@ char *ldb_binary_encode(void *mem_ctx, struct ldb_val val) return ret; } +/* + encode a string as a RFC2254 binary string, escaping any + non-printable or '\' characters. This routine is suitable for use + in escaping user data in ldap filters. +*/ +char *ldb_binary_encode_string(void *mem_ctx, const char *string) +{ + struct ldb_val val; + val.data = string; + val.length = strlen(string); + return ldb_binary_encode(mem_ctx, val); +} + /* find the first matching wildcard */ static char *ldb_parse_find_wildcard(char *value) { |