diff options
author | venaas <venaas> | 2008-12-19 11:18:42 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2008-12-19 11:18:42 +0000 |
commit | 8d80bf94fc38a158f3721e6725aa48b3993e157a (patch) | |
tree | 7723a6493b616ed18d19804c2dc526527357394f /tls.c | |
parent | 3c779c1093a5cb6314bc366c6135fb2eaac8cdeb (diff) |
cleaning up code
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@442 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'tls.c')
-rw-r--r-- | tls.c | 43 |
1 files changed, 37 insertions, 6 deletions
@@ -30,13 +30,44 @@ #include "list.h" #include "util.h" #include "radsecproxy.h" -#include "tls.h" + +void *tlslistener(void *arg); +int tlsconnect(struct server *server, struct timeval *when, int timeout, char *text); +void *tlsclientrd(void *arg); +int clientradputtls(struct server *server, unsigned char *rad); +void tlssetsrcres(char *source); + +static const struct protodefs protodefs = { + "tls", + "mysecret", /* secretdefault */ + SOCK_STREAM, /* socktype */ + "2083", /* portdefault */ + 0, /* retrycountdefault */ + 0, /* retrycountmax */ + REQUEST_RETRY_INTERVAL * REQUEST_RETRY_COUNT, /* retryintervaldefault */ + 60, /* retryintervalmax */ + DUPLICATE_INTERVAL, /* duplicateintervaldefault */ + tlslistener, /* listener */ + tlsconnect, /* connecter */ + tlsclientrd, /* clientconnreader */ + clientradputtls, /* clientradput */ + NULL, /* addclient */ + NULL, /* addserverextra */ + tlssetsrcres, /* setsrcres */ + NULL /* initextra */ +}; static struct addrinfo *srcres = NULL; +static uint8_t handle; + +const struct protodefs *tlsinit(uint8_t h) { + handle = h; + return &protodefs; +} void tlssetsrcres(char *source) { if (!srcres) - srcres = resolve_hostport_addrinfo(RAD_TLS, source); + srcres = resolve_hostport_addrinfo(handle, source); } int tlsconnect(struct server *server, struct timeval *when, int timeout, char *text) { @@ -90,7 +121,7 @@ int tlsconnect(struct server *server, struct timeval *when, int timeout, char *t SSL_free(server->ssl); server->ssl = NULL; - ctx = tlsgetctx(RAD_TLS, server->conf->tlsconf); + ctx = tlsgetctx(handle, server->conf->tlsconf); if (!ctx) continue; server->ssl = SSL_new(ctx); @@ -347,9 +378,9 @@ void *tlsservernew(void *arg) { } debug(DBG_WARN, "tlsservernew: incoming TLS connection from %s", addr2string((struct sockaddr *)&from)); - conf = find_clconf(RAD_TLS, (struct sockaddr *)&from, &cur); + conf = find_clconf(handle, (struct sockaddr *)&from, &cur); if (conf) { - ctx = tlsgetctx(RAD_TLS, conf->tlsconf); + ctx = tlsgetctx(handle, conf->tlsconf); if (!ctx) goto exit; ssl = SSL_new(ctx); @@ -381,7 +412,7 @@ void *tlsservernew(void *arg) { debug(DBG_WARN, "tlsservernew: failed to create new client instance"); goto exit; } - conf = find_clconf(RAD_TLS, (struct sockaddr *)&from, &cur); + conf = find_clconf(handle, (struct sockaddr *)&from, &cur); } debug(DBG_WARN, "tlsservernew: ignoring request, no matching TLS client"); if (cert) |