diff options
author | venaas <venaas> | 2007-11-26 12:14:30 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2007-11-26 12:14:30 +0000 |
commit | cbd283e0022dd394799786c6504c85df7fd40b5b (patch) | |
tree | d73cf8ba9ad7f30fa5ec939c47d5d8e604cdb657 /radsecproxy.c | |
parent | ddddde8f5202c6ae5da26b19e2c6a84709b8ea4d (diff) |
implemented config file stack; to be used for include support
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@198 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r-- | radsecproxy.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/radsecproxy.c b/radsecproxy.c index ea55c17..aa01bb9 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -2431,28 +2431,29 @@ void addrealm(char *value, char **servers, char *message) { debug(DBG_DBG, "addrealm: added realm %s", value); } -FILE *openconfigfile(const char *filename) { +struct gconffile *openconfigfile(const char *filename) { FILE *f; char pathname[100], *base = NULL; + struct gconffile *cf = NULL; - f = fopen(filename, "r"); + f = pushgconffile(&cf, filename); if (f) { debug(DBG_DBG, "reading config file %s", filename); - return f; + return cf; } if (strlen(filename) + 1 <= sizeof(pathname)) { /* basename() might modify the string */ strcpy(pathname, filename); base = basename(pathname); - f = fopen(base, "r"); + f = pushgconffile(&cf, base); } if (!f) debugx(1, DBG_ERR, "could not read config file %s nor %s\n%s", filename, base, strerror(errno)); debug(DBG_DBG, "reading config file %s", base); - return f; + return cf; } int addmatchcertattr(struct clsrvconf *conf, char *matchcertattr) { @@ -2689,8 +2690,10 @@ void conftls_cb(FILE *f, char *block, char *opt, char *val) { void getmainconfig(const char *configfile) { FILE *f; char *loglevel = NULL; + struct gconffile *cfs; - f = openconfigfile(configfile); + cfs = openconfigfile(configfile); + f = cfs->file; memset(&options, 0, sizeof(options)); clconfs = list_create(); @@ -2723,7 +2726,7 @@ void getmainconfig(const char *configfile) { "TLS", CONF_CBK, conftls_cb, NULL ); - fclose(f); + popgconffile(&cfs); tlsfree(); if (loglevel) { |