From 518bc5bc02157b0fd6fa801a9d880dd361530dcc Mon Sep 17 00:00:00 2001 From: pierre-luc <pierre-luc.bacon@savoirfairelinux.com> Date: Fri, 31 Jul 2009 14:50:14 -0400 Subject: [PATCH] [#1930][#1931] Credential was not selected properly using realm because a bad index was used in the loop that was building up the credential array. --- sflphone-common/src/sipaccount.cpp | 7 ++++--- sflphone-common/src/sipvoiplink.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sflphone-common/src/sipaccount.cpp b/sflphone-common/src/sipaccount.cpp index 97806fd57f..3e8dbf52b0 100644 --- a/sflphone-common/src/sipaccount.cpp +++ b/sflphone-common/src/sipaccount.cpp @@ -70,9 +70,8 @@ int SIPAccount::registerVoIPLink() int credentialCount = 0; credentialCount = Manager::instance().getConfigInt (_accountID, CONFIG_CREDENTIAL_NUMBER); - credentialCount += 1; // Default credential - pjsip_cred_info * cred_info = (pjsip_cred_info *) malloc(sizeof(pjsip_cred_info)*credentialCount); + pjsip_cred_info * cred_info = (pjsip_cred_info *) malloc(sizeof(pjsip_cred_info)*(credentialCount+1)); if (cred_info == NULL) { _debug("Failed to set cred_info for account %s\n", _accountID.c_str()); return !SUCCESS; @@ -90,7 +89,7 @@ int SIPAccount::registerVoIPLink() cred_info[0].scheme = pj_str("digest"); int i; - for (i = 1; i < credentialCount; i++) { + for (i = 0; i < credentialCount; i++) { std::string credentialIndex; std::stringstream streamOut; streamOut << i; @@ -107,6 +106,8 @@ int SIPAccount::registerVoIPLink() cred_info[i].realm = pj_str(strdup(realm.c_str())); cred_info[i].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD; cred_info[i].scheme = pj_str("digest"); + + _debug("Setting credential %d realm = %s\n", i, realm.c_str()); } _credentialCount = credentialCount; diff --git a/sflphone-common/src/sipvoiplink.h b/sflphone-common/src/sipvoiplink.h index 8dde01c291..eec72e7061 100644 --- a/sflphone-common/src/sipvoiplink.h +++ b/sflphone-common/src/sipvoiplink.h @@ -42,7 +42,7 @@ class AudioRtp; #define RANDOM_SIP_PORT rand() % 64000 + 1024 // To set the verbosity. From 0 (min) to 6 (max) -#define PJ_LOG_LEVEL 0 +#define PJ_LOG_LEVEL 0 /** * @file sipvoiplink.h -- GitLab