From 6b99b3dc0fcce1ebd639c93e9a74c1b61da8befe Mon Sep 17 00:00:00 2001 From: venaas Date: Tue, 29 Apr 2008 11:49:16 +0000 Subject: added certificatenamecheck option to client/server for disabling default altsubjectname/cn check git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@245 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- gconfig.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'gconfig.c') diff --git a/gconfig.c b/gconfig.c index 904ad7d..af73db1 100644 --- a/gconfig.c +++ b/gconfig.c @@ -153,6 +153,7 @@ void getgenericconfig(struct gconffile **cf, char *block, ...) { char line[1024]; /* initialise lots of stuff to avoid stupid compiler warnings */ char *tokens[3], *s, *opt = NULL, *val = NULL, *word, *optval, **str = NULL, ***mstr = NULL; + uint8_t *bln; int type = 0, tcount, conftype = 0, n; void (*cbk)(struct gconffile **, char *, char *, char *) = NULL; @@ -230,6 +231,11 @@ void getgenericconfig(struct gconffile **cf, char *block, ...) { if (!mstr) debugx(1, DBG_ERR, "getgenericconfig: internal parameter error"); break; + case CONF_BLN: + bln = va_arg(ap, uint8_t *); + if (!bln) + debugx(1, DBG_ERR, "getgenericconfig: internal parameter error"); + break; case CONF_CBK: cbk = va_arg(ap, void (*)(struct gconffile **, char *, char *, char *)); break; @@ -247,7 +253,7 @@ void getgenericconfig(struct gconffile **cf, char *block, ...) { debugx(1, DBG_ERR, "configuration error, unknown option %s", opt); } - if (((type == CONF_STR || type == CONF_MSTR) && conftype != CONF_STR) || + if (((type == CONF_STR || type == CONF_MSTR || type == CONF_BLN) && conftype != CONF_STR) || (type == CONF_CBK && conftype != CONF_CBK)) { if (block) debugx(1, DBG_ERR, "configuration error in block %s, wrong syntax for option %s", block, opt); @@ -256,10 +262,6 @@ void getgenericconfig(struct gconffile **cf, char *block, ...) { switch (type) { case CONF_STR: - if (block) - debug(DBG_DBG, "getgenericconfig: block %s: %s = %s", block, opt, val); - else - debug(DBG_DBG, "getgenericconfig: %s = %s", opt, val); if (*str) debugx(1, DBG_ERR, "configuration error, option %s already set to %s", opt, *str); *str = stringcopy(val, 0); @@ -267,10 +269,6 @@ void getgenericconfig(struct gconffile **cf, char *block, ...) { debugx(1, DBG_ERR, "malloc failed"); break; case CONF_MSTR: - if (block) - debug(DBG_DBG, "getgenericconfig: block %s: %s = %s", block, opt, val); - else - debug(DBG_DBG, "getgenericconfig: %s = %s", opt, val); if (*mstr) for (n = 0; (*mstr)[n]; n++); else @@ -281,6 +279,16 @@ void getgenericconfig(struct gconffile **cf, char *block, ...) { (*mstr)[n] = stringcopy(val, 0); (*mstr)[n + 1] = NULL; break; + case CONF_BLN: + if (!strcasecmp(val, "on")) + *bln = 1; + else if (!strcasecmp(val, "off")) + *bln = 0; + else if (block) + debugx(1, DBG_ERR, "configuration error in block %s, value for option %s must be on or off, not %s", block, opt, val); + else + debugx(1, DBG_ERR, "configuration error, value for option %s must be on or off, not %s", opt, val); + break; case CONF_CBK: optval = malloc(strlen(opt) + strlen(val) + 2); if (!optval) @@ -288,9 +296,13 @@ void getgenericconfig(struct gconffile **cf, char *block, ...) { sprintf(optval, "%s %s", opt, val); cbk(cf, optval, opt, val); free(optval); - break; + continue; default: debugx(1, DBG_ERR, "getgenericconfig: internal parameter error"); } + if (block) + debug(DBG_DBG, "getgenericconfig: block %s: %s = %s", block, opt, val); + else + debug(DBG_DBG, "getgenericconfig: %s = %s", opt, val); } } -- cgit v1.1