Compare commits
3 Commits
83485575f8
...
6b739ad27d
Author | SHA1 | Date |
---|---|---|
Andrew Cassidy | 6b739ad27d | |
Aron Podrigal | 5cb74797fe | |
Andrew Cassidy | b24f2417b8 |
|
@ -2676,10 +2676,10 @@ typedef enum {
|
||||||
#define SDP_TYPE_RESPONSE SDP_ANSWER
|
#define SDP_TYPE_RESPONSE SDP_ANSWER
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AEAD_AES_256_GCM_8,
|
|
||||||
AEAD_AES_256_GCM,
|
AEAD_AES_256_GCM,
|
||||||
AEAD_AES_128_GCM_8,
|
AEAD_AES_256_GCM_8,
|
||||||
AEAD_AES_128_GCM,
|
AEAD_AES_128_GCM,
|
||||||
|
AEAD_AES_128_GCM_8,
|
||||||
AES_CM_256_HMAC_SHA1_80,
|
AES_CM_256_HMAC_SHA1_80,
|
||||||
AES_CM_192_HMAC_SHA1_80,
|
AES_CM_192_HMAC_SHA1_80,
|
||||||
AES_CM_128_HMAC_SHA1_80,
|
AES_CM_128_HMAC_SHA1_80,
|
||||||
|
|
|
@ -106,6 +106,22 @@ char * pgsql_handle_get_error(switch_pgsql_handle_t *handle)
|
||||||
return err_str;
|
return err_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pgsql_handle_set_error_if_not_set(switch_pgsql_handle_t *handle, char **err)
|
||||||
|
{
|
||||||
|
char *err_str;
|
||||||
|
|
||||||
|
if (err && !(*err)) {
|
||||||
|
err_str = pgsql_handle_get_error(handle);
|
||||||
|
|
||||||
|
if (zstr(err_str)) {
|
||||||
|
switch_safe_free(err_str);
|
||||||
|
err_str = strdup((char *)"SQL ERROR!");
|
||||||
|
}
|
||||||
|
|
||||||
|
*err = err_str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int db_is_up(switch_pgsql_handle_t *handle)
|
static int db_is_up(switch_pgsql_handle_t *handle)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -553,8 +569,15 @@ switch_status_t pgsql_handle_exec_detailed(const char *file, const char *func, i
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pgsql_finish_results(handle);
|
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
pgsql_handle_set_error_if_not_set(handle, err);
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,6 +653,7 @@ done:
|
||||||
|
|
||||||
pgsql_free_result(&result);
|
pgsql_free_result(&result);
|
||||||
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
|
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
pgsql_handle_set_error_if_not_set(handle, err);
|
||||||
sstatus = SWITCH_STATUS_FALSE;
|
sstatus = SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -638,6 +662,7 @@ done:
|
||||||
error:
|
error:
|
||||||
|
|
||||||
pgsql_free_result(&result);
|
pgsql_free_result(&result);
|
||||||
|
pgsql_handle_set_error_if_not_set(handle, err);
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1050,6 +1075,8 @@ switch_status_t pgsql_handle_callback_exec_detailed(const char *file, const char
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
error:
|
error:
|
||||||
|
|
||||||
|
pgsql_handle_set_error_if_not_set(handle, err);
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,10 +275,10 @@ struct switch_media_handle_s {
|
||||||
};
|
};
|
||||||
|
|
||||||
switch_srtp_crypto_suite_t SUITES[CRYPTO_INVALID] = {
|
switch_srtp_crypto_suite_t SUITES[CRYPTO_INVALID] = {
|
||||||
{ "AEAD_AES_256_GCM_8", "", AEAD_AES_256_GCM_8, 44, 12},
|
|
||||||
{ "AEAD_AES_256_GCM", "", AEAD_AES_256_GCM, 44, 12},
|
{ "AEAD_AES_256_GCM", "", AEAD_AES_256_GCM, 44, 12},
|
||||||
{ "AEAD_AES_128_GCM_8", "", AEAD_AES_128_GCM_8, 28, 12},
|
{ "AEAD_AES_256_GCM_8", "", AEAD_AES_256_GCM_8, 44, 12},
|
||||||
{ "AEAD_AES_128_GCM", "", AEAD_AES_128_GCM, 28, 12},
|
{ "AEAD_AES_128_GCM", "", AEAD_AES_128_GCM, 28, 12},
|
||||||
|
{ "AEAD_AES_128_GCM_8", "", AEAD_AES_128_GCM_8, 28, 12},
|
||||||
{ "AES_256_CM_HMAC_SHA1_80", "AES_CM_256_HMAC_SHA1_80", AES_CM_256_HMAC_SHA1_80, 46, 14},
|
{ "AES_256_CM_HMAC_SHA1_80", "AES_CM_256_HMAC_SHA1_80", AES_CM_256_HMAC_SHA1_80, 46, 14},
|
||||||
{ "AES_192_CM_HMAC_SHA1_80", "AES_CM_192_HMAC_SHA1_80", AES_CM_192_HMAC_SHA1_80, 38, 14},
|
{ "AES_192_CM_HMAC_SHA1_80", "AES_CM_192_HMAC_SHA1_80", AES_CM_192_HMAC_SHA1_80, 38, 14},
|
||||||
{ "AES_CM_128_HMAC_SHA1_80", "", AES_CM_128_HMAC_SHA1_80, 30, 14},
|
{ "AES_CM_128_HMAC_SHA1_80", "", AES_CM_128_HMAC_SHA1_80, 30, 14},
|
||||||
|
@ -1677,6 +1677,9 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
|
||||||
int use_alias = 0;
|
int use_alias = 0;
|
||||||
switch_rtp_engine_t *engine;
|
switch_rtp_engine_t *engine;
|
||||||
switch_media_handle_t *smh;
|
switch_media_handle_t *smh;
|
||||||
|
char *crypto_cpy;
|
||||||
|
char *fields[4];
|
||||||
|
unsigned int crypto_argc;
|
||||||
|
|
||||||
if (!(smh = session->media_handle)) {
|
if (!(smh = session->media_handle)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1695,16 +1698,21 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
|
||||||
}
|
}
|
||||||
engine = &session->media_handle->engines[type];
|
engine = &session->media_handle->engines[type];
|
||||||
|
|
||||||
|
crypto_cpy = (char*)malloc(strlen(crypto)+1);
|
||||||
|
strcpy(crypto_cpy, crypto);
|
||||||
|
crypto_argc = switch_split(crypto_cpy, ' ', fields);
|
||||||
|
|
||||||
|
if (crypto_argc > 2) {
|
||||||
for (i = 0; smh->crypto_suite_order[i] != CRYPTO_INVALID; i++) {
|
for (i = 0; smh->crypto_suite_order[i] != CRYPTO_INVALID; i++) {
|
||||||
switch_rtp_crypto_key_type_t j = SUITES[smh->crypto_suite_order[i]].type;
|
switch_rtp_crypto_key_type_t j = SUITES[smh->crypto_suite_order[i]].type;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "looking for crypto suite [%s]alias=[%s] in [%s]\n", SUITES[j].name, SUITES[j].alias, crypto);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "looking for crypto suite [%s]alias=[%s] in [%s]\n", SUITES[j].name, SUITES[j].alias, crypto);
|
||||||
|
|
||||||
if (switch_stristr(SUITES[j].alias, crypto)) {
|
if (!strcmp(SUITES[j].alias, fields[1])) {
|
||||||
use_alias = 1;
|
use_alias = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_alias || switch_stristr(SUITES[j].name, crypto)) {
|
if (use_alias || !strcmp(SUITES[j].name, fields[1])) {
|
||||||
ctype = SUITES[j].type;
|
ctype = SUITES[j].type;
|
||||||
vval = use_alias ? SUITES[j].alias : SUITES[j].name;
|
vval = use_alias ? SUITES[j].alias : SUITES[j].name;
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Found suite %s\n", vval);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Found suite %s\n", vval);
|
||||||
|
@ -1714,6 +1722,9 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
|
||||||
|
|
||||||
use_alias = 0;
|
use_alias = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(crypto_cpy);
|
||||||
|
|
||||||
if (engine->ssec[engine->crypto_type].remote_crypto_key && switch_rtp_ready(engine->rtp_session)) {
|
if (engine->ssec[engine->crypto_type].remote_crypto_key && switch_rtp_ready(engine->rtp_session)) {
|
||||||
/* Compare all the key. The tag may remain the same even if key changed */
|
/* Compare all the key. The tag may remain the same even if key changed */
|
||||||
|
|
Loading…
Reference in New Issue