Fix a possible ConcurrentModificationException in CredentialsManager.
This commit is contained in:
parent
17e931572e
commit
768db27837
@ -47,16 +47,18 @@ public class CredentialsManager
|
|||||||
*/
|
*/
|
||||||
public byte[] getLocalKey(String username)
|
public byte[] getLocalKey(String username)
|
||||||
{
|
{
|
||||||
for (CredentialsAuthority auth : authorities)
|
synchronized(authorities)
|
||||||
{
|
{
|
||||||
byte[] passwd = auth.getLocalKey(username);
|
for (CredentialsAuthority auth : authorities)
|
||||||
|
|
||||||
if (passwd != null)
|
|
||||||
{
|
{
|
||||||
return passwd;
|
byte[] passwd = auth.getLocalKey(username);
|
||||||
|
|
||||||
|
if (passwd != null)
|
||||||
|
{
|
||||||
|
return passwd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,17 +78,19 @@ public class CredentialsManager
|
|||||||
*/
|
*/
|
||||||
public byte[] getRemoteKey(String username, String media)
|
public byte[] getRemoteKey(String username, String media)
|
||||||
{
|
{
|
||||||
for (CredentialsAuthority auth : authorities)
|
synchronized(authorities)
|
||||||
{
|
{
|
||||||
byte[] passwd = auth.getRemoteKey(username, media);
|
for (CredentialsAuthority auth : authorities)
|
||||||
|
|
||||||
if (passwd != null)
|
|
||||||
{
|
{
|
||||||
/** @todo: we should probably add SASLprep here.*/
|
byte[] passwd = auth.getRemoteKey(username, media);
|
||||||
return passwd;
|
|
||||||
|
if (passwd != null)
|
||||||
|
{
|
||||||
|
/** @todo: we should probably add SASLprep here.*/
|
||||||
|
return passwd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,12 +107,14 @@ public class CredentialsManager
|
|||||||
*/
|
*/
|
||||||
public boolean checkLocalUserName(String username)
|
public boolean checkLocalUserName(String username)
|
||||||
{
|
{
|
||||||
for (CredentialsAuthority auth : authorities)
|
synchronized(authorities)
|
||||||
{
|
{
|
||||||
if( auth.checkLocalUserName(username))
|
for (CredentialsAuthority auth : authorities)
|
||||||
return true;
|
{
|
||||||
|
if( auth.checkLocalUserName(username))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,8 +126,11 @@ public class CredentialsManager
|
|||||||
*/
|
*/
|
||||||
public void registerAuthority(CredentialsAuthority authority)
|
public void registerAuthority(CredentialsAuthority authority)
|
||||||
{
|
{
|
||||||
if(!authorities.contains(authority))
|
synchronized(authorities)
|
||||||
authorities.add(authority);
|
{
|
||||||
|
if(!authorities.contains(authority))
|
||||||
|
authorities.add(authority);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,6 +142,9 @@ public class CredentialsManager
|
|||||||
*/
|
*/
|
||||||
public void unregisterAuthority(CredentialsAuthority authority)
|
public void unregisterAuthority(CredentialsAuthority authority)
|
||||||
{
|
{
|
||||||
authorities.remove(authority);
|
synchronized(authorities)
|
||||||
|
{
|
||||||
|
authorities.remove(authority);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user