Fixed authentication issues.

git-svn-id: http://yate.null.ro/svn/yate/trunk@387 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-06-04 00:06:59 +00:00
parent e6fd87f0a6
commit 0644fc3d34
3 changed files with 15 additions and 11 deletions

View File

@ -860,7 +860,7 @@ bool Regexp::matches(const char* value, StringMatchPrivate* matches)
{
DDebug(DebugInfo,"Regexp::matches(\"%s\",%p)",value,matches);
if (!value)
return false;
value = "";
if (!compile())
return false;
int mm = matches ? MAX_MATCH : 0;

View File

@ -83,8 +83,12 @@ private:
bool AuthHandler::received(Message &msg)
{
String username(msg.getValue("username"));
msg.retValue() = s_cfg.getValue(username,"password");
return (!msg.retValue().null());
const NamedList* sect = s_cfg.getSection(username);
if (sect) {
msg.retValue() = sect->getValue("password");
return true;
}
return false;
};

View File

@ -374,8 +374,8 @@ bool YateSIPEngine::checkUser(const String& username, const String& realm, const
m.addParam("uri",uri);
m.addParam("response",response);
if (message) {
m.addParam("xsip_received",message->getParty()->getPartyAddr());
m.addParam("xsip_rport",String(message->getParty()->getPartyPort()));
m.addParam("ip_addr",message->getParty()->getPartyAddr());
m.addParam("ip_port",String(message->getParty()->getPartyPort()));
}
if (!Engine::dispatch(m))
@ -664,11 +664,11 @@ YateSIPConnection::YateSIPConnection(SIPEvent* ev, SIPTransaction* tr)
if (age >= 0) {
if (age < 10) {
m_user = user;
m->addParam("user",m_user);
m->addParam("username",m_user);
}
else
m->addParam("xsip_user",user);
m->addParam("xsip_nonce_age",String(age));
m->addParam("expired_user",user);
m->addParam("nonce_age",String(age));
}
m->addParam("caller",m_uri.getUser());
@ -677,13 +677,13 @@ YateSIPConnection::YateSIPConnection(SIPEvent* ev, SIPTransaction* tr)
int maxf = tmp.toInteger(70);
tmp = (maxf/10)-1;
m->addParam("antiloop",tmp);
m->addParam("ip_addr",m_host);
m->addParam("ip_port",String(m_port));
m->addParam("sip_uri",uri);
m->addParam("sip_from",m_uri);
m->addParam("sip_callid",m_callid);
m->addParam("sip_contact",ev->getMessage()->getHeaderValue("Contact"));
m->addParam("sip_user-agent",ev->getMessage()->getHeaderValue("User-Agent"));
m->addParam("xsip_received",m_host);
m->addParam("xsip_rport",String(m_port));
if (ev->getMessage()->body && ev->getMessage()->body->isSDP()) {
parseSDP(static_cast<SDPBody*>(ev->getMessage()->body),m_rtpAddr,m_rtpPort,m_formats);
if (m_rtpAddr) {
@ -1211,7 +1211,7 @@ bool YateSIPConnection::callRouted(Message& msg)
void YateSIPConnection::callAccept(Message& msg)
{
Channel::callAccept(msg);
m_user = msg.getValue("user");
m_user = msg.getValue("username");
}
void YateSIPConnection::callReject(const char* error, const char* reason)