From 3f6b6b2b4e0441d2c58bf285478cdee78bea4f05 Mon Sep 17 00:00:00 2001 From: venaas Date: Wed, 4 Jun 2008 07:11:51 +0000 Subject: fixed segfault in findserver() when no server configured, and tried to remove a warning git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@279 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- radsecproxy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'radsecproxy.c') diff --git a/radsecproxy.c b/radsecproxy.c index b6a278d..734165a 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -1879,6 +1879,8 @@ struct server *findserver(struct realm **realm, char *id, uint8_t acc) { return NULL; debug(DBG_DBG, "found matching realm: %s", (*realm)->name); srvconf = choosesrvconf(acc ? (*realm)->accsrvconfs : (*realm)->srvconfs); + if (!srvconf) + return NULL; if (!acc && !srvconf->servers) adddynamicrealmserver(*realm, srvconf, id); return srvconf->servers; @@ -2886,7 +2888,7 @@ void adddynamicrealmserver(struct realm *realm, struct clsrvconf *conf, char *id if (!*realmname) return; for (s = realmname; *s; s++) - if (*s != '.' && *s != '-' && !isalnum(*s)) + if (*s != '.' && *s != '-' && !isalnum((int)*s)) return; pthread_mutex_lock(&realm->subrealms_mutex); -- cgit v1.2.3