Commit Diff
Diff:
fb19b05e1e3d638062dcfc4c263b02e7429c4d20
125c05fba0315da143c3431a41bd930fcb992501
Commit:
125c05fba0315da143c3431a41bd930fcb992501
Tree:
da710ad800de989d5db396a1bca0ef3dfb4db782
Author:
Florian Westphal <fw@strlen.de>
Committer:
Florian Westphal <fw@strlen.de>
Date:
Wed Oct 29 22:51:39 2008 UTC
Message:
conn-ssl.c: work around gnutls API problems on 64 bit platforms Alexander Barton reported a compiler warning on 64-bit platforms: cc1: warnings being treated as errors conn-ssl.c: In function 'ConnSSL_Init_SSL': conn-ssl.c:403: error: cast to pointer from integer of different size Unfortunately, I couldn't find a real solution; the GNUTLS API expects 'gnutls_transport_ptr_t' (which is void*), but the default push/pull functions (send/recv) expect an int. The only alternative solution is to pass in an address to the file descriptor, then add send/recv wrappers that expect a pointer. What a mess[tm].
blob - 5a1000728a7b604753736c0be3f0f98cc02584fc
blob + cd7abd4bd38dcf79d688e448a9acecb98234dad5
--- src/ngircd/conn-ssl.c
+++ src/ngircd/conn-ssl.c
@@ -400,7 +400,13 @@ ConnSSL_Init_SSL(CONNECTION *c)
Log(LOG_ERR, "gnutls_set_default_priority: %s", gnutls_strerror(ret));
ConnSSL_Free(c);
}
- gnutls_transport_set_ptr(c->ssl_state.gnutls_session, (gnutls_transport_ptr_t) c->sock);
+ /*
+ * The intermediate (long) cast is here to avoid a warning like:
+ * "cast to pointer from integer of different size" on 64-bit platforms.
+ * There doesn't seem to be an alternate GNUTLS API we could use instead, see e.g.
+ * http://www.mail-archive.com/help-gnutls@gnu.org/msg00286.html
+ */
+ gnutls_transport_set_ptr(c->ssl_state.gnutls_session, (gnutls_transport_ptr_t) (long) c->sock);
ret = gnutls_credentials_set(c->ssl_state.gnutls_session, GNUTLS_CRD_CERTIFICATE, x509_cred);
if (ret < 0) {
Log(LOG_ERR, "gnutls_credentials_set: %s", gnutls_strerror(ret));
IRCNow