From de744cb970f5e3afb174a2d923d4e7d11b266173 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 1 Dec 2001 12:31:43 +0000 Subject: The beginnings of alternative backends for winbindd This just splits off the dispinfo call behind a methods structure. I'll split off a few more functions soon, then we will be ready for LDAP replacement methods (This used to be commit 0216b0fca115c903ec31ed21427a83c62077dc95) --- source3/lib/util_unistr.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source3/lib/util_unistr.c') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index d2d23dafa5..fc29ca8dc2 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -164,6 +164,23 @@ void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen) } +/******************************************************************* + duplicate a UNISTR2 string into a null terminated char* + using a talloc context +********************************************************************/ +char *unistr2_tdup(TALLOC_CTX *ctx, const UNISTR2 *str) +{ + char *s; + int maxlen = (str->uni_str_len+1)*4; + if (!str->buffer) return NULL; + s = (char *)talloc(ctx, maxlen); /* convervative */ + if (!s) return NULL; + pull_ucs2(NULL, s, str->buffer, maxlen, str->uni_str_len*2, + STR_NOALIGN); + return s; +} + + /******************************************************************* Return a number stored in a buffer ********************************************************************/ -- cgit