From 1cd3b52daedeb5e773c7256eff2b9770fa0e121e Mon Sep 17 00:00:00 2001 From: David Weber Date: Fri, 14 Nov 2014 14:49:24 +0200 Subject: Fixed SRTP profile configuration in cli.c and serv.c. I have tested the fix in 3.3.10. This commit is UNTESTED as i am unable to compile gnutls (./configure complains about gl_INIT and ggl_INIT). Signed-off-by: Nikos Mavrogiannopoulos --- src/cli.c | 28 ++++++++++++++++------------ src/serv.c | 28 ++++++++++++++++------------ 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/cli.c b/src/cli.c index 867c646fcb..a33ae21635 100644 --- a/src/cli.c +++ b/src/cli.c @@ -687,20 +687,24 @@ static gnutls_session_t init_tls_session(const char *hostname) GNUTLS_HB_PEER_ALLOWED_TO_SEND); #ifdef ENABLE_DTLS_SRTP - if (HAVE_OPT(SRTP_PROFILES)) { - ret = - gnutls_srtp_set_profile_direct(session, - OPT_ARG(SRTP_PROFILES), - &err); - if (ret == GNUTLS_E_INVALID_REQUEST) - fprintf(stderr, "Syntax error at: %s\n", err); - else - fprintf(stderr, "Error in profiles: %s\n", - gnutls_strerror(ret)); - exit(1); - } + if (HAVE_OPT(SRTP_PROFILES)) { + ret = + gnutls_srtp_set_profile_direct(session, + OPT_ARG(SRTP_PROFILES), + &err); + if (ret == GNUTLS_E_INVALID_REQUEST) + fprintf(stderr, "Syntax error at: %s\n", err); + else if (ret != 0) + fprintf(stderr, "Error in profiles: %s\n", + gnutls_strerror(ret)); + else fprintf(stderr,"DTLS profile set to %s\n", + OPT_ARG(SRTP_PROFILES)); + + if (ret != 0) exit(1); + } #endif + return session; } diff --git a/src/serv.c b/src/serv.c index 74dd1af2a9..a1f9adfa8e 100644 --- a/src/serv.c +++ b/src/serv.c @@ -381,20 +381,24 @@ gnutls_session_t initialize_session(int dtls) GNUTLS_HB_PEER_ALLOWED_TO_SEND); #ifdef ENABLE_DTLS_SRTP - if (HAVE_OPT(SRTP_PROFILES)) { - ret = - gnutls_srtp_set_profile_direct(session, - OPT_ARG(SRTP_PROFILES), - &err); - if (ret == GNUTLS_E_INVALID_REQUEST) - fprintf(stderr, "Syntax error at: %s\n", err); - else - fprintf(stderr, "Error in profiles: %s\n", - gnutls_strerror(ret)); - exit(1); - } + if (HAVE_OPT(SRTP_PROFILES)) { + ret = + gnutls_srtp_set_profile_direct(session, + OPT_ARG(SRTP_PROFILES), + &err); + if (ret == GNUTLS_E_INVALID_REQUEST) + fprintf(stderr, "Syntax error at: %s\n", err); + else if (ret != 0) + fprintf(stderr, "Error in profiles: %s\n", + gnutls_strerror(ret)); + else fprintf(stderr,"DTLS profile set to %s\n", + OPT_ARG(SRTP_PROFILES)); + + if (ret != 0) exit(1); + } #endif + return session; } -- cgit v1.2.1