* @retval false on failure
**/
-bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob,
+bool gencache_set_data_blob(const char *keystr, DATA_BLOB blob,
time_t timeout)
{
int ret;
return false;
}
- if ((keystr == NULL) || (blob == NULL)) {
+ if ((keystr == NULL) || (blob.data == NULL)) {
return false;
}
return false;
}
- if ((timeout != 0) && gencache_have_val(keystr, blob, timeout)) {
+ if ((timeout != 0) && gencache_have_val(keystr, &blob, timeout)) {
DEBUG(10, ("Did not store value for %s, we already got it\n",
keystr));
return true;
if (hdr_len == -1) {
return false;
}
- if ((blob->length + (size_t)hdr_len) < blob->length) {
+ if ((blob.length + (size_t)hdr_len) < blob.length) {
return false;
}
dbufs[0] = (TDB_DATA) { .dptr = (uint8_t *)hdr, .dsize = hdr_len };
- dbufs[1] = (TDB_DATA) { .dptr = blob->data, .dsize = blob->length };
+ dbufs[1] = (TDB_DATA) { .dptr = blob.data, .dsize = blob.length };
DEBUG(10, ("Adding cache entry with key=[%s] and timeout="
"[%s] (%d seconds %s)\n", keystr,
bool gencache_set(const char *keystr, const char *value, time_t timeout)
{
DATA_BLOB blob = data_blob_const(value, strlen(value)+1);
- return gencache_set_data_blob(keystr, &blob, timeout);
+ return gencache_set_data_blob(keystr, blob, timeout);
}
struct gencache_iterate_blobs_state {
DATA_BLOB *blob,
time_t *timeout, bool *was_expired);
bool gencache_stabilize(void);
-bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob,
+bool gencache_set_data_blob(const char *keystr, DATA_BLOB blob,
time_t timeout);
void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
time_t timeout, void *private_data),
static NTSTATUS dsgetdcname_cache_store(TALLOC_CTX *mem_ctx,
const char *domain_name,
- const DATA_BLOB *blob)
+ DATA_BLOB blob)
{
time_t expire_time;
char *key;
}
if (r->domain_name) {
- status = dsgetdcname_cache_store(mem_ctx, r->domain_name, &blob);
+ status = dsgetdcname_cache_store(mem_ctx, r->domain_name,
+ blob);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
}
}
if (r->dns_domain) {
- status = dsgetdcname_cache_store(mem_ctx, r->dns_domain, &blob);
+ status = dsgetdcname_cache_store(mem_ctx, r->dns_domain, blob);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
blob = data_blob_string_const_null("bar");
tm = time(NULL) + 60;
- if (!gencache_set_data_blob("foo", &blob, tm)) {
+ if (!gencache_set_data_blob("foo", blob, tm)) {
d_printf("%s: gencache_set_data_blob() failed\n", __location__);
return False;
}
blob.data = (uint8_t *)&v;
blob.length = sizeof(v);
- if (!gencache_set_data_blob("blob", &blob, tm)) {
+ if (!gencache_set_data_blob("blob", blob, tm)) {
d_printf("%s: gencache_set_data_blob() failed\n",
__location__);
return false;
return status;
}
- ok = gencache_set_data_blob(key, &blob, time(NULL)+3600);
+ ok = gencache_set_data_blob(key, blob, time(NULL)+3600);
if (!ok) {
DBG_WARNING("gencache_set_data_blob for key %s failed\n", key);