diff options
-rw-r--r-- | nsswitch/libwbclient/wbclient.c | 14 | ||||
-rw-r--r-- | nsswitch/libwbclient/wbclient_internal.h | 2 |
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 */ |