summaryrefslogtreecommitdiff
path: root/src/util/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/util.c')
-rw-r--r--src/util/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c
index f525c915..ff55fdd7 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -598,3 +598,14 @@ sss_escape_ip_address(TALLOC_CTX *mem_ctx, int family, const char *addr)
return family == AF_INET6 ? talloc_asprintf(mem_ctx, "[%s]", addr) :
talloc_strdup(mem_ctx, addr);
}
+
+/* out->len includes terminating '\0' */
+void to_sized_string(struct sized_string *out, const char *in)
+{
+ out->str = in;
+ if (out->str) {
+ out->len = strlen(out->str) + 1;
+ } else {
+ out->len = 0;
+ }
+}