mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
57504: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 57345: MNT-8689 : Merged DEV to V4.2-BUG-FIX 54262: MNT-8689 : GenerateSubnetMask() do not allow usage of master browser detection in a classless addressed network Try and get the broadcast mask from the network interface. MNT-8689 (1 of 2) 54264: MNT-8689 : GenerateSubnetMask() do not allow usage of master browser detection in a classless addressed network Added broadcast mask override property for cases where the broadcast mask cannot be determined automatically. MNT-8689 (2 of 2) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61834 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -10,4 +10,5 @@ passthru.authentication.offlineCheckInterval=300
|
|||||||
passthru.authentication.protocolOrder=TCPIP,NetBIOS
|
passthru.authentication.protocolOrder=TCPIP,NetBIOS
|
||||||
passthru.authentication.authenticateCIFS=true
|
passthru.authentication.authenticateCIFS=true
|
||||||
passthru.authentication.authenticateFTP=true
|
passthru.authentication.authenticateFTP=true
|
||||||
passthru.authentication.sessionCleanup=true
|
passthru.authentication.sessionCleanup=true
|
||||||
|
passthru.authentication.broadcastMask=
|
||||||
|
@@ -34,6 +34,9 @@
|
|||||||
<property name="nullDomainUseAnyServer">
|
<property name="nullDomainUseAnyServer">
|
||||||
<value>true</value>
|
<value>true</value>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="broadcastMask">
|
||||||
|
<value>${passthru.authentication.broadcastMask}</value>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- The authentication component. -->
|
<!-- The authentication component. -->
|
||||||
|
@@ -20,10 +20,15 @@ package org.alfresco.filesys.auth;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.net.InterfaceAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
|
import java.net.SocketException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.Enumeration;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.jlan.netbios.NetBIOSSession;
|
||||||
import org.alfresco.jlan.server.auth.passthru.AuthSessionFactory;
|
import org.alfresco.jlan.server.auth.passthru.AuthSessionFactory;
|
||||||
import org.alfresco.jlan.server.auth.passthru.PassthruServers;
|
import org.alfresco.jlan.server.auth.passthru.PassthruServers;
|
||||||
import org.alfresco.jlan.server.config.InvalidConfigurationException;
|
import org.alfresco.jlan.server.config.InvalidConfigurationException;
|
||||||
@@ -193,6 +198,61 @@ public class PassthruServerFactory implements FactoryBean, InitializingBean, Dis
|
|||||||
+ Protocol.asString(secondaryProto));
|
+ Protocol.asString(secondaryProto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the broadcast mask to use for NetBIOS name lookups
|
||||||
|
*
|
||||||
|
* @param bcastMask String
|
||||||
|
* @exception AlfrescoRuntimeException
|
||||||
|
*/
|
||||||
|
public final void setBroadcastMask( String bcastMask)
|
||||||
|
throws IOException {
|
||||||
|
|
||||||
|
if ( bcastMask == null || bcastMask.length() == 0) {
|
||||||
|
|
||||||
|
// Clear the NetBIOS subnet mask
|
||||||
|
|
||||||
|
NetBIOSSession.setDefaultSubnetMask( null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the network adapter with the matching broadcast mask
|
||||||
|
|
||||||
|
try {
|
||||||
|
Enumeration<NetworkInterface> netEnum = NetworkInterface.getNetworkInterfaces();
|
||||||
|
NetworkInterface bcastIface = null;
|
||||||
|
|
||||||
|
while ( netEnum.hasMoreElements() && bcastIface == null) {
|
||||||
|
|
||||||
|
NetworkInterface ni = netEnum.nextElement();
|
||||||
|
for ( InterfaceAddress iAddr : ni.getInterfaceAddresses()) {
|
||||||
|
InetAddress broadcast = iAddr.getBroadcast();
|
||||||
|
if ( broadcast != null && broadcast.getHostAddress().equals( bcastMask))
|
||||||
|
bcastIface = ni;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
|
||||||
|
if ( logger.isDebugEnabled()) {
|
||||||
|
if ( bcastIface != null)
|
||||||
|
logger.debug("Broadcast mask " + bcastMask + " found on network interface " + bcastIface.getDisplayName() + "/" + bcastIface.getName());
|
||||||
|
else
|
||||||
|
logger.debug("Failed to find network interface for broadcast mask " + bcastMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we found a valid network interface for the broadcast mask
|
||||||
|
|
||||||
|
if ( bcastIface == null)
|
||||||
|
throw new AlfrescoRuntimeException("Network interface for broadcast mask " + bcastMask + " not found");
|
||||||
|
|
||||||
|
// Set the NetBIOS broadcast mask
|
||||||
|
|
||||||
|
NetBIOSSession.setDefaultSubnetMask( bcastMask);
|
||||||
|
}
|
||||||
|
catch ( SocketException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void afterPropertiesSet() throws InvalidConfigurationException
|
public void afterPropertiesSet() throws InvalidConfigurationException
|
||||||
{
|
{
|
||||||
// Check if the offline check interval has been specified
|
// Check if the offline check interval has been specified
|
||||||
|
Reference in New Issue
Block a user