diff options
Diffstat (limited to 'nsswitch/libwbclient/wbc_util.c')
-rw-r--r-- | nsswitch/libwbclient/wbc_util.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/nsswitch/libwbclient/wbc_util.c b/nsswitch/libwbclient/wbc_util.c index 4060e2521c1..2027f327ef5 100644 --- a/nsswitch/libwbclient/wbc_util.c +++ b/nsswitch/libwbclient/wbc_util.c @@ -747,73 +747,3 @@ wbcErr wbcLookupDomainControllerEx(const char *domain, done: return wbc_status; } - -static void wbcNamedBlobDestructor(void *ptr) -{ - struct wbcNamedBlob *b = (struct wbcNamedBlob *)ptr; - - while (b->name != NULL) { - free(discard_const_p(char, b->name)); - free(b->blob.data); - b += 1; - } -} - -/* Initialize a named blob and add to list of blobs */ -wbcErr wbcAddNamedBlob(size_t *num_blobs, - struct wbcNamedBlob **pblobs, - const char *name, - uint32_t flags, - uint8_t *data, - size_t length) -{ - wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; - struct wbcNamedBlob *blobs, *blob; - - if (name == NULL) { - return WBC_ERR_INVALID_PARAM; - } - - /* - * Overallocate the b->name==NULL terminator for - * wbcNamedBlobDestructor - */ - blobs = (struct wbcNamedBlob *)wbcAllocateMemory( - *num_blobs + 2, sizeof(struct wbcNamedBlob), - wbcNamedBlobDestructor); - - if (blobs == NULL) { - return WBC_ERR_NO_MEMORY; - } - - if (*pblobs != NULL) { - struct wbcNamedBlob *old = *pblobs; - memcpy(blobs, old, sizeof(struct wbcNamedBlob) * (*num_blobs)); - if (*num_blobs != 0) { - /* end indicator for wbcNamedBlobDestructor */ - old[0].name = NULL; - } - wbcFreeMemory(old); - } - *pblobs = blobs; - - blob = &blobs[*num_blobs]; - - blob->name = strdup(name); - BAIL_ON_PTR_ERROR(blob->name, wbc_status); - blob->flags = flags; - - blob->blob.length = length; - blob->blob.data = (uint8_t *)malloc(length); - BAIL_ON_PTR_ERROR(blob->blob.data, wbc_status); - memcpy(blob->blob.data, data, length); - - *num_blobs += 1; - *pblobs = blobs; - blobs = NULL; - - wbc_status = WBC_ERR_SUCCESS; -done: - wbcFreeMemory(blobs); - return wbc_status; -} |