summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-09-30 11:47:41 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-09-30 11:47:41 +0000
commit9059151dbb4dbda7f7d4f1a96a7d0b8db5756a0a (patch)
tree1b4130039f3fd14d2b0cc2243e9078213e690834 /radsecproxy.c
parent0ab8340b61978691f06543a273f53269cb7c3d2f (diff)
improved findserver a bit
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@411 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index e140a38..533bf90 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -1704,22 +1704,20 @@ struct clsrvconf *choosesrvconf(struct list *srvconfs) {
struct server *findserver(struct realm **realm, struct tlv *username, uint8_t acc) {
struct clsrvconf *srvconf;
struct realm *subrealm;
+ struct server *server = NULL;
char *id = (char *)tlv2str(username);
if (!id)
return NULL;
/* returns with lock on realm */
*realm = id2realm(realms, id);
- if (!*realm) {
- free(id);
- return NULL;
- }
+ if (!*realm)
+ goto exit;
debug(DBG_DBG, "found matching realm: %s", (*realm)->name);
srvconf = choosesrvconf(acc ? (*realm)->accsrvconfs : (*realm)->srvconfs);
- if (!srvconf) {
- free(id);
- return NULL;
- }
+ if (!srvconf)
+ goto exit;
+ server = srvconf->servers;
if (!acc && !(*realm)->parent && !srvconf->servers) {
subrealm = adddynamicrealmserver(*realm, srvconf, id);
if (subrealm) {
@@ -1727,10 +1725,12 @@ struct server *findserver(struct realm **realm, struct tlv *username, uint8_t ac
pthread_mutex_unlock(&(*realm)->mutex);
freerealm(*realm);
*realm = subrealm;
+ server = ((struct clsrvconf *)subrealm->srvconfs->first->data)->servers;
}
}
+ exit:
free(id);
- return srvconf->servers;
+ return server;
}