diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2010-10-28 12:12:12 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-11-15 09:52:34 -0500 |
commit | ca92350db6ad6ac344181f7b8ec695eda29da675 (patch) | |
tree | a13639292904be7def057dd21127c768153669f5 /src/util/util.h | |
parent | a476bf85436d8a8195df1693db5b806a9c8f56bd (diff) | |
download | sssd-ca92350db6ad6ac344181f7b8ec695eda29da675.tar.gz sssd-ca92350db6ad6ac344181f7b8ec695eda29da675.tar.xz sssd-ca92350db6ad6ac344181f7b8ec695eda29da675.zip |
Add utility function to sanitize LDAP/LDB filters
Also adds a unit test.
Diffstat (limited to 'src/util/util.h')
-rw-r--r-- | src/util/util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/util.h b/src/util/util.h index e93f6f863..53a6b1c97 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -366,4 +366,15 @@ errno_t diff_string_lists(TALLOC_CTX *memctx, char ***string1_only, char ***string2_only, char ***both_strings); + +/* Sanitize an input string (e.g. a username) for use in + * an LDAP/LDB filter + * Returns a newly-constructed string attached to mem_ctx + * It will fail only on an out of memory condition, where it + * will return ENOMEM. + */ +errno_t sss_filter_sanitize(TALLOC_CTX *mem_ctx, + const char *input, + char **sanitized); + #endif /* __SSSD_UTIL_H__ */ |