summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Baumbach <bb@sernet.de>2014-04-14 14:37:29 +0200
committerKarolin Seeger <kseeger@samba.org>2014-04-29 10:32:59 +0200
commitdeadf7095c3ad7f93e8d099052503b0a334b9eec (patch)
tree045d4f07fbdefb29a52c582ae0a0a9eee2d7155f
parent3d6e3aceecf8893484f3fba73aef7d55c14d6b4a (diff)
downloadsamba-deadf7095c3ad7f93e8d099052503b0a334b9eec.tar.gz
lib-util: rename memdup to smb_memdup and fix all callers (bug #10556)
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit fae7e5d771d1c69bded1189b23335647023fa0f7) Conflicts: ctdb/lib/util/util.h Also renamed memdup() in source3/locking/brlock.c
-rw-r--r--lib/util/samba_util.h2
-rw-r--r--lib/util/util.c2
-rw-r--r--source3/lib/interface.c4
-rw-r--r--source3/lib/smbldap.c2
-rw-r--r--source3/libsmb/clirap.c4
-rw-r--r--source3/locking/brlock.c2
-rw-r--r--source3/passdb/secrets.c2
-rw-r--r--source3/smbd/seal.c2
-rw-r--r--source3/smbd/sec_ctx.c4
-rw-r--r--source3/winbindd/winbindd_cache.c2
-rw-r--r--source4/smbd/process_thread.c4
11 files changed, 15 insertions, 15 deletions
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 311e99de818..c061721e651 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -725,7 +725,7 @@ char *smb_xstrndup(const char *s, size_t n);
/**
Like strdup but for memory.
**/
-_PUBLIC_ void *memdup(const void *p, size_t size);
+_PUBLIC_ void *smb_memdup(const void *p, size_t size);
/**
* Write a password to the log file.
diff --git a/lib/util/util.c b/lib/util/util.c
index f63720c3ee0..697c9bff4a9 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -622,7 +622,7 @@ char *smb_xstrndup(const char *s, size_t n)
Like strdup but for memory.
**/
-_PUBLIC_ void *memdup(const void *p, size_t size)
+_PUBLIC_ void *smb_memdup(const void *p, size_t size)
{
void *p2;
if (size == 0)
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 39dc9cb04c2..3edeae5742b 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -503,10 +503,10 @@ void load_interfaces(void)
total_probed = get_interfaces(talloc_tos(), &ifaces);
if (total_probed > 0) {
- probed_ifaces = (struct iface_struct *)memdup(ifaces,
+ probed_ifaces = (struct iface_struct *)smb_memdup(ifaces,
sizeof(ifaces[0])*total_probed);
if (!probed_ifaces) {
- DEBUG(0,("ERROR: memdup failed\n"));
+ DEBUG(0,("ERROR: smb_memdup failed\n"));
exit(1);
}
}
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 5dd6d8d65b3..7c6b8ee8868 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -353,7 +353,7 @@ static void smbldap_set_mod_internal(LDAPMod *** modlist, int modop, const char
mods[i]->mod_bvalues[j] = SMB_MALLOC_P(struct berval);
SMB_ASSERT(mods[i]->mod_bvalues[j] != NULL);
- mods[i]->mod_bvalues[j]->bv_val = (char *)memdup(blob->data, blob->length);
+ mods[i]->mod_bvalues[j]->bv_val = (char *)smb_memdup(blob->data, blob->length);
SMB_ASSERT(mods[i]->mod_bvalues[j]->bv_val != NULL);
mods[i]->mod_bvalues[j]->bv_len = blob->length;
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 7c185ef5ad0..40d5f67a6f8 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -67,14 +67,14 @@ bool cli_api(struct cli_state *cli,
* talloc
*/
- *rparam = (char *)memdup(my_rparam, num_my_rparam);
+ *rparam = (char *)smb_memdup(my_rparam, num_my_rparam);
if (*rparam == NULL) {
goto fail;
}
*rprcnt = num_my_rparam;
TALLOC_FREE(my_rparam);
- *rdata = (char *)memdup(my_rdata, num_my_rdata);
+ *rdata = (char *)smb_memdup(my_rdata, num_my_rdata);
if (*rdata == NULL) {
goto fail;
}
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 43abb984489..de665c8b34d 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1774,7 +1774,7 @@ static int brl_traverse_fn(struct db_record *rec, void *state)
/* In a traverse function we must make a copy of
dbuf before modifying it. */
- locks = (struct lock_struct *)memdup(value.dptr, value.dsize);
+ locks = (struct lock_struct *)smb_memdup(value.dptr, value.dsize);
if (!locks) {
return -1; /* Terminate traversal. */
}
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 8f314a76cf5..eb59adbda59 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -144,7 +144,7 @@ void *secrets_fetch(const char *key, size_t *size)
return NULL;
}
- result = memdup(dbuf.dptr, dbuf.dsize);
+ result = smb_memdup(dbuf.dptr, dbuf.dsize);
if (result == NULL) {
return NULL;
}
diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c
index cdcfe06835d..7122bf24e05 100644
--- a/source3/smbd/seal.c
+++ b/source3/smbd/seal.c
@@ -245,7 +245,7 @@ NTSTATUS srv_request_encryption_setup(connection_struct *conn,
/* Return the raw blob. */
SAFE_FREE(*ppdata);
- *ppdata = (unsigned char *)memdup(response.data, response.length);
+ *ppdata = (unsigned char *)smb_memdup(response.data, response.length);
if ((*ppdata) == NULL && response.length > 0)
return NT_STATUS_NO_MEMORY;
*p_data_size = response.length;
diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c
index d474219eba2..c34247e615a 100644
--- a/source3/smbd/sec_ctx.c
+++ b/source3/smbd/sec_ctx.c
@@ -331,8 +331,8 @@ void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, const struct
TALLOC_FREE(ctx_p->token);
if (ngroups) {
- ctx_p->ut.groups = (gid_t *)memdup(groups,
- sizeof(gid_t) * ngroups);
+ ctx_p->ut.groups = (gid_t *)smb_memdup(groups,
+ sizeof(gid_t) * ngroups);
if (!ctx_p->ut.groups) {
smb_panic("memdup failed");
}
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 34319dfab27..860526b08e8 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -3556,7 +3556,7 @@ static struct cache_entry *create_centry_validate(const char *kstr, TDB_DATA dat
struct cache_entry *centry;
centry = SMB_XMALLOC_P(struct cache_entry);
- centry->data = (unsigned char *)memdup(data.dptr, data.dsize);
+ centry->data = (unsigned char *)smb_memdup(data.dptr, data.dsize);
if (!centry->data) {
SAFE_FREE(centry);
return NULL;
diff --git a/source4/smbd/process_thread.c b/source4/smbd/process_thread.c
index 764c1f36d5d..ad264c91561 100644
--- a/source4/smbd/process_thread.c
+++ b/source4/smbd/process_thread.c
@@ -218,7 +218,7 @@ static void thread_set_title(struct tevent_context *ev, const char *title)
static int thread_mutex_init(smb_mutex_t *mutex, const char *name)
{
pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
- mutex->mutex = memdup(&m, sizeof(m));
+ mutex->mutex = smb_memdup(&m, sizeof(m));
if (! mutex->mutex) {
errno = ENOMEM;
return -1;
@@ -294,7 +294,7 @@ static int thread_mutex_unlock(smb_mutex_t *mutex, const char *name)
static int thread_rwlock_init(smb_rwlock_t *rwlock, const char *name)
{
pthread_rwlock_t m = PTHREAD_RWLOCK_INITIALIZER;
- rwlock->rwlock = memdup(&m, sizeof(m));
+ rwlock->rwlock = smb_memdup(&m, sizeof(m));
if (! rwlock->rwlock) {
errno = ENOMEM;
return -1;