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:
Gary Spencer
2009-03-27 13:27:03 +00:00
parent 436f79cb78
commit 26d5c95982
10 changed files with 3099 additions and 2784 deletions

View File

@@ -4,42 +4,91 @@
<!-- add additional filesystems remove the replace="true" attribute --> <!-- add additional filesystems remove the replace="true" attribute -->
<config evaluator="string-compare" condition="Filesystems" replace="true"> <config evaluator="string-compare" condition="Filesystems" replace="true">
<filesystems>
<!-- Alfresco repository access shared filesystem -->
<filesystem name="${filesystem.name}">
<store>workspace://SpacesStore</store>
<rootPath>/app:company_home</rootPath>
<filesystems> <!-- Add a URL file to each folder that links back to the web client -->
<urlFile>
<!-- Default share --> <filename>__Alfresco.url</filename>
<filesystem name="Alfresco"> <webpath>http://${localname}:8080/alfresco/</webpath>
</urlFile>
<store>workspace://SpacesStore</store>
<rootPath>/app:company_home</rootPath> <!-- Mark locked files as offline -->
<offlineFiles/>
<!-- Enable Web client launch shortcut in all folders -->
<urlFile> <!-- Desktop actions -->
<!-- Uses a client-side application to trigger a server-side action -->
<!-- Change the filename as required, keeping the .url extension --> <!-- Echo - displays a message echoed from the server -->
<filename>_Alfresco.url</filename> <!-- URL - launches a URL via the Windows shell -->
<!-- CmdLine - launches the Notepad application -->
<!-- Change 'localhost' to the name or IP of the Alfresco server --> <!-- CheckInOut - checks files in/out, drag and drop files onto the application -->
<webpath>http://localhost:8080/alfresco/</webpath> <!-- JavaScript - run a server-side script -->
<!-- JavaScriptURL - server-side script that generates a URL to the folder using a ticket -->
</urlFile> <!-- to avoid having to logon -->
</filesystem> <desktopActions>
<global>
<path>alfresco/desktop/Alfresco.exe</path>
<webpath>http://${localname}:8080/alfresco/</webpath>
</global>
<action>
<class>org.alfresco.filesys.repo.desk.CheckInOutDesktopAction</class>
<name>CheckInOut</name>
<filename>__CheckInOut.exe</filename>
</action>
<action>
<class>org.alfresco.filesys.repo.desk.JavaScriptDesktopAction</class>
<name>JavaScriptURL</name>
<filename>__ShowDetails.exe</filename>
<script>alfresco/desktop/showDetails.js</script>
<attributes>anyFiles</attributes>
<preprocess>copyToTarget</preprocess>
</action>
<action>
<class>org.alfresco.filesys.repo.desk.EchoDesktopAction</class>
<name>Echo</name>
<filename>__AlfrescoEcho.exe</filename>
</action>
<action>
<class>org.alfresco.filesys.repo.desk.URLDesktopAction</class>
<name>URL</name>
<filename>__AlfrescoURL.exe</filename>
</action>
<action>
<class>org.alfresco.filesys.repo.desk.CmdLineDesktopAction</class>
<name>CmdLine</name>
<filename>__AlfrescoCmd.exe</filename>
</action>
<action>
<class>org.alfresco.filesys.repo.desk.JavaScriptDesktopAction</class>
<name>JavaScript</name>
<filename>__AlfrescoScript.exe</filename>
<script>alfresco/desktop/dumpRequest.js</script>
<attributes>anyFiles, multiplePaths , allowNoParams</attributes>
<preprocess>confirm, copyToTarget</preprocess>
</action>
</desktopActions>
<!-- Additional access control of the filesystem -->
<!-- Access type of 'none' will stop the filesystem from showing up for that user/address/protocol -->
<!--
<accessControl default="Write">
<user name="admin" access="Write"/>
<address subnet="192.168.1.0" mask="255.255.255.0" access="Write"/>
</accessControl>
-->
</filesystem>
<!-- AVM virtualization view of all stores/versions for WCM -->
<!-- virtual view can be any of the following: normal, site, staging, author, preview -->
<avmfilesystem name="AVM">
<virtualView stores="site,staging,author"/>
</avmfilesystem>
</filesystems> </filesystems>
</config> </config>
<!-- Allow guest access to file systems -->
<config evaluator="string-compare" condition="Filesystem Security">
<authenticator type="alfresco">
<allowGuest/>
<!-- Map any unknown user to guest -->
<!--
<mapUnknownUserToGuest/>
-->
</authenticator>
</config>
</alfresco-config> </alfresco-config>

View File

