Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Commit

Permalink
initialize hostheader
Browse files Browse the repository at this point in the history
	addresses #381
  • Loading branch information
jpmens committed Nov 27, 2018
1 parent b1c09eb commit 4f67cfb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions be-jwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ void *be_jwt_init()
}
conf = (struct jwt_backend *)malloc(sizeof(struct jwt_backend));
conf->ip = ip;
conf->hostname = NULL;
conf->hostheader = NULL;
conf->port = p_stab("http_port") == NULL ? 80 : atoi(p_stab("http_port"));
if (p_stab("http_hostname") != NULL) {
conf->hostheader = (char *)malloc(128);
conf->hostname = p_stab("http_hostname");
sprintf(conf->hostheader, "Host: %s", p_stab("http_hostname"));
} else {
conf->hostheader = NULL;
}
conf->getuser_uri = getuser_uri;
conf->superuser_uri = superuser_uri;
Expand Down Expand Up @@ -279,6 +279,8 @@ void be_jwt_destroy(void *handle)
struct jwt_backend *conf = (struct jwt_backend *)handle;

if (conf) {
if (conf->hostname) free(conf->hostname);
if (conf->hostheader) free(conf->hostheader);
curl_global_cleanup();
free(conf);
}
Expand Down

0 comments on commit 4f67cfb

Please sign in to comment.