/* The following definitions come from lib/gencache.c */
-bool gencache_init(void);
-bool gencache_shutdown(void);
bool gencache_set(const char *keystr, const char *value, time_t timeout);
bool gencache_del(const char *keystr);
bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
* false on failure
**/
-bool gencache_init(void)
+static bool gencache_init(void)
{
char* cache_fname = NULL;
}
-/**
- * Cache shutdown function. Closes opened cache tdb file.
- *
- * @return true on successful closing the cache or
- * false on failure during cache shutdown
- **/
-
-bool gencache_shutdown(void)
-{
- int ret;
- /* tdb_close routine returns -1 on error */
- if (!cache) return False;
- DEBUG(5, ("Closing cache file\n"));
- ret = tdb_close(cache);
- cache = NULL;
- return ret != -1;
-}
-
-
/**
* Set an entry in the cache file. If there's no such
* one, then add it.
gfree_charcnv();
gfree_interfaces();
- gencache_shutdown();
secrets_shutdown();
TALLOC_FREE(ctx);
bool ret = False;
char *key;
- if (!gencache_init()) {
- return False;
- }
-
if (!realm || (strlen(realm) == 0)) {
DEBUG(0,("sitename_store: no realm\n"));
return False;
const char *query_realm;
char *key;
- if (!gencache_init()) {
- return NULL;
- }
-
if (!realm || (strlen(realm) == 0)) {
query_realm = lp_realm();
} else {
{
char *key;
- if (!gencache_init()) {
- return NT_STATUS_INTERNAL_DB_ERROR;
- }
-
key = dsgetdcname_cache_key(mem_ctx, domain_name);
if (!key) {
return NT_STATUS_NO_MEMORY;
char *key;
bool ret = false;
- if (!gencache_init()) {
- return NT_STATUS_INTERNAL_DB_ERROR;
- }
-
key = dsgetdcname_cache_key(mem_ctx, domain_name);
if (!key) {
return NT_STATUS_NO_MEMORY;
struct NETLOGON_SAM_LOGON_RESPONSE_EX r;
NTSTATUS status;
- if (!gencache_init()) {
- return NT_STATUS_INTERNAL_DB_ERROR;
- }
-
key = dsgetdcname_cache_key(mem_ctx, domain_name);
if (!key) {
return NT_STATUS_NO_MEMORY;
static void
SMBC_module_terminate(void)
{
- gencache_shutdown();
secrets_shutdown();
gfree_all();
SMBC_initialized = false;
return False;
}
- /* Init namecache by calling gencache initialisation */
-
- if (!gencache_init()) {
- DEBUG(2, ("namecache_enable: "
- "Couldn't initialise namecache on top of gencache.\n"));
- return False;
- }
-
/* I leave it for now, though I don't think we really
* need this (mimir, 27.09.2002) */
DEBUG(5, ("namecache_enable: enabling netbios namecache, timeout %d "
int i;
bool ret;
- /*
- * we use gecache call to avoid annoying debug messages about
- * initialised namecache again and again...
- */
- if (!gencache_init()) {
- return False;
- }
-
if (name_type > 255) {
return False; /* Don't store non-real name types. */
}
return False;
}
- if (!gencache_init()) {
- return False;
- }
-
if (name_type > 255) {
return False; /* Don't fetch non-real name types. */
}
bool ret;
char *key;
- if (!gencache_init())
- return False;
-
if (name_type > 255) {
return False; /* Don't fetch non-real name types. */
}
void namecache_flush(void)
{
- if (!gencache_init()) {
- return;
- }
-
/*
* iterate through each NBT cache's entry and flush it
* by flush_netbios_name function
time_t expiry;
bool ret;
- if (!gencache_init()) {
- return False;
- }
-
key = namecache_status_record_key(keyname, keyname_type,
name_type, keyip);
if (!key)
char *value = NULL;
time_t timeout;
- if (!gencache_init())
- return False;
-
key = namecache_status_record_key(keyname, keyname_type,
name_type, keyip);
if (!key)
return False;
}
- if ( !gencache_init() )
- return False;
-
key = saf_key( domain );
expire = time( NULL ) + lp_parm_int(-1, "saf","ttl", SAF_TTL);
return False;
}
- if ( !gencache_init() )
- return False;
-
key = saf_join_key( domain );
expire = time( NULL ) + lp_parm_int(-1, "saf","join ttl", SAFJOIN_TTL);
return False;
}
- if ( !gencache_init() )
- return False;
-
key = saf_join_key(domain);
ret = gencache_del(key);
SAFE_FREE(key);
return NULL;
}
- if ( !gencache_init() )
- return False;
-
key = saf_join_key( domain );
ret = gencache_get( key, &server, &timeout );
bool trustdom_cache_enable(void)
{
- /* Init trustdom cache by calling gencache initialisation */
- if (!gencache_init()) {
- DEBUG(2, ("trustdomcache_enable: Couldn't initialise trustdom cache on top of gencache.\n"));
- return False;
- }
-
return True;
}
bool trustdom_cache_shutdown(void)
{
- /* Close trustdom cache by calling gencache shutdown */
- if (!gencache_shutdown()) {
- DEBUG(2, ("trustdomcache_shutdown: Couldn't shutdown trustdom cache on top of gencache.\n"));
- return False;
- }
-
return True;
}
fstring sid_string;
bool ret;
- /*
- * we use gecache call to avoid annoying debug messages
- * about initialised trustdom
- */
- if (!gencache_init())
- return False;
-
DEBUG(5, ("trustdom_store: storing SID %s of domain %s\n",
sid_string_dbg(sid), name));
char *key = NULL, *value = NULL;
time_t timeout;
- /* init the cache */
- if (!gencache_init())
- return False;
-
/* exit now if null pointers were passed as they're required further */
if (!sid)
return False;
time_t timeout;
uint32 timestamp;
- /* init the cache */
- if (!gencache_init())
- return False;
-
if (!gencache_get(TDOMTSKEY, &value, &timeout)) {
DEBUG(5, ("no timestamp for trusted domain cache located.\n"));
SAFE_FREE(value);
{
fstring value;
- /* init the cache */
- if (!gencache_init())
- return False;
-
fstr_sprintf(value, "%d", t );
if (!gencache_set(TDOMTSKEY, value, timeout)) {
void trustdom_cache_flush(void)
{
- if (!gencache_init())
- return;
-
/*
* iterate through each TDOM cache's entry and flush it
* by flush_trustdom_name function
time_t tm;
DATA_BLOB blob;
- if (!gencache_init()) {
- d_printf("%s: gencache_init() failed\n", __location__);
- return False;
- }
-
if (!gencache_set("foo", "bar", time(NULL) + 1000)) {
d_printf("%s: gencache_set() failed\n", __location__);
return False;
return False;
}
- if (!gencache_shutdown()) {
- d_printf("%s: gencache_shutdown() failed\n", __location__);
- return False;
- }
-
- if (gencache_shutdown()) {
- d_printf("%s: second gencache_shutdown() succeeded\n",
- __location__);
- return False;
- }
-
return True;
}
if (gencache_set(keystr, datastr, timeout)) {
d_printf("New cache entry stored successfully.\n");
- gencache_shutdown();
return 0;
}
d_fprintf(stderr, "Entry couldn't be added. Perhaps there's already such a key.\n");
- gencache_shutdown();
return -1;
}
return 0;
}
gencache_iterate(print_cache_entry, NULL, pattern);
- gencache_shutdown();
return 0;
}
return 0;
}
gencache_iterate(delete_cache_entry, NULL, pattern);
- gencache_shutdown();
return 0;
}