diff options
author | Attila Molnar <attilamolnar@hush.com> | 2013-09-24 18:50:59 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-01-22 19:10:01 +0100 |
commit | b68a5ad0309e49671d4c6db19384c1f82831419e (patch) | |
tree | 94bf062b81058f9887826ba6d819219380917c1c /src/modules | |
parent | e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804 (diff) |
m_ssl_gnutls Create GNUTLS_NEW_CERT_CALLBACK_API and cert_cb_last_param_type
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 0e0dc64b4..9f8e740b3 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -72,24 +72,14 @@ enum issl_status { ISSL_NONE, ISSL_HANDSHAKING_READ, ISSL_HANDSHAKING_WRITE, ISS static std::vector<gnutls_x509_crt_t> x509_certs; static gnutls_x509_privkey_t x509_key; -#if(GNUTLS_VERSION_MAJOR < 2 || ( GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR < 12 ) ) -static int cert_callback (gnutls_session_t session, const gnutls_datum_t * req_ca_rdn, int nreqs, - const gnutls_pk_algorithm_t * sign_algos, int sign_algos_length, gnutls_retr_st * st) { - - st->type = GNUTLS_CRT_X509; +#if (GNUTLS_VERSION_MAJOR > 2 || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR >= 12)) +#define GNUTLS_NEW_CERT_CALLBACK_API +typedef gnutls_retr2_st cert_cb_last_param_type; #else -static int cert_callback (gnutls_session_t session, const gnutls_datum_t * req_ca_rdn, int nreqs, - const gnutls_pk_algorithm_t * sign_algos, int sign_algos_length, gnutls_retr2_st * st) { - st->cert_type = GNUTLS_CRT_X509; - st->key_type = GNUTLS_PRIVKEY_X509; +typedef gnutls_retr_st cert_cb_last_param_type; #endif - st->ncerts = x509_certs.size(); - st->cert.x509 = &x509_certs[0]; - st->key.x509 = x509_key; - st->deinit_all = 0; - return 0; -} +static int cert_callback(gnutls_session_t session, const gnutls_datum_t* req_ca_rdn, int nreqs, const gnutls_pk_algorithm_t* sign_algos, int sign_algos_length, cert_cb_last_param_type* st); class RandGen : public HandlerBase2<void, char*, size_t> { @@ -548,6 +538,22 @@ info_done_dealloc: } }; +static int cert_callback(gnutls_session_t sess, const gnutls_datum_t* req_ca_rdn, int nreqs, const gnutls_pk_algorithm_t* sign_algos, int sign_algos_length, cert_cb_last_param_type* st) +{ +#ifndef GNUTLS_NEW_CERT_CALLBACK_API + st->type = GNUTLS_CRT_X509; +#else + st->cert_type = GNUTLS_CRT_X509; + st->key_type = GNUTLS_PRIVKEY_X509; +#endif + st->ncerts = x509_certs.size(); + st->cert.x509 = &x509_certs[0]; + st->key.x509 = x509_key; + st->deinit_all = 0; + + return 0; +} + class ModuleSSLGnuTLS : public Module { GnuTLSIOHook iohook; |