Skip to content

Commit

Permalink
proposed fix for RADSECPROXY-71
Browse files Browse the repository at this point in the history
never set clsrvconf->servers=null after it has been properly set up.
set servers->dynfailing=1 instead

Conflicts:
	radsecproxy.c
  • Loading branch information
Fabian Mauchle committed Aug 6, 2017
1 parent 7dcefed commit 14cac40
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions radsecproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,7 @@ void *clientwr(void *arg) {
* dynamicconfig() above? */
if (!resolvehostports(conf->hostports, conf->hostaf, conf->pdef->socktype)) {
debug(DBG_WARN, "%s: resolve failed, sleeping %ds", __func__, ZZZ);
server->dynfailing=1;
sleep(ZZZ);
goto errexit;
}
Expand All @@ -1780,9 +1781,9 @@ void *clientwr(void *arg) {

if (conf->pdef->connecter) {
if (!conf->pdef->connecter(server, NULL, server->dynamiclookuparg ? 5 : 0, "clientwr")) {
server->dynfailing = 1;
if (server->dynamiclookuparg) {
server->dynstartup = 0;
server->dynfailing = 1;
debug(DBG_WARN, "%s: connect failed, sleeping %ds",
__func__, ZZZ);
sleep(ZZZ);
Expand All @@ -1792,6 +1793,7 @@ void *clientwr(void *arg) {
server->connectionok = 1;
if (pthread_create(&clientrdth, &pthread_attr, conf->pdef->clientconnreader, (void *)server)) {
debugerrno(errno, DBG_ERR, "clientwr: pthread_create failed");
server->dynfailing=1;
goto errexit;
}
} else
Expand Down Expand Up @@ -1834,6 +1836,7 @@ void *clientwr(void *arg) {

for (i = 0; i < MAX_REQUESTS; i++) {
if (server->clientrdgone) {
server->dynfailing=1;
if (conf->pdef->connecter)
pthread_join(clientrdth, NULL);
goto errexit;
Expand Down Expand Up @@ -1906,8 +1909,6 @@ void *clientwr(void *arg) {
free(conf);
else
freeclsrvconf(conf);
} else {
conf->servers = NULL;
}
freeserver(server, 1);
return NULL;
Expand Down

0 comments on commit 14cac40

Please sign in to comment.