From 3a3b761bc89aa860ca7e6af323c3e0425306014c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Sun, 26 Mar 2017 01:49:53 +0100 Subject: [PATCH 53/54] UTIL: Expose replace_char() as sss_replace_char() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This method is going to be used in the follow-up patch for replacing ',' by ':' so we can keep the domain resolution order option consitent with the way it's set on IPA side and still keep consistent with the way lists are represented on sssd.conf file. Related: https://pagure.io/SSSD/sssd/issue/3001 Signed-off-by: Fabiano Fidêncio Reviewed-by: Sumit Bose Reviewed-by: Pavel Březina --- src/util/string_utils.c | 12 ++++++------ src/util/util.h | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/util/string_utils.c b/src/util/string_utils.c index 872b7e29e55e8628085affd07f3363019aae5ee9..1215ec96a57089a13f455812adf5a0b0812afa6d 100644 --- a/src/util/string_utils.c +++ b/src/util/string_utils.c @@ -22,10 +22,10 @@ #include "util/util.h" -static char *replace_char(TALLOC_CTX *mem_ctx, - const char *in, - const char match, - const char sub) +char *sss_replace_char(TALLOC_CTX *mem_ctx, + const char *in, + const char match, + const char sub) { char *p; char *out; @@ -63,7 +63,7 @@ char * sss_replace_space(TALLOC_CTX *mem_ctx, return talloc_strdup(mem_ctx, orig_name); } - return replace_char(mem_ctx, orig_name, ' ', subst); + return sss_replace_char(mem_ctx, orig_name, ' ', subst); } char * sss_reverse_replace_space(TALLOC_CTX *mem_ctx, @@ -81,7 +81,7 @@ char * sss_reverse_replace_space(TALLOC_CTX *mem_ctx, return talloc_strdup(mem_ctx, orig_name); } - return replace_char(mem_ctx, orig_name, subst, ' '); + return sss_replace_char(mem_ctx, orig_name, subst, ' '); } errno_t guid_blob_to_string_buf(const uint8_t *blob, char *str_buf, diff --git a/src/util/util.h b/src/util/util.h index 82760940269ad8883e725e3a5cf463486c9cfd36..2170c5fb7cffda3910d2b58e33ec7abe3ec4a7d4 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -600,6 +600,11 @@ errno_t name_to_well_known_sid(const char *dom, const char *name, const char **sid); /* from string_utils.c */ +char *sss_replace_char(TALLOC_CTX *mem_ctx, + const char *in, + const char match, + const char sub); + char * sss_replace_space(TALLOC_CTX *mem_ctx, const char *orig_name, const char replace_char); -- 2.9.3