Esempio n. 1
0
gboolean
update_rawx_conf(apr_pool_t* p, rawx_conf_t **rawx_conf, const gchar* ns_name)
{
	rawx_conf_t* new_conf = NULL;
        namespace_info_t* ns_info;
        GError *local_error = NULL;

        ns_info = get_namespace_info(ns_name, &local_error);
        if (!ns_info)
                return FALSE;

	new_conf = apr_palloc(p, sizeof(rawx_conf_t));
	char * stgpol = NULL;
	stgpol = namespace_storage_policy(ns_info, ns_info->name);
	if(NULL != stgpol) {
		new_conf->sp = storage_policy_init(ns_info, stgpol);
	}

	new_conf->ni = ns_info;
	new_conf->acl = _get_acl(p, ns_info);
        new_conf->last_update = time(0);

	*rawx_conf = new_conf;
	return TRUE;
}
Esempio n. 2
0
static const char *
dav_rainx_cmd_gridconfig_namespace(cmd_parms *cmd, void *config, const char *arg1)
{
	dav_rainx_server_conf *conf;
	(void) config;

	DAV_XDEBUG_POOL(cmd->pool, 0, "%s()", __FUNCTION__);

	conf = ap_get_module_config(cmd->server->module_config, &dav_rainx_module);
	memset(conf->ns_name, 0x00, sizeof(conf->ns_name));
	apr_cpystrn(conf->ns_name, arg1, sizeof(conf->ns_name));


	DAV_DEBUG_POOL(cmd->pool, 0, "NS=[%s]", conf->ns_name);

	/* Prepare COMPRESSION / ACL CONF when we get ns name */
	namespace_info_t* ns_info;
	GError *local_error = NULL;
	ns_info = get_namespace_info(conf->ns_name, &local_error);
	if (!ns_info) {
		DAV_DEBUG_POOL(cmd->temp_pool, 0, "Failed to get namespace info from ns [%s]", conf->ns_name);
		return apr_pstrcat(cmd->temp_pool, "Failed to get namespace info from ns: ",
				conf->ns_name, " ", local_error->message, NULL);
	}

	if (!conf->rainx_conf_lock) {
		apr_thread_mutex_create(&(conf->rainx_conf_lock),
				APR_THREAD_MUTEX_DEFAULT, conf->pool);
	}

	apr_thread_mutex_lock(conf->rainx_conf_lock);
	conf->rainx_conf = apr_palloc(cmd->pool, sizeof(rawx_conf_t));

	char * stgpol = NULL;
	stgpol = namespace_storage_policy(ns_info, ns_info->name);
	if(NULL != stgpol) {
		conf->rainx_conf->sp = storage_policy_init(ns_info, stgpol);
	} else {
		conf->rainx_conf->sp = NULL;
	}

	conf->rainx_conf->ni = ns_info;

	conf->rainx_conf->acl = _get_acl(cmd->pool, ns_info);
	conf->rainx_conf->last_update = time(0);
	apr_thread_mutex_unlock(conf->rainx_conf_lock);

	if(local_error)
		g_clear_error(&local_error);
	return NULL;
}