Exemple #1
0
static bool idmap_cache_del_sid2xid(TALLOC_CTX* mem_ctx, char t, const char* sid)
{
	const char* sid_key = key_sid2xid_str(mem_ctx, t, sid);
	char* xid_str;
	time_t timeout;
	bool ret = true;

	if (!gencache_get(sid_key, &xid_str, &timeout)) {
		ret = false;
		goto done;
	}

	if (atoi(xid_str) != -1) {
		const char* xid_key = key_xid2sid_str(mem_ctx, t, xid_str);
		if (!gencache_del(xid_key)) {
			DEBUG(2, ("failed to delete: %s\n", xid_key));
			ret = false;
		} else {
			DEBUG(5, ("delete: %s\n", xid_key));
		}
	}

	if (!gencache_del(sid_key)) {
		DEBUG(2, ("failed to delete: %s\n", sid_key));
		ret = false;
	} else {
		DEBUG(5, ("delete: %s\n", sid_key));
	}
done:
	return ret;
}
Exemple #2
0
static void delete_cache_entry(const char* keystr, const char* datastr,
                               const time_t timeout, void* dptr)
{
	if (!gencache_del(keystr))
		d_fprintf(stderr, _("Couldn't delete entry! key = %s\n"),
			  keystr);
}
Exemple #3
0
static void flush_netbios_name(const char *key,
                               const char *value,
                               time_t timeout,
                               void *dptr)
{
    gencache_del(key);
    DEBUG(5, ("Deleting entry %s\n", key));
}
Exemple #4
0
/*
  mark a wins server as being alive (for the moment)
*/
void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip)
{
	char *keystr = wins_srv_keystr(wins_ip, src_ip);

	gencache_del(keystr);
	SAFE_FREE(keystr);

	DEBUG(4, ("wins_srv_alive: marking wins server %s alive\n", 
		  inet_ntoa(wins_ip)));
}
Exemple #5
0
static bool idmap_cache_del_xid(char t, int xid)
{
	TALLOC_CTX* mem_ctx = talloc_stackframe();
	const char* key = key_xid2sid(mem_ctx, t, xid);
	char* sid_str = NULL;
	time_t timeout;
	bool ret = true;

	if (!gencache_get(key, &sid_str, &timeout)) {
		DEBUG(3, ("no entry: %s\n", key));
		ret = false;
		goto done;
	}

	if (sid_str[0] != '-') {
		const char* sid_key = key_sid2xid_str(mem_ctx, t, sid_str);
		if (!gencache_del(sid_key)) {
			DEBUG(2, ("failed to delete: %s\n", sid_key));
			ret = false;
		} else {
			DEBUG(5, ("delete: %s\n", sid_key));
		}

	}

	if (!gencache_del(key)) {
		DEBUG(1, ("failed to delete: %s\n", key));
		ret = false;
	} else {
		DEBUG(5, ("delete: %s\n", key));
	}

done:
	talloc_free(mem_ctx);
	return ret;
}
Exemple #6
0
static NTSTATUS dsgetdcname_cache_delete(TALLOC_CTX *mem_ctx,
					const char *domain_name)
{
	char *key;

	key = dsgetdcname_cache_key(mem_ctx, domain_name);
	if (!key) {
		return NT_STATUS_NO_MEMORY;
	}

	if (!gencache_del(key)) {
		return NT_STATUS_UNSUCCESSFUL;
	}

	return NT_STATUS_OK;
}
/**
 * Delete an entry in the cache
 * 
 * @param argv key to delete an entry of
 * @return 0 on success, otherwise failure
 **/
static int net_cache_del(int argc, const char **argv)
{
	const char *keystr = argv[0];
	
	if (argc < 1) {
		d_printf("\nUsage: net cache del <key string>\n");
		return -1;
	}
	
	if(gencache_del(keystr)) {
		d_printf("Entry deleted.\n");
		return 0;
	}

	d_fprintf(stderr, "Couldn't delete specified entry\n");
	return -1;
}
Exemple #8
0
/**
 * Delete an entry in the cache
 *
 * @param c	A net_context structure
 * @param argv key to delete an entry of
 * @return 0 on success, otherwise failure
 **/
static int net_cache_del(struct net_context *c, int argc, const char **argv)
{
	const char *keystr = argv[0];

	if (argc < 1 || c->display_usage) {
		d_printf("%s\n%s",
			 _("Usage:"),
			 _(" net cache del <key string>\n"));
		return -1;
	}

	if(gencache_del(keystr)) {
		d_printf(_("Entry deleted.\n"));
		return 0;
	}

	d_fprintf(stderr, _("Couldn't delete specified entry\n"));
	return -1;
}
Exemple #9
0
bool namecache_delete(const char *name, int name_type)
{
    bool ret;
    char *key;

    if (!gencache_init())
        return False;

    if (name_type > 255) {
        return False; /* Don't fetch non-real name types. */
    }

    key = namecache_key(name, name_type);
    if (!key) {
        return False;
    }
    ret = gencache_del(key);
    SAFE_FREE(key);
    return ret;
}