summaryrefslogtreecommitdiff
path: root/source3/lib/util_unistr.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-01 12:31:43 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-01 12:31:43 +0000
commitde744cb970f5e3afb174a2d923d4e7d11b266173 (patch)
tree25f88000f08db8b0720a837e1f09f184b2e9b1bd /source3/lib/util_unistr.c
parentc5f4a4b9aded84540df4273128b471a32eb9f29b (diff)
downloadsamba-de744cb970f5e3afb174a2d923d4e7d11b266173.tar.gz
samba-de744cb970f5e3afb174a2d923d4e7d11b266173.tar.bz2
samba-de744cb970f5e3afb174a2d923d4e7d11b266173.zip
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)
Diffstat (limited to 'source3/lib/util_unistr.c')
-rw-r--r--source3/lib/util_unistr.c17
1 files changed, 17 insertions, 0 deletions
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
@@ -165,6 +165,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
********************************************************************/