Skip to content
Snippets Groups Projects
Commit df19ab8e authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

[#1400] Make the match with the hostname instead of username

parent 200db686
Branches
Tags
No related merge requests found
...@@ -2507,11 +2507,11 @@ ManagerImpl::getAccountIdFromNameAndServer(const std::string& userName, const st ...@@ -2507,11 +2507,11 @@ ManagerImpl::getAccountIdFromNameAndServer(const std::string& userName, const st
} }
} }
// We failed! Then only match the username // We failed! Then only match the hostname
for(iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) { for(iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) {
account = dynamic_cast<SIPAccount *>(iter->second); account = dynamic_cast<SIPAccount *>(iter->second);
if ( account != NULL ) { if ( account != NULL ) {
if(account->userMatch(userName)) if(account->hostnameMatch(server))
return iter->first; return iter->first;
} }
} }
......
...@@ -87,7 +87,7 @@ void SIPAccount::loadConfig() ...@@ -87,7 +87,7 @@ void SIPAccount::loadConfig()
bool SIPAccount::fullMatch(const std::string& username, const std::string& hostname) bool SIPAccount::fullMatch(const std::string& username, const std::string& hostname)
{ {
return (username == getUsername() && hostname == getHostname()); return (userMatch (username) && hostnameMatch (hostname));
} }
bool SIPAccount::userMatch(const std::string& username) bool SIPAccount::userMatch(const std::string& username)
...@@ -95,3 +95,8 @@ bool SIPAccount::userMatch(const std::string& username) ...@@ -95,3 +95,8 @@ bool SIPAccount::userMatch(const std::string& username)
return (username == getUsername()); return (username == getUsername());
} }
bool SIPAccount::hostnameMatch(const std::string& hostname)
{
return (hostname == getHostname());
}
...@@ -76,6 +76,7 @@ class SIPAccount : public Account ...@@ -76,6 +76,7 @@ class SIPAccount : public Account
bool fullMatch(const std::string& username, const std::string& hostname); bool fullMatch(const std::string& username, const std::string& hostname);
bool userMatch(const std::string& username); bool userMatch(const std::string& username);
bool hostnameMatch(const std::string& hostname);
pjsip_regc* getRegistrationInfo( void ) { return _regc; } pjsip_regc* getRegistrationInfo( void ) { return _regc; }
void setRegistrationInfo( pjsip_regc *regc ) { _regc = regc; } void setRegistrationInfo( pjsip_regc *regc ) { _regc = regc; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment