Fixes use of local credentials authority (now that was some tricky stuff to find).
This commit is contained in:
parent
75231a7e3e
commit
21cd44045f
@ -255,7 +255,7 @@ public class MessageIntegrityAttribute
|
|||||||
binValue[3] = (byte)(getDataLength()&0x00FF);
|
binValue[3] = (byte)(getDataLength()&0x00FF);
|
||||||
|
|
||||||
byte[] key = StunStack.getInstance().getCredentialsManager()
|
byte[] key = StunStack.getInstance().getCredentialsManager()
|
||||||
.getLocalKey(username);
|
.getRemoteKey(username);
|
||||||
|
|
||||||
//now calculate the HMAC-SHA1
|
//now calculate the HMAC-SHA1
|
||||||
this.hmacSha1Content = calculateHmacSha1(content, offset, length, key);
|
this.hmacSha1Content = calculateHmacSha1(content, offset, length, key);
|
||||||
|
|||||||
@ -406,17 +406,18 @@ public class Agent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the user name that we should tell a peer <tt>Agent</tt> to use
|
* Returns the user name that we should expect a peer <tt>Agent</tt> to use
|
||||||
* in connectivity checks for outgoing Binding Requests. According to RFC
|
* in connectivity checks for Binding Requests its sending our way.
|
||||||
* 5245, a Binding Request serving as a connectivity check MUST utilize the
|
* According to RFC 5245, a Binding Request serving as a connectivity check
|
||||||
* STUN short term credential mechanism. The username for the credential is
|
* MUST utilize the STUN short term credential mechanism. The username for
|
||||||
* formed by concatenating the username fragment provided by the peer with
|
* the credential is formed by concatenating the username fragment provided
|
||||||
* the username fragment of the agent sending the request, separated by a
|
* by the peer with the username fragment of the agent sending the request,
|
||||||
* colon (":"). The password is equal to the password provided by the peer.
|
* separated by a colon (":"). The password is equal to the password
|
||||||
* For example, consider the case where agent L is the offerer, and agent R
|
* provided by the peer. For example, consider the case where agent
|
||||||
* is the answerer. Agent L included a username fragment of LFRAG for its
|
* L is the offerer, and agent R is the answerer. Agent L
|
||||||
* candidates, and a password of LPASS. Agent R provided a username
|
* included a username fragment of LFRAG for its candidates,
|
||||||
* fragment of RFRAG and a password of RPASS. A connectivity check from L
|
* and a password of LPASS. Agent R provided a username fragment
|
||||||
|
* of RFRAG and a password of RPASS. A connectivity check from L
|
||||||
* to R (and its response of course) utilize the username RFRAG:LFRAG and a
|
* to R (and its response of course) utilize the username RFRAG:LFRAG and a
|
||||||
* password of RPASS. A connectivity check from R to L (and its response)
|
* password of RPASS. A connectivity check from R to L (and its response)
|
||||||
* utilize the username LFRAG:RFRAG and a password of LPASS.
|
* utilize the username LFRAG:RFRAG and a password of LPASS.
|
||||||
|
|||||||
@ -89,8 +89,9 @@ public class ConnectivityCheckClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
//credentials
|
//credentials
|
||||||
|
String localUserName = parentAgent.generateLocalUserName();
|
||||||
UsernameAttribute unameAttr = AttributeFactory.createUsernameAttribute(
|
UsernameAttribute unameAttr = AttributeFactory.createUsernameAttribute(
|
||||||
parentAgent.generateLocalUserName());
|
localUserName);
|
||||||
|
|
||||||
request.addAttribute(unameAttr);
|
request.addAttribute(unameAttr);
|
||||||
|
|
||||||
@ -99,8 +100,7 @@ public class ConnectivityCheckClient
|
|||||||
//for example.
|
//for example.
|
||||||
//todo: also implement SASL prepare
|
//todo: also implement SASL prepare
|
||||||
MessageIntegrityAttribute msgIntegrity = AttributeFactory
|
MessageIntegrityAttribute msgIntegrity = AttributeFactory
|
||||||
.createMessageIntegrityAttribute(parentAgent
|
.createMessageIntegrityAttribute(localUserName);
|
||||||
.generateRemoteUserName());
|
|
||||||
|
|
||||||
|
|
||||||
request.addAttribute(msgIntegrity);
|
request.addAttribute(msgIntegrity);
|
||||||
|
|||||||
@ -136,7 +136,7 @@ public class ConnectivityCheckServer
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//caller gave us the entire username.
|
//caller gave us the entire username.
|
||||||
if (username.equals(parentAgent.generateRemoteUserName()))
|
if(username.substring(0, colon).equals(parentAgent.getLocalUfrag()))
|
||||||
return parentAgent.getLocalPassword().getBytes();
|
return parentAgent.getLocalPassword().getBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -384,7 +384,8 @@ public class StunCandidateHarvester
|
|||||||
Level.INFO,
|
Level.INFO,
|
||||||
"Failed to send "
|
"Failed to send "
|
||||||
+ request
|
+ request
|
||||||
+ " through " + hostCand.getTransportAddress(),
|
+ " through " + hostCand.getTransportAddress()
|
||||||
|
+ " to " + stunServer,
|
||||||
exception);
|
exception);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user