mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
parent
fc487fb552
commit
6e62c6beac
@ -119,9 +119,9 @@ BOOL gencache_set(const char *keystr, const char *value, time_t timeout)
|
||||
if (!valstr)
|
||||
return False;
|
||||
|
||||
keybuf.dptr = strdup(keystr);
|
||||
keybuf.dptr = (uint8_t *)strdup(keystr);
|
||||
keybuf.dsize = strlen(keystr)+1;
|
||||
databuf.dptr = strdup(valstr);
|
||||
databuf.dptr = (uint8_t *)strdup(valstr);
|
||||
databuf.dsize = strlen(valstr)+1;
|
||||
DEBUG(10, ("Adding cache entry with key = %s; value = %s and timeout \
|
||||
= %s (%d seconds %s)\n", keybuf.dptr, value, ctime(&timeout),
|
||||
@ -171,9 +171,9 @@ BOOL gencache_set_only(const char *keystr, const char *valstr, time_t timeout)
|
||||
= %s\n", keystr, old_valstr, ctime(&old_timeout)));
|
||||
|
||||
asprintf(&datastr, CACHE_DATA_FMT, (int)timeout, valstr);
|
||||
keybuf.dptr = strdup(keystr);
|
||||
keybuf.dptr = (uint8_t *)strdup(keystr);
|
||||
keybuf.dsize = strlen(keystr)+1;
|
||||
databuf.dptr = strdup(datastr);
|
||||
databuf.dptr = (uint8_t *)strdup(datastr);
|
||||
databuf.dsize = strlen(datastr)+1;
|
||||
DEBUGADD(10, ("New value = %s, new timeout = %s (%d seconds %s)", valstr,
|
||||
ctime(&timeout), (int)(timeout - time(NULL)),
|
||||
@ -210,7 +210,7 @@ BOOL gencache_del(const char *keystr)
|
||||
|
||||
if (!gencache_init()) return False;
|
||||
|
||||
keybuf.dptr = strdup(keystr);
|
||||
keybuf.dptr = (uint8_t *)strdup(keystr);
|
||||
keybuf.dsize = strlen(keystr)+1;
|
||||
DEBUG(10, ("Deleting cache entry (key = %s)\n", keystr));
|
||||
ret = tdb_delete(cache->tdb, keybuf);
|
||||
@ -243,13 +243,13 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout)
|
||||
if (!gencache_init())
|
||||
return False;
|
||||
|
||||
keybuf.dptr = strdup(keystr);
|
||||
keybuf.dptr = (uint8_t *)strdup(keystr);
|
||||
keybuf.dsize = strlen(keystr)+1;
|
||||
databuf = tdb_fetch(cache->tdb, keybuf);
|
||||
SAFE_FREE(keybuf.dptr);
|
||||
|
||||
if (databuf.dptr && databuf.dsize > TIMEOUT_LEN) {
|
||||
char* entry_buf = strndup(databuf.dptr, databuf.dsize);
|
||||
char* entry_buf = strndup((char *)databuf.dptr, databuf.dsize);
|
||||
char *v;
|
||||
time_t t;
|
||||
unsigned i;
|
||||
@ -323,7 +323,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
|
||||
|
||||
while (node) {
|
||||
/* ensure null termination of the key string */
|
||||
keystr = strndup(node->node_key.dptr, node->node_key.dsize);
|
||||
keystr = strndup((char *)node->node_key.dptr, node->node_key.dsize);
|
||||
|
||||
/*
|
||||
* We don't use gencache_get function, because we need to iterate through
|
||||
@ -336,7 +336,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
|
||||
node = node->next;
|
||||
continue;
|
||||
}
|
||||
entry = strndup(databuf.dptr, databuf.dsize);
|
||||
entry = strndup((char *)databuf.dptr, databuf.dsize);
|
||||
SAFE_FREE(databuf.dptr);
|
||||
valstr = malloc_array_p(char, databuf.dsize - TIMEOUT_LEN);
|
||||
sscanf(entry, CACHE_DATA_FMT, (int*)(&i), valstr);
|
||||
|
Loading…
Reference in New Issue
Block a user