[asterisk-commits] mmichelson: branch mmichelson/outbound_auth r383326 - in /team/mmichelson/out...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 18 14:13:38 CDT 2013
Author: mmichelson
Date: Mon Mar 18 14:13:37 2013
New Revision: 383326
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383326
Log:
Move some stuff out of sip_outbound_auth.c into res_sip.c
This makes module reference counting actually work as expected.
Modified:
team/mmichelson/outbound_auth/res/res_sip.c
team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c
Modified: team/mmichelson/outbound_auth/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/outbound_auth/res/res_sip.c?view=diff&rev=383326&r1=383325&r2=383326
==============================================================================
--- team/mmichelson/outbound_auth/res/res_sip.c (original)
+++ team/mmichelson/outbound_auth/res/res_sip.c Mon Mar 18 14:13:37 2013
@@ -130,6 +130,42 @@
return registered_authenticator->check_authentication(endpoint, rdata, tdata);
}
+static struct ast_sip_outbound_authenticator *registered_outbound_authenticator;
+
+int ast_sip_register_outbound_authenticator(struct ast_sip_outbound_authenticator *auth)
+{
+ if (registered_outbound_authenticator) {
+ ast_log(LOG_WARNING, "Outbound authenticator %p is already registered. Cannot register a new one\n", registered_outbound_authenticator);
+ return -1;
+ }
+ registered_outbound_authenticator = auth;
+ ast_debug(1, "Registered SIP outbound authenticator module %p\n", auth);
+ ast_module_ref(ast_module_info->self);
+ return 0;
+}
+
+void ast_sip_unregister_outbound_authenticator(struct ast_sip_outbound_authenticator *auth)
+{
+ if (registered_outbound_authenticator != auth) {
+ ast_log(LOG_WARNING, "Trying to unregister outbound authenticator %p but outbound authenticator %p registered\n",
+ auth, registered_outbound_authenticator);
+ return;
+ }
+ registered_outbound_authenticator = NULL;
+ ast_debug(1, "Unregistered SIP outbound authenticator %p\n", auth);
+ ast_module_unref(ast_module_info->self);
+}
+
+int ast_sip_create_auth_challenge_response(struct ast_sip_endpoint *endpoint, pjsip_rx_data *challenge,
+ pjsip_transaction *tsx, pjsip_tx_data **new_request)
+{
+ if (!registered_outbound_authenticator) {
+ ast_log(LOG_WARNING, "No SIP outbound authenticator registered. Cannot respond to authentication challenge\n");
+ return -1;
+ }
+ return registered_outbound_authenticator->challenge_response(endpoint, challenge, tsx, new_request);
+}
+
int ast_sip_set_outbound_authentication_credentials(pjsip_auth_clt_sess *auth_sess, struct ast_sip_endpoint *endpoint)
{
struct ast_sip_auth **auths = ast_alloca(endpoint->num_outbound_auths * sizeof(*auths));
Modified: team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c?view=diff&rev=383326&r1=383325&r2=383326
==============================================================================
--- team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c (original)
+++ team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c Mon Mar 18 14:13:37 2013
@@ -109,42 +109,6 @@
return 0;
}
-static struct ast_sip_outbound_authenticator *registered_authenticator;
-
-int ast_sip_register_outbound_authenticator(struct ast_sip_outbound_authenticator *auth)
-{
- if (registered_authenticator) {
- ast_log(LOG_WARNING, "Outbound authenticator %p is already registered. Cannot register a new one\n", registered_authenticator);
- return -1;
- }
- registered_authenticator = auth;
- ast_debug(1, "Registered SIP outbound authenticator module %p\n", auth);
- /* ast_module_ref(ast_module_info->self); */
- return 0;
-}
-
-void ast_sip_unregister_outbound_authenticator(struct ast_sip_outbound_authenticator *auth)
-{
- if (registered_authenticator != auth) {
- ast_log(LOG_WARNING, "Trying to unregister outbound authenticator %p but outbound authenticator %p registered\n",
- auth, registered_authenticator);
- return;
- }
- registered_authenticator = NULL;
- ast_debug(1, "Unregistered SIP outbound authenticator %p\n", auth);
- /* ast_module_unref(ast_module_info->self); */
-}
-
-int ast_sip_create_auth_challenge_response(struct ast_sip_endpoint *endpoint, pjsip_rx_data *challenge,
- pjsip_transaction *tsx, pjsip_tx_data **new_request)
-{
- if (!registered_authenticator) {
- ast_log(LOG_WARNING, "No SIP outbound authenticator registered. Cannot respond to authentication challenge\n");
- return -1;
- }
- return registered_authenticator->challenge_response(endpoint, challenge, tsx, new_request);
-}
-
int ast_sip_initialize_outbound_authentication(void) {
return ast_sip_register_service(&outbound_auth_mod);
}
More information about the asterisk-commits
mailing list