diff options
author | Linus Nordberg <linus@nordu.net> | 2012-04-25 17:41:27 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2012-04-25 17:41:27 +0200 |
commit | 19b5ce7ac3f838e689ae6e6b1e4a0c114b44ce67 (patch) | |
tree | 8b1cf80d30846833111d1e6733a8031408fb2321 /lib/radsec.c | |
parent | 41ca60fee8c14f74af22bbeeda56574e883c21a9 (diff) |
Postpone resolving of DNS names of server.
We used to resolve DNS names when reading configuration. We now do it
in event_init_socket() and cache the result in the connection object.
The imminent need for changing this is to keep host names around for
X509 certificate verification (CNAME and subjectAltName). This will
also help later when we implement server failover (and later, when
people want to do more dynamic configuration, f.ex. NAPTR).
Diffstat (limited to 'lib/radsec.c')
-rw-r--r-- | lib/radsec.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/radsec.c b/lib/radsec.c index 53b5942..e176b6d 100644 --- a/lib/radsec.c +++ b/lib/radsec.c @@ -97,10 +97,10 @@ rs_context_init_freeradius_dict (struct rs_context *ctx, const char *dict) } struct rs_error * -rs_resolv (struct evutil_addrinfo **addr, - rs_conn_type_t type, - const char *hostname, - const char *service) +rs_resolve (struct evutil_addrinfo **addr, + rs_conn_type_t type, + const char *hostname, + const char *service) { int err; struct evutil_addrinfo hints, *res = NULL; @@ -150,8 +150,11 @@ rs_context_destroy (struct rs_context *ctx) for (p = r->peers; p; ) { struct rs_peer *tmp = p; - if (p->addr) - evutil_freeaddrinfo (p->addr); + if (p->addr_cache) + { + evutil_freeaddrinfo (p->addr_cache); + p->addr_cache = NULL; + } p = p->next; rs_free (ctx, tmp); } |