@@ -86,6 +86,7 @@
<property name="serviceRegistry"><ref bean="ServiceRegistry"/></property> <property name="serviceRegistry"><ref bean="ServiceRegistry"/></property>
<property name="stateReaper"><ref bean="fileStateReaper"/></property> <property name="stateReaper"><ref bean="fileStateReaper"/></property>
<property name="nodeMonitorFactory"><ref bean="nodeMonitorFactory"/></property> <property name="nodeMonitorFactory"><ref bean="nodeMonitorFactory"/></property>
<property name="nodeArchiveService"><ref bean="nodeArchiveService" /></property>
</bean> </bean>
<bean id="nodeMonitorFactory" class="org.alfresco.filesys.repo.NodeMonitorFactory"> <bean id="nodeMonitorFactory" class="org.alfresco.filesys.repo.NodeMonitorFactory">

View File

@@ -192,6 +192,10 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
private static final int MemoryPoolMinimumAllocation = 5; private static final int MemoryPoolMinimumAllocation = 5;
private static final int MemoryPoolMaximumAllocation = 500; private static final int MemoryPoolMaximumAllocation = 500;
// Maximum session timeout
private static final int MaxSessionTimeout = 60 * 60; // 1 hour
// Authentication manager // Authentication manager
private AuthenticationManager m_authenticationManager; private AuthenticationManager m_authenticationManager;
@@ -935,31 +939,46 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
elem = config.getConfigElement("hostAnnounce"); elem = config.getConfigElement("hostAnnounce");
if (elem != null) if (elem != null)
{ {
// Check if the host announcer has been disabled
// Check for an announcement interval
String enabled = elem.getAttribute("enabled");
String interval = elem.getAttribute("interval"); if ( enabled != null && enabled.equalsIgnoreCase( "false"))
if (interval != null && interval.length() > 0)
{ {
try // Switch off the host announcer
{
cifsConfig.setHostAnnounceInterval(Integer.parseInt(interval)); cifsConfig.setHostAnnouncer( false);
}
catch (NumberFormatException ex) // Log that host announcements are not enabled
{
throw new AlfrescoRuntimeException("Invalid host announcement interval"); 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 // Check if NetBIOS SMB is enabled
@@ -1260,19 +1279,41 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
cifsConfig.setTcpipSMB(platformOK); cifsConfig.setTcpipSMB(platformOK);
// Check if the port has been specified // Check if the port has been specified
String portNum = elem.getAttribute("port"); String portNum = elem.getAttribute("port");
if ( portNum != null && portNum.length() > 0) { if ( portNum != null && portNum.length() > 0) {
try { try {
cifsConfig.setTcpipSMBPort(Integer.parseInt(portNum)); cifsConfig.setTcpipSMBPort(Integer.parseInt(portNum));
if ( cifsConfig.getTcpipSMBPort() <= 0 || cifsConfig.getTcpipSMBPort() >= 65535) if ( cifsConfig.getTcpipSMBPort() <= 0 || cifsConfig.getTcpipSMBPort() >= 65535)
throw new AlfrescoRuntimeException("TCP/IP SMB port out of valid range"); throw new AlfrescoRuntimeException("TCP/IP SMB port out of valid range");
} }
catch (NumberFormatException ex) { catch (NumberFormatException ex) {
throw new AlfrescoRuntimeException("Invalid TCP/IP SMB port"); 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 else
{ {
@@ -1428,31 +1469,46 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
elem = config.getConfigElement("Win32Announce"); elem = config.getConfigElement("Win32Announce");
if (elem != null) if (elem != null)
{ {
// Check if the Win32 host announcer has been disabled
// Check for an announcement interval
String enabled = elem.getAttribute("enabled");
String interval = elem.getAttribute("interval"); if ( enabled != null && enabled.equalsIgnoreCase( "false"))
if (interval != null && interval.length() > 0)
{ {
try // Switch off the Win32 host announcer
{
cifsConfig.setWin32HostAnnounceInterval(Integer.parseInt(interval)); cifsConfig.setWin32HostAnnouncer( false);
}
catch (NumberFormatException ex) // Log that host announcements are not enabled
{
throw new AlfrescoRuntimeException("Invalid host announcement interval"); 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 // 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()) if ( logger.isDebugEnabled())
logger.debug("NIO based code disabled for CIFS server"); 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) catch ( InvalidConfigurationException ex)
{ {
@@ -3044,7 +3129,7 @@ public class ServerConfigurationBean extends ServerConfiguration implements Appl
String domainName = null; String domainName = null;
if (getPlatformType() == Platform.Type.WINDOWS && isNativeCodeDisabled()) if (getPlatformType() == Platform.Type.WINDOWS && isNativeCodeDisabled() == false)
{ {
// Get the local domain/workgroup name via JNI // Get the local domain/workgroup name via JNI

View File

@@ -398,7 +398,7 @@ public class AlfrescoCifsAuthenticator extends CifsAuthenticatorBase
// Logging // Logging
if ( logger.isInfoEnabled()) 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 // Set the current user to be authenticated, save the authentication token

View File

@@ -92,6 +92,9 @@ public class PassthruCifsAuthenticator extends CifsAuthenticatorBase implements
public final static int MinSessionTmo = 2000; // 2 seconds public final static int MinSessionTmo = 2000; // 2 seconds
public final static int MaxSessionTmo = 30000; // 30 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 // Passthru keep alive interval
public final static long PassthruKeepAliveInterval = 60000L; // 60 seconds public final static long PassthruKeepAliveInterval = 60000L; // 60 seconds
@@ -1155,9 +1158,42 @@ public class PassthruCifsAuthenticator extends CifsAuthenticatorBase implements
super.initialize(config, params); 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 // Propagate the debug setting

View File

@@ -36,10 +36,8 @@ import net.sf.acegisecurity.Authentication;
import org.alfresco.config.ConfigElement; import org.alfresco.config.ConfigElement;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.AlfrescoConfigSection;
import org.alfresco.filesys.ServerConfigurationBean; import org.alfresco.filesys.ServerConfigurationBean;
import org.alfresco.filesys.alfresco.AlfrescoClientInfo; import org.alfresco.filesys.alfresco.AlfrescoClientInfo;
import org.alfresco.jlan.ftp.FTPAuthenticator;
import org.alfresco.jlan.ftp.FTPSrvSession; import org.alfresco.jlan.ftp.FTPSrvSession;
import org.alfresco.jlan.server.SrvSession; import org.alfresco.jlan.server.SrvSession;
import org.alfresco.jlan.server.auth.ClientInfo; 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.server.config.ServerConfiguration;
import org.alfresco.jlan.smb.Protocol; import org.alfresco.jlan.smb.Protocol;
import org.alfresco.jlan.util.IPAddress; 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 * 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 MinSessionTmo = 2000; // 2 seconds
public final static int MaxSessionTmo = 30000; // 30 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 // Passthru keep alive interval
public final static long PassthruKeepAliveInterval = 60000L; // 60 seconds public final static long PassthruKeepAliveInterval = 60000L; // 60 seconds
@@ -108,10 +104,43 @@ public class PassthruFtpAuthenticator extends FTPAuthenticatorBase {
m_passwordEncryptor = new PasswordEncryptor(); m_passwordEncryptor = new PasswordEncryptor();
// 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();
}
// Check if the session timeout has been specified // Check if the session timeout has been specified
ConfigElement sessTmoElem = params.getChild("Timeout"); ConfigElement sessTmoElem = params.getChild("Timeout");

File diff suppressed because it is too large Load Diff

View File

@@ -57,7 +57,7 @@ public class FileState
// File status // File status
public enum FileStateStatus { NotExist, FileExists, FolderExists, Renamed }; public enum FileStateStatus { NotExist, FileExists, FolderExists, Renamed, DeleteOnClose };
// File name/path // File name/path

View File

@@ -32,6 +32,7 @@ import org.alfresco.jlan.locking.NotLockedException;
import org.alfresco.jlan.server.SrvSession; import org.alfresco.jlan.server.SrvSession;
import org.alfresco.jlan.server.filesys.NetworkFile; import org.alfresco.jlan.server.filesys.NetworkFile;
import org.alfresco.jlan.server.filesys.TreeConnection; 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.jlan.server.locking.LockManager;
import org.alfresco.filesys.alfresco.AlfrescoNetworkFile; import org.alfresco.filesys.alfresco.AlfrescoNetworkFile;
@@ -65,6 +66,10 @@ public class FileStateLockManager implements LockManager {
AlfrescoNetworkFile alfFile = (AlfrescoNetworkFile) file; AlfrescoNetworkFile alfFile = (AlfrescoNetworkFile) file;
fstate = alfFile.getFileState(); fstate = alfFile.getFileState();
} }
else if ( file instanceof MemoryNetworkFile) {
file.addLock(lock);
return;
}
if ( fstate == null) if ( fstate == null)
throw new IOException("Open file without state (lock)"); 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 // Get the file state associated with the file
FileState fstate = null; FileState fstate = null;
if ( file instanceof AlfrescoNetworkFile) { if ( file instanceof AlfrescoNetworkFile) {
AlfrescoNetworkFile alfFile = (AlfrescoNetworkFile) file; AlfrescoNetworkFile alfFile = (AlfrescoNetworkFile) file;
fstate = alfFile.getFileState(); fstate = alfFile.getFileState();
} }
else if ( file instanceof MemoryNetworkFile) {
file.removeLock(lock);
return;
}
if ( fstate == null) if ( fstate == null)
throw new IOException("Open file without state (unlock)"); throw new IOException("Open file without state (unlock)");