1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4:tls: Do not use deprecated GnuTLS types

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>
This commit is contained in:
Andreas Schneider 2017-05-09 13:17:13 +02:00 committed by Jeremy Allison
parent cb17fcc5f5
commit 85e3d1774c
2 changed files with 16 additions and 14 deletions

View 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

View 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,