mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merge 3.1 to HEAD:
13314: Fix for CIFS offline sync, reconnect updated file to properties/history. ETHREEOH-1247. 13334: Added attribute to allow CIFS host announcement to be switched off via custom config. ETHREEOH-1356. Fixed bug in Windows domain name config. 13335: Changed error message to warning, and removed stacktrace, when resolving the server name. 13336: Renamed file-servers-custom.xml out of the way, to .sample2. Seems to be from an Adobe merge. 13377: Hack to enable basic CIFS IPv6 support, enabled via <tcpipSMB ipv6="enabled"/> in the xml config file. 13399: Fixed confusing debug message. 13431: Added missing parsing of 'offlineCheckInterval' parameter. 13457: Added support for file locking on in-memory pseudo files. Fix for problem with __AlfrescoClient.url files ETHREEOH-1311 13485: Added the missing CIFS sessionTimeout config value parsing. 13521: Updated file-servers.xml default config to match previous file-servers-custom.xml settings git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13762 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -192,6 +192,10 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
|
||||
private static final int MemoryPoolMinimumAllocation = 5;
|
||||
private static final int MemoryPoolMaximumAllocation = 500;
|
||||
|
||||
// Maximum session timeout
|
||||
|
||||
private static final int MaxSessionTimeout = 60 * 60; // 1 hour
|
||||
|
||||
// Authentication manager
|
||||
|
||||
private AuthenticationManager m_authenticationManager;
|
||||
@@ -935,31 +939,46 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
|
||||
elem = config.getConfigElement("hostAnnounce");
|
||||
if (elem != null)
|
||||
{
|
||||
|
||||
// Check for an announcement interval
|
||||
|
||||
String interval = elem.getAttribute("interval");
|
||||
if (interval != null && interval.length() > 0)
|
||||
// Check if the host announcer has been disabled
|
||||
|
||||
String enabled = elem.getAttribute("enabled");
|
||||
if ( enabled != null && enabled.equalsIgnoreCase( "false"))
|
||||
{
|
||||
try
|
||||
{
|
||||
cifsConfig.setHostAnnounceInterval(Integer.parseInt(interval));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid host announcement interval");
|
||||
}
|
||||
// Switch off the host announcer
|
||||
|
||||
cifsConfig.setHostAnnouncer( false);
|
||||
|
||||
// Log that host announcements are not enabled
|
||||
|
||||
logger.info("Host announcements not enabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check for an announcement interval
|
||||
|
||||
String interval = elem.getAttribute("interval");
|
||||
if (interval != null && interval.length() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
cifsConfig.setHostAnnounceInterval(Integer.parseInt(interval));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid host announcement interval");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the domain name has been set, this is required if the
|
||||
// host announcer is enabled
|
||||
|
||||
if (cifsConfig.getDomainName() == null)
|
||||
throw new AlfrescoRuntimeException("Domain name must be specified if host announcement is enabled");
|
||||
|
||||
// Enable host announcement
|
||||
|
||||
cifsConfig.setHostAnnouncer(true);
|
||||
}
|
||||
|
||||
// Check if the domain name has been set, this is required if the
|
||||
// host announcer is enabled
|
||||
|
||||
if (cifsConfig.getDomainName() == null)
|
||||
throw new AlfrescoRuntimeException("Domain name must be specified if host announcement is enabled");
|
||||
|
||||
// Enable host announcement
|
||||
|
||||
cifsConfig.setHostAnnouncer(true);
|
||||
}
|
||||
|
||||
// Check if NetBIOS SMB is enabled
|
||||
@@ -1260,19 +1279,41 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
|
||||
|
||||
cifsConfig.setTcpipSMB(platformOK);
|
||||
|
||||
// Check if the port has been specified
|
||||
// Check if the port has been specified
|
||||
|
||||
String portNum = elem.getAttribute("port");
|
||||
if ( portNum != null && portNum.length() > 0) {
|
||||
try {
|
||||
cifsConfig.setTcpipSMBPort(Integer.parseInt(portNum));
|
||||
if ( cifsConfig.getTcpipSMBPort() <= 0 || cifsConfig.getTcpipSMBPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("TCP/IP SMB port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid TCP/IP SMB port");
|
||||
}
|
||||
}
|
||||
String portNum = elem.getAttribute("port");
|
||||
if ( portNum != null && portNum.length() > 0) {
|
||||
try {
|
||||
cifsConfig.setTcpipSMBPort(Integer.parseInt(portNum));
|
||||
if ( cifsConfig.getTcpipSMBPort() <= 0 || cifsConfig.getTcpipSMBPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("TCP/IP SMB port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid TCP/IP SMB port");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if IPv6 support should be enabled
|
||||
|
||||
String ipv6 = elem.getAttribute("ipv6");
|
||||
if ( ipv6 != null && ipv6.equalsIgnoreCase( "enabled"))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Use the IPv6 bind all address
|
||||
|
||||
cifsConfig.setSMBBindAddress( InetAddress.getByName( "::"));
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isInfoEnabled())
|
||||
logger.info("Enabled CIFS IPv6 bind address for native SMB");
|
||||
}
|
||||
catch ( UnknownHostException ex)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Failed to enable IPv6 bind address, " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1428,31 +1469,46 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
|
||||
elem = config.getConfigElement("Win32Announce");
|
||||
if (elem != null)
|
||||
{
|
||||
|
||||
// Check for an announcement interval
|
||||
|
||||
String interval = elem.getAttribute("interval");
|
||||
if (interval != null && interval.length() > 0)
|
||||
// Check if the Win32 host announcer has been disabled
|
||||
|
||||
String enabled = elem.getAttribute("enabled");
|
||||
if ( enabled != null && enabled.equalsIgnoreCase( "false"))
|
||||
{
|
||||
try
|
||||
{
|
||||
cifsConfig.setWin32HostAnnounceInterval(Integer.parseInt(interval));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid host announcement interval");
|
||||
}
|
||||
// Switch off the Win32 host announcer
|
||||
|
||||
cifsConfig.setWin32HostAnnouncer( false);
|
||||
|
||||
// Log that host announcements are not enabled
|
||||
|
||||
logger.info("Win32 host announcements not enabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check for an announcement interval
|
||||
|
||||
String interval = elem.getAttribute("interval");
|
||||
if (interval != null && interval.length() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
cifsConfig.setWin32HostAnnounceInterval(Integer.parseInt(interval));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Invalid host announcement interval");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the domain name has been set, this is required if the
|
||||
// host announcer is enabled
|
||||
|
||||
if (cifsConfig.getDomainName() == null)
|
||||
throw new AlfrescoRuntimeException("Domain name must be specified if host announcement is enabled");
|
||||
|
||||
// Enable Win32 NetBIOS host announcement
|
||||
|
||||
cifsConfig.setWin32HostAnnouncer(true);
|
||||
}
|
||||
|
||||
// Check if the domain name has been set, this is required if the
|
||||
// host announcer is enabled
|
||||
|
||||
if (cifsConfig.getDomainName() == null)
|
||||
throw new AlfrescoRuntimeException("Domain name must be specified if host announcement is enabled");
|
||||
|
||||
// Enable Win32 NetBIOS host announcement
|
||||
|
||||
cifsConfig.setWin32HostAnnouncer(true);
|
||||
}
|
||||
|
||||
// Check if NetBIOS and/or TCP/IP SMB have been enabled
|
||||
@@ -1626,6 +1682,35 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("NIO based code disabled for CIFS server");
|
||||
}
|
||||
|
||||
// Check if a session timeout is configured
|
||||
|
||||
elem = config.getConfigElement("sessionTimeout");
|
||||
if ( elem != null) {
|
||||
|
||||
// Validate the session timeout value
|
||||
|
||||
String sessTmo = elem.getValue();
|
||||
if ( sessTmo != null && sessTmo.length() > 0) {
|
||||
try {
|
||||
|
||||
// Convert the timeout value to milliseconds
|
||||
|
||||
int tmo = Integer.parseInt(sessTmo);
|
||||
if ( tmo < 0 || tmo > MaxSessionTimeout)
|
||||
throw new AlfrescoRuntimeException("Session timeout out of range (0 - " + MaxSessionTimeout + ")");
|
||||
|
||||
// Convert the session timeout to milliseconds
|
||||
|
||||
cifsConfig.setSocketTimeout( tmo * 1000);
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid session timeout value, " + sessTmo);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new AlfrescoRuntimeException("Session timeout value not specified");
|
||||
}
|
||||
}
|
||||
catch ( InvalidConfigurationException ex)
|
||||
{
|
||||
@@ -3044,7 +3129,7 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
|
||||
|
||||
String domainName = null;
|
||||
|
||||
if (getPlatformType() == Platform.Type.WINDOWS && isNativeCodeDisabled())
|
||||
if (getPlatformType() == Platform.Type.WINDOWS && isNativeCodeDisabled() == false)
|
||||
{
|
||||
// Get the local domain/workgroup name via JNI
|
||||
|
||||
|
@@ -398,7 +398,7 @@ public class AlfrescoCifsAuthenticator extends CifsAuthenticatorBase
|
||||
// Logging
|
||||
|
||||
if ( logger.isInfoEnabled())
|
||||
logger.info( "Logged on user " + client.getUserName() + " (" + sess.getRemoteAddress() + ") using auto-logon shared password");
|
||||
logger.info( "Logged on user " + client.getUserName() + " (" + sess.getRemoteAddress() + ")");
|
||||
|
||||
// Set the current user to be authenticated, save the authentication token
|
||||
|
||||
|
@@ -92,6 +92,9 @@ public class PassthruCifsAuthenticator extends CifsAuthenticatorBase implements
|
||||
public final static int MinSessionTmo = 2000; // 2 seconds
|
||||
public final static int MaxSessionTmo = 30000; // 30 seconds
|
||||
|
||||
public final static int MinCheckInterval = 10; // 10 seconds
|
||||
public final static int MaxCheckInterval = 15 * 60; // 15 minutes
|
||||
|
||||
// Passthru keep alive interval
|
||||
|
||||
public final static long PassthruKeepAliveInterval = 60000L; // 60 seconds
|
||||
@@ -1155,9 +1158,42 @@ public class PassthruCifsAuthenticator extends CifsAuthenticatorBase implements
|
||||
|
||||
super.initialize(config, params);
|
||||
|
||||
// Create the passthru authentication server list
|
||||
// Check if the offline check interval has been specified
|
||||
|
||||
m_passthruServers = new PassthruServers();
|
||||
ConfigElement checkInterval = params.getChild("offlineCheckInterval");
|
||||
if ( checkInterval != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Validate the check interval value
|
||||
|
||||
int offlineCheck = Integer.parseInt(checkInterval.getValue());
|
||||
|
||||
// Range check the value
|
||||
|
||||
if ( offlineCheck < MinCheckInterval || offlineCheck > MaxCheckInterval)
|
||||
throw new InvalidConfigurationException("Invalid offline check interval, valid range is " + MinCheckInterval + " to " + MaxCheckInterval);
|
||||
|
||||
// Set the offline check interval for offline passthru servers
|
||||
|
||||
m_passthruServers = new PassthruServers( offlineCheck);
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Using offline check interval of " + offlineCheck + " seconds");
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new InvalidConfigurationException("Invalid offline check interval specified");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create the passthru server list with the default offline check interval
|
||||
|
||||
m_passthruServers = new PassthruServers();
|
||||
}
|
||||
|
||||
// Propagate the debug setting
|
||||
|
||||
|
@@ -36,10 +36,8 @@ import net.sf.acegisecurity.Authentication;
|
||||
|
||||
import org.alfresco.config.ConfigElement;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.filesys.AlfrescoConfigSection;
|
||||
import org.alfresco.filesys.ServerConfigurationBean;
|
||||
import org.alfresco.filesys.alfresco.AlfrescoClientInfo;
|
||||
import org.alfresco.jlan.ftp.FTPAuthenticator;
|
||||
import org.alfresco.jlan.ftp.FTPSrvSession;
|
||||
import org.alfresco.jlan.server.SrvSession;
|
||||
import org.alfresco.jlan.server.auth.ClientInfo;
|
||||
@@ -53,11 +51,6 @@ import org.alfresco.jlan.server.config.SecurityConfigSection;
|
||||
import org.alfresco.jlan.server.config.ServerConfiguration;
|
||||
import org.alfresco.jlan.smb.Protocol;
|
||||
import org.alfresco.jlan.util.IPAddress;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Passthru FTP Authenticator Class
|
||||
@@ -72,6 +65,9 @@ public class PassthruFtpAuthenticator extends FTPAuthenticatorBase {
|
||||
public final static int MinSessionTmo = 2000; // 2 seconds
|
||||
public final static int MaxSessionTmo = 30000; // 30 seconds
|
||||
|
||||
public final static int MinCheckInterval = 10; // 10 seconds
|
||||
public final static int MaxCheckInterval = 15 * 60; // 15 minutes
|
||||
|
||||
// Passthru keep alive interval
|
||||
|
||||
public final static long PassthruKeepAliveInterval = 60000L; // 60 seconds
|
||||
@@ -108,10 +104,43 @@ public class PassthruFtpAuthenticator extends FTPAuthenticatorBase {
|
||||
|
||||
m_passwordEncryptor = new PasswordEncryptor();
|
||||
|
||||
// Create the passthru authentication server list
|
||||
|
||||
m_passthruServers = new PassthruServers();
|
||||
// Check if the offline check interval has been specified
|
||||
|
||||
ConfigElement checkInterval = params.getChild("offlineCheckInterval");
|
||||
if ( checkInterval != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Validate the check interval value
|
||||
|
||||
int offlineCheck = Integer.parseInt(checkInterval.getValue());
|
||||
|
||||
// Range check the value
|
||||
|
||||
if ( offlineCheck < MinCheckInterval || offlineCheck > MaxCheckInterval)
|
||||
throw new InvalidConfigurationException("Invalid offline check interval, valid range is " + MinCheckInterval + " to " + MaxCheckInterval);
|
||||
|
||||
// Set the offline check interval for offline passthru servers
|
||||
|
||||
m_passthruServers = new PassthruServers( offlineCheck);
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Using offline check interval of " + offlineCheck + " seconds");
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new InvalidConfigurationException("Invalid offline check interval specified");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create the passthru server list with the default offline check interval
|
||||
|
||||
m_passthruServers = new PassthruServers();
|
||||
}
|
||||
|
||||
// Check if the session timeout has been specified
|
||||
|
||||
ConfigElement sessTmoElem = params.getChild("Timeout");
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,7 @@ public class FileState
|
||||
|
||||
// File status
|
||||
|
||||
public enum FileStateStatus { NotExist, FileExists, FolderExists, Renamed };
|
||||
public enum FileStateStatus { NotExist, FileExists, FolderExists, Renamed, DeleteOnClose };
|
||||
|
||||
// File name/path
|
||||
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.jlan.locking.NotLockedException;
|
||||
import org.alfresco.jlan.server.SrvSession;
|
||||
import org.alfresco.jlan.server.filesys.NetworkFile;
|
||||
import org.alfresco.jlan.server.filesys.TreeConnection;
|
||||
import org.alfresco.jlan.server.filesys.pseudo.MemoryNetworkFile;
|
||||
import org.alfresco.jlan.server.locking.LockManager;
|
||||
import org.alfresco.filesys.alfresco.AlfrescoNetworkFile;
|
||||
|
||||
@@ -65,6 +66,10 @@ public class FileStateLockManager implements LockManager {
|
||||
AlfrescoNetworkFile alfFile = (AlfrescoNetworkFile) file;
|
||||
fstate = alfFile.getFileState();
|
||||
}
|
||||
else if ( file instanceof MemoryNetworkFile) {
|
||||
file.addLock(lock);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( fstate == null)
|
||||
throw new IOException("Open file without state (lock)");
|
||||
@@ -92,12 +97,16 @@ public class FileStateLockManager implements LockManager {
|
||||
|
||||
// Get the file state associated with the file
|
||||
|
||||
FileState fstate = null;
|
||||
FileState fstate = null;
|
||||
|
||||
if ( file instanceof AlfrescoNetworkFile) {
|
||||
AlfrescoNetworkFile alfFile = (AlfrescoNetworkFile) file;
|
||||
fstate = alfFile.getFileState();
|
||||
}
|
||||
if ( file instanceof AlfrescoNetworkFile) {
|
||||
AlfrescoNetworkFile alfFile = (AlfrescoNetworkFile) file;
|
||||
fstate = alfFile.getFileState();
|
||||
}
|
||||
else if ( file instanceof MemoryNetworkFile) {
|
||||
file.removeLock(lock);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( fstate == null)
|
||||
throw new IOException("Open file without state (unlock)");
|
||||
|
Reference in New Issue
Block a user