[asterisk-commits] res pjsip: Remove outgoing authentication code no longer nee... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 2 17:30:14 CDT 2015


Mark Michelson has submitted this change and it was merged.

Change subject: res_pjsip: Remove outgoing authentication code no longer needed.
......................................................................


res_pjsip: Remove outgoing authentication code no longer needed.

Associated with ASTERISK-25131

Change-Id: Iefa3b2066cfd8b108a90d2dd4a64d92c3a195d33
---
M res/res_pjsip.c
M res/res_pjsip/include/res_pjsip_private.h
D res/res_pjsip/pjsip_outbound_auth.c
3 files changed, 0 insertions(+), 136 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 7bf4897..6e7bd68 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3743,22 +3743,6 @@
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
-	if (internal_sip_initialize_outbound_authentication()) {
-		ast_log(LOG_ERROR, "Failed to initialize outbound authentication. Aborting load\n");
-		internal_sip_unregister_service(&supplement_module);
-		ast_sip_destroy_distributor();
-		ast_res_pjsip_destroy_configuration();
-		ast_sip_destroy_global_headers();
-		stop_monitor_thread();
-		ast_sip_destroy_system();
-		pj_pool_release(memory_pool);
-		memory_pool = NULL;
-		pjsip_endpt_destroy(ast_pjsip_endpoint);
-		ast_pjsip_endpoint = NULL;
-		pj_caching_pool_destroy(&caching_pool);
-		return AST_MODULE_LOAD_DECLINE;
-	}
-
 	ast_res_pjsip_init_options_handling(0);
 	ast_cli_register_multiple(cli_commands, ARRAY_LEN(cli_commands));
 
@@ -3783,7 +3767,6 @@
 {
 	ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands));
 	ast_res_pjsip_cleanup_options_handling();
-	internal_sip_destroy_outbound_authentication();
 	ast_sip_destroy_distributor();
 	ast_res_pjsip_destroy_configuration();
 	ast_sip_destroy_system();
diff --git a/res/res_pjsip/include/res_pjsip_private.h b/res/res_pjsip/include/res_pjsip_private.h
index a53e0c4..2cc9fea 100644
--- a/res/res_pjsip/include/res_pjsip_private.h
+++ b/res/res_pjsip/include/res_pjsip_private.h
@@ -194,24 +194,6 @@
 
 /*!
  * \internal
- * \brief Initialize outbound authentication support
- *
- * \retval 0 Success
- * \retval non-zero Failure
- */
-int internal_sip_initialize_outbound_authentication(void);
-
-/*!
- * \internal
- * \brief Destroy outbound authentication support
- *
- * \retval 0 Success
- * \retval non-zero Failure
- */
-void internal_sip_destroy_outbound_authentication(void);
-
-/*!
- * \internal
  * \brief Initialize system configuration
  *
  * \retval 0 Success
diff --git a/res/res_pjsip/pjsip_outbound_auth.c b/res/res_pjsip/pjsip_outbound_auth.c
deleted file mode 100644
index 8b39b00..0000000
--- a/res/res_pjsip/pjsip_outbound_auth.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2013, Digium, Inc.
- *
- * Mark Michelson <mmichelson at digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-#include "asterisk.h"
-#undef bzero
-#define bzero bzero
-#include "pjsip.h"
-
-#include "asterisk/res_pjsip.h"
-#include "asterisk/module.h"
-#include "include/res_pjsip_private.h"
-
-static pj_bool_t outbound_auth(pjsip_rx_data *rdata);
-
-static pjsip_module outbound_auth_mod = {
-	.name = {"Outbound Authentication", 19},
-	.priority = PJSIP_MOD_PRIORITY_DIALOG_USAGE,
-	.on_rx_response = outbound_auth,
-};
-
-struct outbound_auth_cb_data {
-	ast_sip_dialog_outbound_auth_cb cb;
-	void *user_data;
-};
-
-static pj_bool_t outbound_auth(pjsip_rx_data *rdata)
-{
-	RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
-	pjsip_transaction *tsx;
-	pjsip_dialog *dlg;
-	struct outbound_auth_cb_data *cb_data;
-	pjsip_tx_data *tdata;
-
-	if (rdata->msg_info.msg->line.status.code != 401 &&
-			rdata->msg_info.msg->line.status.code != 407) {
-		/* Doesn't pertain to us. Move on */
-		return PJ_FALSE;
-	}
-
-	tsx = pjsip_rdata_get_tsx(rdata);
-	dlg = pjsip_rdata_get_dlg(rdata);
-	if (!dlg || !tsx) {
-		return PJ_FALSE;
-	}
-
-	endpoint = ast_sip_dialog_get_endpoint(dlg);
-	if (!endpoint) {
-		return PJ_FALSE;
-	}
-
-	if (ast_sip_create_request_with_auth(&endpoint->outbound_auths, rdata, tsx->last_tx, &tdata)) {
-		return PJ_FALSE;
-	}
-
-	cb_data = dlg->mod_data[outbound_auth_mod.id];
-	if (cb_data) {
-		cb_data->cb(dlg, tdata, cb_data->user_data);
-		return PJ_TRUE;
-	}
-
-	pjsip_dlg_send_request(dlg, tdata, -1, NULL);
-	return PJ_TRUE;
-}
-
-int ast_sip_dialog_setup_outbound_authentication(pjsip_dialog *dlg, const struct ast_sip_endpoint *endpoint,
-		ast_sip_dialog_outbound_auth_cb cb, void *user_data)
-{
-	struct outbound_auth_cb_data *cb_data = PJ_POOL_ZALLOC_T(dlg->pool, struct outbound_auth_cb_data);
-	cb_data->cb = cb;
-	cb_data->user_data = user_data;
-
-	dlg->sess_count++;
-	pjsip_dlg_add_usage(dlg, &outbound_auth_mod, cb_data);
-	dlg->sess_count--;
-
-	return 0;
-}
-
-int internal_sip_initialize_outbound_authentication(void) {
-	return internal_sip_register_service(&outbound_auth_mod);
-}
-
-
-void internal_sip_destroy_outbound_authentication(void) {
-	internal_sip_unregister_service(&outbound_auth_mod);
-}

-- 
To view, visit https://gerrit.asterisk.org/569
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefa3b2066cfd8b108a90d2dd4a64d92c3a195d33
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list