[Asterisk-code-review] res_pjsip/config_transport: Load and run without OpenSSL. (asterisk[18])
Friendly Automation
asteriskteam at digium.com
Mon Nov 9 08:50:55 CST 2020
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15117 )
Change subject: res_pjsip/config_transport: Load and run without OpenSSL.
......................................................................
res_pjsip/config_transport: Load and run without OpenSSL.
ASTERISK-28933
Reported-by: Walter Doekes
Change-Id: I65eac49e5b0a79261ea80e2b9b38a836886ed59f
---
M res/res_pjsip/config_transport.c
1 file changed, 18 insertions(+), 0 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c
index ac2405b..0cf118e 100644
--- a/res/res_pjsip/config_transport.c
+++ b/res/res_pjsip/config_transport.c
@@ -799,6 +799,7 @@
res = pjsip_tcp_transport_start3(ast_sip_get_pjsip_endpoint(), &cfg,
&temp_state->state->factory);
}
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
} else if (transport->type == AST_TRANSPORT_TLS) {
static int option = 1;
@@ -829,6 +830,7 @@
&temp_state->state->host, NULL, transport->async_operations,
&temp_state->state->factory);
}
+#endif
} else if ((transport->type == AST_TRANSPORT_WS) || (transport->type == AST_TRANSPORT_WSS)) {
if (transport->cos || transport->tos) {
ast_log(LOG_WARNING, "TOS and COS values ignored for websocket transport\n");
@@ -1166,6 +1168,7 @@
}
/*! \brief Helper function which turns a cipher name into an identifier */
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
static pj_ssl_cipher cipher_name_to_id(const char *name)
{
pj_ssl_cipher ciphers[PJ_SSL_SOCK_MAX_CIPHERS];
@@ -1185,6 +1188,7 @@
return 0;
}
+#endif
/*!
* \internal
@@ -1196,6 +1200,7 @@
* \retval 0 on success.
* \retval -1 on error.
*/
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
static int transport_cipher_add(struct ast_sip_transport_state *state, const char *name)
{
pj_ssl_cipher cipher;
@@ -1226,8 +1231,10 @@
return -1;
}
}
+#endif
/*! \brief Custom handler for TLS cipher setting */
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
static int transport_tls_cipher_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct ast_sip_transport *transport = obj;
@@ -1254,7 +1261,9 @@
}
return res ? -1 : 0;
}
+#endif
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
static void cipher_to_str(char **buf, const pj_ssl_cipher *ciphers, unsigned int cipher_num)
{
struct ast_str *str;
@@ -1276,7 +1285,9 @@
*buf = ast_strdup(ast_str_buffer(str));
ast_free(str);
}
+#endif
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
static int transport_tls_cipher_to_str(const void *obj, const intptr_t *args, char **buf)
{
const struct ast_sip_transport *transport = obj;
@@ -1289,7 +1300,9 @@
cipher_to_str(buf, state->ciphers, state->tls.ciphers_num);
return *buf ? 0 : -1;
}
+#endif
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
static char *handle_pjsip_list_ciphers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
pj_ssl_cipher ciphers[PJ_SSL_SOCK_MAX_CIPHERS];
@@ -1320,6 +1333,7 @@
ast_free(buf);
return CLI_SUCCESS;
}
+#endif
/*! \brief Custom handler for localnet setting */
static int transport_localnet_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
@@ -1519,7 +1533,9 @@
}
static struct ast_cli_entry cli_commands[] = {
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
AST_CLI_DEFINE(handle_pjsip_list_ciphers, "List available OpenSSL cipher names"),
+#endif
AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Transports",
.command = "pjsip list transports",
.usage = "Usage: pjsip list transports [ like <pattern> ]\n"
@@ -1631,7 +1647,9 @@
ast_sorcery_object_field_register_custom(sorcery, "transport", "verify_client", "", transport_tls_bool_handler, verify_client_to_str, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sorcery, "transport", "require_client_cert", "", transport_tls_bool_handler, require_client_cert_to_str, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sorcery, "transport", "method", "", transport_tls_method_handler, tls_method_to_str, NULL, 0, 0);
+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
ast_sorcery_object_field_register_custom(sorcery, "transport", "cipher", "", transport_tls_cipher_handler, transport_tls_cipher_to_str, NULL, 0, 0);
+#endif
ast_sorcery_object_field_register_custom(sorcery, "transport", "local_net", "", transport_localnet_handler, localnet_to_str, localnet_to_vl, 0, 0);
ast_sorcery_object_field_register_custom(sorcery, "transport", "tos", "0", transport_tos_handler, tos_to_str, NULL, 0, 0);
ast_sorcery_object_field_register(sorcery, "transport", "cos", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_transport, cos));
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15117
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I65eac49e5b0a79261ea80e2b9b38a836886ed59f
Gerrit-Change-Number: 15117
Gerrit-PatchSet: 2
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201109/d33a116e/attachment-0001.html>
More information about the asterisk-code-review
mailing list