Exemple #1
0
static struct sdirs *setup_sdirs(struct conf **confs)
{
	struct sdirs *sdirs;
	fail_unless((sdirs=sdirs_alloc())!=NULL);
	fail_unless(sdirs_init_from_confs(sdirs, confs)==0);
	return sdirs;
}
Exemple #2
0
// The return code of this is the return code of the standalone process.
int champ_chooser_server_standalone(struct conf **globalcs)
{
	int ret=1;
	struct sdirs *sdirs=NULL;
	struct conf **cconfs=NULL;
	const char *orig_client=get_string(globalcs[OPT_ORIG_CLIENT]);

	if(!(cconfs=confs_alloc()))
		goto end;
	confs_init(cconfs);
	// We need to be given a client name and load the relevant server side
	// clientconfdir file, because various settings may be overridden
	// there.
	if(set_string(cconfs[OPT_CNAME], orig_client)
	  || conf_load_clientconfdir(globalcs, cconfs)
	  || !(sdirs=sdirs_alloc())
	  || sdirs_init_from_confs(sdirs, cconfs)
	  || champ_chooser_server(sdirs, cconfs, 0 /* resume */))
		goto end;
	ret=0;
end:
	confs_free(&cconfs);
	sdirs_free(&sdirs);
	return ret;
}
Exemple #3
0
int run_action_server(struct async *as,
	const char *incexc, int srestore, int *timer_ret, struct conf **cconfs)
{
	int ret=-1;
        struct sdirs *sdirs=NULL;
        if((sdirs=sdirs_alloc())
          && !sdirs_init_from_confs(sdirs, cconfs))
		ret=run_action_server_do(as,
			sdirs, incexc, srestore, timer_ret, cconfs);
        if(sdirs) lock_release(sdirs->lock);
        sdirs_free(&sdirs);
	return ret;
}
Exemple #4
0
static int set_cstat_from_conf(struct cstat *cstat,
                               struct conf **parentconfs, struct conf **cconfs)
{
    struct strlist *s=NULL;
    // Make sure the permitted flag is set appropriately.
    cstat->permitted=cstat_permitted(cstat, parentconfs, cconfs);

    cstat->protocol=get_protocol(cconfs);
    sdirs_free((struct sdirs **)&cstat->sdirs);
    if(!(cstat->sdirs=sdirs_alloc())
            || sdirs_init_from_confs((struct sdirs *)cstat->sdirs, cconfs))
        return -1;
    strlists_free(&cstat->labels);
    for(s=get_strlist(cconfs[OPT_LABEL]); s; s=s->next)
        if(strlist_add_sorted(&cstat->labels, s->path, s->flag))
            return -1;
    return 0;
}