From: Alexander Traud Date: Mon, 28 May 2018 15:29:23 +0000 (+0200) Subject: tcptls.h: Repair ./configure --with-ssl=PATH. X-Git-Tag: 15.5.0-rc1~50^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60242e14181b0d731307126d34f94bf1d311ecb8;p=thirdparty%2Fasterisk.git tcptls.h: Repair ./configure --with-ssl=PATH. asterisk/tcptls.h was included (explicitly, implicitly, or transitively). Those inclusions got replaced by forward declarations. As side effect, the inclusions got completed. ASTERISK-27878 Change-Id: I9d102728e30336d6522e5e4ae9e964013a0835f7 --- diff --git a/include/asterisk/iostream.h b/include/asterisk/iostream.h index b4cdeb2dc0..17376eae1e 100644 --- a/include/asterisk/iostream.h +++ b/include/asterisk/iostream.h @@ -25,21 +25,19 @@ * \brief Generic abstraction for input/output streams. */ +#include "asterisk.h" /* for size_t, ssize_t, HAVE_OPENSSL */ + #if defined(HAVE_OPENSSL) #define DO_SSL /* comment in/out if you want to support ssl */ #endif -#ifdef DO_SSL -#include -#include -#include -#else -/* declare dummy types so we can define a pointer to them */ -typedef struct {} SSL; -typedef struct {} SSL_CTX; -#endif /* DO_SSL */ +struct ssl_st; /* forward declaration */ +struct ssl_ctx_st; /* forward declaration */ +struct timeval; /* forward declaration */ +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; -struct ast_iostream; +struct ast_iostream; /* forward declaration */ /*! * \brief Disable the iostream timeout timer. diff --git a/include/asterisk/tcptls.h b/include/asterisk/tcptls.h index 9cf9fd6b27..0a6e25e45b 100644 --- a/include/asterisk/tcptls.h +++ b/include/asterisk/tcptls.h @@ -46,18 +46,20 @@ * be run earlier in the startup process so modules have it available. * * \ref AstTlsOverview - * - * \todo For SIP, the SubjectAltNames should be checked on verification - * of the certificate. (Check RFC 5922) - * */ #ifndef _ASTERISK_TCPTLS_H #define _ASTERISK_TCPTLS_H -#include "asterisk/netsock2.h" -#include "asterisk/utils.h" +#include /* for pthread_t */ +#include /* for MAXHOSTNAMELEN */ + #include "asterisk/iostream.h" +#include "asterisk/netsock2.h" /* for ast_sockaddr */ +#include "asterisk/utils.h" /* for ast_flags */ + +struct ssl_ctx_st; /* forward declaration */ +typedef struct ssl_ctx_st SSL_CTX; /*! SSL support */ #define AST_CERTFILE "asterisk.pem" diff --git a/main/Makefile b/main/Makefile index fad5ee6f5d..37f9e331fd 100644 --- a/main/Makefile +++ b/main/Makefile @@ -309,6 +309,7 @@ endif endif +iostream.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE) tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE) -Wno-deprecated-declarations $(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) $(ASTPJ_LIB) $(LIBEDIT_OBJ) diff --git a/main/iostream.c b/main/iostream.c index 4cddd43b6b..58c7f1e13b 100644 --- a/main/iostream.c +++ b/main/iostream.c @@ -18,12 +18,23 @@ #include "asterisk.h" -#include -#include +#include "asterisk/iostream.h" /* for DO_SSL */ -#include "asterisk/utils.h" -#include "asterisk/astobj2.h" -#include "asterisk/iostream.h" +#include /* for O_NONBLOCK */ +#ifdef DO_SSL +#include /* for ERR_error_string */ +#include /* for OPENSSL_VERSION_NUMBER */ +#include /* for SSL_get_error, SSL_free, SSL_... */ +#endif +#include /* for shutdown, SHUT_RDWR */ +#include /* for timeval */ + +#include "asterisk/astobj2.h" /* for ao2_alloc_options, ao2_alloc_... */ +#include "asterisk/logger.h" /* for ast_debug, ast_log, LOG_ERROR */ +#include "asterisk/strings.h" /* for asterisk/threadstorage.h */ +#include "asterisk/threadstorage.h" /* for ast_threadstorage_get, AST_TH... */ +#include "asterisk/time.h" /* for ast_remaining_ms, ast_tvnow */ +#include "asterisk/utils.h" /* for ast_wait_for_input, ast_wait_... */ struct ast_iostream { SSL *ssl; diff --git a/main/tcptls.c b/main/tcptls.c index 8ffeabb69b..8507391571 100644 --- a/main/tcptls.c +++ b/main/tcptls.c @@ -25,31 +25,48 @@ * \author Brett Bryant */ -/*** MODULEINFO - openssl - core - ***/ - #include "asterisk.h" -#ifdef HAVE_FCNTL_H -#include -#endif +#include "asterisk/tcptls.h" /* for ast_tls_config, ast_tcptls_se... */ +#include "asterisk/iostream.h" /* for DO_SSL, ast_iostream_close, a... */ -#include -#include - -#include "asterisk/compat.h" -#include "asterisk/tcptls.h" -#include "asterisk/io.h" -#include "asterisk/http.h" -#include "asterisk/utils.h" -#include "asterisk/strings.h" -#include "asterisk/options.h" -#include "asterisk/manager.h" -#include "asterisk/astobj2.h" -#include "asterisk/pbx.h" -#include "asterisk/app.h" +#ifdef HAVE_FCNTL_H +#include /* for O_NONBLOCK */ +#endif /* HAVE_FCNTL_H */ +#include /* for IPPROTO_TCP */ +#ifdef DO_SSL +#include /* for ASN1_STRING_to_UTF8 */ +#include /* for OPENSSL_free */ +#include /* for OPENSSL_NO_SSL3_METHOD, OPENS... */ +#include /* for OPENSSL_VERSION_NUMBER */ +#include /* for STACK_OF */ +#include /* for SSL_CTX_free, SSL_get_error, ... */ +#include /* for X509_free, X509_NAME_ENTRY_ge... */ +#include /* for GENERAL_NAME, sk_GENERAL_NAME... */ +#ifndef OPENSSL_NO_DH +#include /* for BIO_free, BIO_new_file */ +#include /* for DH_free */ +#include /* for PEM_read_bio_DHparams */ +#endif /* OPENSSL_NO_DH */ +#ifndef OPENSSL_NO_EC +#include /* for EC_KEY_free, EC_KEY_new_by_cu... */ +#endif /* OPENSSL_NO_EC */ +#endif /* DO_SSL */ +#include /* for pthread_cancel, pthread_join */ +#include /* for pthread_kill, SIGURG */ +#include /* for setsockopt, shutdown, socket */ +#include /* for stat */ + +#include "asterisk/app.h" /* for ast_read_textfile */ +#include "asterisk/astobj2.h" /* for ao2_ref, ao2_t_ref, ao2_alloc */ +#include "asterisk/compat.h" /* for strcasecmp */ +#include "asterisk/config.h" /* for ast_parse_arg, ast_parse_flag... */ +#include "asterisk/io.h" /* for ast_sd_get_fd */ +#include "asterisk/lock.h" /* for AST_PTHREADT_NULL */ +#include "asterisk/logger.h" /* for ast_log, LOG_ERROR, ast_debug */ +#include "asterisk/netsock2.h" /* for ast_sockaddr_copy, ast_sockad... */ +#include "asterisk/pbx.h" /* for ast_thread_inhibit_escalations */ +#include "asterisk/utils.h" /* for ast_true, ast_free, ast_wait_... */ static void session_instance_destructor(void *obj) {