private string IntersectHostname(EndpointPermission perm)
{
if (this.hostname == perm.hostname)
{
return(this.hostname);
}
this.Resolve();
perm.Resolve();
string _hostname = null;
if (this.hasWildcard)
{
if (perm.hasWildcard)
{
_hostname = Intersect(this.hostname, perm.hostname);
}
else if (perm.addresses != null)
{
for (int j = 0; j < perm.addresses.Length; j++)
{
_hostname = Intersect(this.hostname, perm.addresses [j].ToString());
if (_hostname != null)
{
break;
}
}
}
}
else if (this.addresses != null)
{
for (int i = 0; i < this.addresses.Length; i++)
{
string thisaddr = this.addresses [i].ToString();
if (perm.hasWildcard)
{
_hostname = Intersect(thisaddr, perm.hostname);
}
else if (perm.addresses != null)
{
for (int j = 0; j < perm.addresses.Length; j++)
{
_hostname = Intersect(thisaddr, perm.addresses [j].ToString());
if (_hostname != null)
{
break;
}
}
}
}
}
return(_hostname);
}