s4:tls: Do not use deprecated GnuTLS types
authorAndreas Schneider <asn@samba.org>
Tue, 9 May 2017 11:17:13 +0000 (13:17 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 9 May 2017 21:20:08 +0000 (23:20 +0200)
Those have been deprecated with GnuTLS 1.0.20 in 2004. I think it is
safe to use them now ;)

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/lib/tls/tls.c
source4/lib/tls/tls_tstream.c

index ad8bbd444a420a96e4eef3e2209b5d3fac664abd..ac4df221999f457321f985dc36de05dd6be81f21 100644 (file)
@@ -39,8 +39,8 @@ typedef gnutls_datum gnutls_datum_t;
 
 /* hold persistent tls data */
 struct tls_params {
-       gnutls_certificate_credentials x509_cred;
-       gnutls_dh_params dh_params;
+       gnutls_certificate_credentials_t x509_cred;
+       gnutls_dh_params_t dh_params;
        bool tls_enabled;
        const char *tls_priority;
 };
@@ -52,14 +52,14 @@ struct tls_context {
        struct tevent_fd *fde;
        bool tls_enabled;
 #if ENABLE_GNUTLS
-       gnutls_session session;
+       gnutls_session_t session;
        bool done_handshake;
        bool have_first_byte;
        uint8_t first_byte;
        bool tls_detect;
        const char *plain_chars;
        bool output_pending;
-       gnutls_certificate_credentials xcred;
+       gnutls_certificate_credentials_t xcred;
        bool interrupted;
 #endif
 };
@@ -111,7 +111,7 @@ static NTSTATUS tls_socket_init(struct socket_context *sock)
 /*
   callback for reading from a socket
 */
-static ssize_t tls_pull(gnutls_transport_ptr ptr, void *buf, size_t size)
+static ssize_t tls_pull(gnutls_transport_ptr_t ptr, void *buf, size_t size)
 {
        struct tls_context *tls = talloc_get_type(ptr, struct tls_context);
        NTSTATUS status;
@@ -150,7 +150,7 @@ static ssize_t tls_pull(gnutls_transport_ptr ptr, void *buf, size_t size)
 /*
   callback for writing to a socket
 */
-static ssize_t tls_push(gnutls_transport_ptr ptr, const void *buf, size_t size)
+static ssize_t tls_push(gnutls_transport_ptr_t ptr, const void *buf, size_t size)
 {
        struct tls_context *tls = talloc_get_type(ptr, struct tls_context);
        NTSTATUS status;
@@ -545,7 +545,7 @@ struct socket_context *tls_init_server(struct tls_params *params,
                                        params->x509_cred));
        gnutls_certificate_server_set_request(tls->session, GNUTLS_CERT_REQUEST);
        gnutls_dh_set_prime_bits(tls->session, DH_BITS);
-       gnutls_transport_set_ptr(tls->session, (gnutls_transport_ptr)tls);
+       gnutls_transport_set_ptr(tls->session, (gnutls_transport_ptr_t)tls);
        gnutls_transport_set_pull_function(tls->session, (gnutls_pull_func)tls_pull);
        gnutls_transport_set_push_function(tls->session, (gnutls_push_func)tls_push);
 #if GNUTLS_VERSION_MAJOR < 3
index 28fe3328b124ba5844377497bb50532e45880852..94689718d6364bc3a448411bb8b326216dafb060 100644 (file)
@@ -85,7 +85,7 @@ struct tstream_tls {
        int error;
 
 #if ENABLE_GNUTLS
-       gnutls_session tls_session;
+       gnutls_session_t tls_session;
 #endif /* ENABLE_GNUTLS */
 
        enum tls_verify_peer_state verify_peer;
@@ -190,7 +190,7 @@ static void tstream_tls_push_trigger_write(struct tevent_context *ev,
                                           struct tevent_immediate *im,
                                           void *private_data);
 
-static ssize_t tstream_tls_push_function(gnutls_transport_ptr ptr,
+static ssize_t tstream_tls_push_function(gnutls_transport_ptr_t ptr,
                                         const void *buf, size_t size)
 {
        struct tstream_context *stream =
@@ -329,7 +329,7 @@ static void tstream_tls_push_done(struct tevent_req *subreq)
 
 static void tstream_tls_pull_done(struct tevent_req *subreq);
 
-static ssize_t tstream_tls_pull_function(gnutls_transport_ptr ptr,
+static ssize_t tstream_tls_pull_function(gnutls_transport_ptr_t ptr,
                                         void *buf, size_t size)
 {
        struct tstream_context *stream =
@@ -911,8 +911,8 @@ static const struct tstream_context_ops tstream_tls_ops = {
 
 struct tstream_tls_params {
 #if ENABLE_GNUTLS
-       gnutls_certificate_credentials x509_cred;
-       gnutls_dh_params dh_params;
+       gnutls_certificate_credentials_t x509_cred;
+       gnutls_dh_params_t dh_params;
        const char *tls_priority;
 #endif /* ENABLE_GNUTLS */
        bool tls_enabled;
@@ -1115,7 +1115,8 @@ struct tevent_req *_tstream_tls_connect_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       gnutls_transport_set_ptr(tlss->tls_session, (gnutls_transport_ptr)state->tls_stream);
+       gnutls_transport_set_ptr(tlss->tls_session,
+                                (gnutls_transport_ptr_t)state->tls_stream);
        gnutls_transport_set_pull_function(tlss->tls_session,
                                           (gnutls_pull_func)tstream_tls_pull_function);
        gnutls_transport_set_push_function(tlss->tls_session,
@@ -1390,7 +1391,8 @@ struct tevent_req *_tstream_tls_accept_send(TALLOC_CTX *mem_ctx,
                                              GNUTLS_CERT_REQUEST);
        gnutls_dh_set_prime_bits(tlss->tls_session, DH_BITS);
 
-       gnutls_transport_set_ptr(tlss->tls_session, (gnutls_transport_ptr)state->tls_stream);
+       gnutls_transport_set_ptr(tlss->tls_session,
+                                (gnutls_transport_ptr_t)state->tls_stream);
        gnutls_transport_set_pull_function(tlss->tls_session,
                                           (gnutls_pull_func)tstream_tls_pull_function);
        gnutls_transport_set_push_function(tlss->tls_session,