mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Reorganize the ast_sip_endpoint structure into substructures.
(closes issue ASTERISK-22135) reported by Matt Jordan Review: https://reviewboard.asterisk.org/r/2707 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395748 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -31,19 +31,19 @@
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/strings.h"
|
||||
|
||||
static int set_outbound_authentication_credentials(pjsip_auth_clt_sess *auth_sess, const char **auth_strs, size_t num_auths)
|
||||
static int set_outbound_authentication_credentials(pjsip_auth_clt_sess *auth_sess, const struct ast_sip_auth_array *array)
|
||||
{
|
||||
struct ast_sip_auth **auths = ast_alloca(num_auths * sizeof(*auths));
|
||||
pjsip_cred_info *auth_creds = ast_alloca(num_auths * sizeof(*auth_creds));
|
||||
struct ast_sip_auth **auths = ast_alloca(array->num * sizeof(*auths));
|
||||
pjsip_cred_info *auth_creds = ast_alloca(array->num * sizeof(*auth_creds));
|
||||
int res = 0;
|
||||
int i;
|
||||
|
||||
if (ast_sip_retrieve_auths(auth_strs, num_auths, auths)) {
|
||||
if (ast_sip_retrieve_auths(array, auths)) {
|
||||
res = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_auths; ++i) {
|
||||
for (i = 0; i < array->num; ++i) {
|
||||
pj_cstr(&auth_creds[i].realm, auths[i]->realm);
|
||||
pj_cstr(&auth_creds[i].username, auths[i]->auth_user);
|
||||
pj_cstr(&auth_creds[i].scheme, "digest");
|
||||
@@ -62,14 +62,14 @@ static int set_outbound_authentication_credentials(pjsip_auth_clt_sess *auth_ses
|
||||
}
|
||||
}
|
||||
|
||||
pjsip_auth_clt_set_credentials(auth_sess, num_auths, auth_creds);
|
||||
pjsip_auth_clt_set_credentials(auth_sess, array->num, auth_creds);
|
||||
|
||||
cleanup:
|
||||
ast_sip_cleanup_auths(auths, num_auths);
|
||||
ast_sip_cleanup_auths(auths, array->num);
|
||||
return res;
|
||||
}
|
||||
|
||||
static int digest_create_request_with_auth(const char **auths, size_t num_auths, pjsip_rx_data *challenge,
|
||||
static int digest_create_request_with_auth(const struct ast_sip_auth_array *auths, pjsip_rx_data *challenge,
|
||||
pjsip_transaction *tsx, pjsip_tx_data **new_request)
|
||||
{
|
||||
pjsip_auth_clt_sess auth_sess;
|
||||
@@ -80,7 +80,7 @@ static int digest_create_request_with_auth(const char **auths, size_t num_auths,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (set_outbound_authentication_credentials(&auth_sess, auths, num_auths)) {
|
||||
if (set_outbound_authentication_credentials(&auth_sess, auths)) {
|
||||
ast_log(LOG_WARNING, "Failed to set authentication credentials\n");
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user