summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-04-03 11:59:29 +0200
committerVolker Lendecke <vl@samba.org>2010-04-19 14:27:16 +0200
commita0162303c6e23c8f1d72a0e788d2665a97d16b4b (patch)
treea3553322450ac6b032881eb16ec47dde0c3b2812
parented1981db05af87a48b17866b7e886d1e25fa8f77 (diff)
downloadsamba-a0162303c6e23c8f1d72a0e788d2665a97d16b4b.tar.gz
samba-a0162303c6e23c8f1d72a0e788d2665a97d16b4b.tar.bz2
samba-a0162303c6e23c8f1d72a0e788d2665a97d16b4b.zip
libwbclient: Add wbcStrDup
-rw-r--r--nsswitch/libwbclient/wbclient.c14
-rw-r--r--nsswitch/libwbclient/wbclient_internal.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/nsswitch/libwbclient/wbclient.c b/nsswitch/libwbclient/wbclient.c
index ea6c24ccc3..99248710e6 100644
--- a/nsswitch/libwbclient/wbclient.c
+++ b/nsswitch/libwbclient/wbclient.c
@@ -205,6 +205,20 @@ void wbcFreeMemory(void *p)
return;
}
+char *wbcStrDup(const char *str)
+{
+ char *result;
+ size_t len;
+
+ len = strlen(str);
+ result = (char *)wbcAllocateMemory(len+1, sizeof(char), NULL);
+ if (result == NULL) {
+ return NULL;
+ }
+ memcpy(result, str, len+1);
+ return result;
+}
+
wbcErr wbcLibraryDetails(struct wbcLibraryDetails **_details)
{
struct wbcLibraryDetails *info;
diff --git a/nsswitch/libwbclient/wbclient_internal.h b/nsswitch/libwbclient/wbclient_internal.h
index 6c59be3fef..78178cbafe 100644
--- a/nsswitch/libwbclient/wbclient_internal.h
+++ b/nsswitch/libwbclient/wbclient_internal.h
@@ -35,4 +35,6 @@ wbcErr wbcRequestResponsePriv(int cmd,
void *wbcAllocateMemory(size_t nelem, size_t elsize,
void (*destructor)(void *ptr));
+char *wbcStrDup(const char *str);
+
#endif /* _WBCLIENT_INTERNAL_H */