mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge 3.2 to HEAD:
18450: Port of FTP data port configuration values. ETHREEOH-4103. 18559: NFS fixes, NFS/FTP/CIFS config properties. ETHREEOH-4102, ETHREEOH-4101, ETHREEOH-4104 (partial) 18642: Do not allow null NFS authentication type, core NFS/mount server code now allows null requests with null authentication type. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18654 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -96,8 +96,8 @@ public abstract class AbstractServerConfigurationBean extends ServerConfiguratio
|
||||
|
||||
// FTP server debug type strings
|
||||
|
||||
protected static final String m_ftpDebugStr[] = { "STATE", "SEARCH", "INFO", "FILE", "FILEIO", "ERROR", "PKTTYPE",
|
||||
"TIMING", "DATAPORT", "DIRECTORY" };
|
||||
protected static final String m_ftpDebugStr[] = { "STATE", "RXDATA", "TXDATA", "DUMPDATA", "SEARCH", "INFO", "FILE", "FILEIO", "ERROR", "PKTTYPE",
|
||||
"TIMING", "DATAPORT", "DIRECTORY" };
|
||||
|
||||
// Default FTP server port
|
||||
|
||||
|
@@ -1508,7 +1508,80 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean {
|
||||
}
|
||||
else
|
||||
throw new AlfrescoRuntimeException("FTP authenticator not specified");
|
||||
|
||||
|
||||
// Check if a data port range has been specified
|
||||
|
||||
elem = config.getConfigElement("dataPorts");
|
||||
if ( elem != null) {
|
||||
|
||||
// Split the value string into from and to range strings
|
||||
|
||||
StringTokenizer tok = new StringTokenizer( elem.getValue(), ":");
|
||||
if ( tok.countTokens() != 2)
|
||||
throw new InvalidConfigurationException( "Invalid FTP data port range, specify as 'n:n'");
|
||||
|
||||
String rangeFromStr = tok.nextToken();
|
||||
String rangeToStr = tok.nextToken();
|
||||
|
||||
// Validate the from/to data port range values
|
||||
|
||||
int rangeFrom = -1;
|
||||
int rangeTo = -1;
|
||||
|
||||
if ( rangeFromStr != null && rangeFromStr.length() > 0) {
|
||||
|
||||
// Validate the range string
|
||||
|
||||
try {
|
||||
rangeFrom = Integer.parseInt(rangeFromStr);
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new InvalidConfigurationException("Invalid FTP range from value, " + rangeFromStr);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for the to port range value
|
||||
|
||||
if ( rangeToStr != null && rangeToStr.length() > 0) {
|
||||
|
||||
// Validate the range string
|
||||
|
||||
try {
|
||||
rangeTo = Integer.parseInt(rangeToStr);
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new InvalidConfigurationException("Invalid FTP range to value, " + rangeToStr);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate the data port range values
|
||||
|
||||
if ( rangeFrom != 0 && rangeTo != 0) {
|
||||
|
||||
// Validate the FTp data port range
|
||||
|
||||
if ( rangeFrom == -1 || rangeTo == -1)
|
||||
throw new InvalidConfigurationException("FTP data port range from/to must be specified");
|
||||
|
||||
if ( rangeFrom < 1024 || rangeFrom > 65535)
|
||||
throw new InvalidConfigurationException("Invalid FTP data port range from value, " + rangeFrom);
|
||||
|
||||
if ( rangeTo < 1024 || rangeTo > 65535)
|
||||
throw new InvalidConfigurationException("Invalid FTP data port range to value, " + rangeTo);
|
||||
|
||||
if ( rangeFrom >= rangeTo)
|
||||
throw new InvalidConfigurationException("Invalid FTP data port range, " + rangeFrom + "-" + rangeTo);
|
||||
|
||||
// Set the FTP data port range
|
||||
|
||||
ftpConfig.setFTPDataPortLow(rangeFrom);
|
||||
ftpConfig.setFTPDataPortHigh(rangeTo);
|
||||
|
||||
// Log the data port range
|
||||
|
||||
logger.info("FTP server data ports restricted to range " + rangeFrom + ":" + rangeTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidConfigurationException ex)
|
||||
{
|
||||
|
@@ -63,7 +63,7 @@ public class AlfrescoRpcAuthenticator implements RpcAuthenticator, InitializingB
|
||||
|
||||
private static final Log logger = LogFactory.getLog("org.alfresco.nfs.protocol.auth");
|
||||
|
||||
// Authentication types aupported by this implementation
|
||||
// Authentication types supported by this implementation
|
||||
|
||||
private int[] _authTypes = { AuthType.Unix };
|
||||
|
||||
@@ -136,18 +136,7 @@ public class AlfrescoRpcAuthenticator implements RpcAuthenticator, InitializingB
|
||||
|
||||
sessKey = new Long((((long) rpc.getClientAddress().hashCode()) << 32) + (gid << 16) + uid);
|
||||
}
|
||||
else if ( authType == AuthType.Null)
|
||||
{
|
||||
// Set the session key for the null authentication
|
||||
|
||||
sessKey = new Integer(rpc.getClientAddress().hashCode());
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug( "RpcAuth: Type=Null client=" + rpc.getClientAddress());
|
||||
}
|
||||
|
||||
|
||||
// Check if the session key is valid, if not then the authentication
|
||||
// type is unsupported
|
||||
|
||||
@@ -516,7 +505,7 @@ public class AlfrescoRpcAuthenticator implements RpcAuthenticator, InitializingB
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a transaction, this will be a wrteable transaction unless the system is in read-only mode.
|
||||
* Create a transaction, this will be a writable transaction unless the system is in read-only mode.
|
||||
*
|
||||
* return UserTransaction
|
||||
*/
|
||||
|
@@ -65,6 +65,11 @@ public class FTPConfigBean
|
||||
/** Is IP v6 enabled? */
|
||||
private boolean ipv6Enabled;
|
||||
|
||||
// Data port range
|
||||
|
||||
private int dataPortFrom;
|
||||
private int dataPortTo;
|
||||
|
||||
/**
|
||||
* Checks if is server enabled.
|
||||
*
|
||||
@@ -274,4 +279,40 @@ public class FTPConfigBean
|
||||
{
|
||||
this.ipv6Enabled = ipv6Enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the data port range from port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int getDataPortFrom() {
|
||||
return dataPortFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data port range from port
|
||||
*
|
||||
* @param fromPort int
|
||||
*/
|
||||
public void setDataPortFrom(int fromPort) {
|
||||
dataPortFrom = fromPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the data port to range port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int getDataPortTo() {
|
||||
return dataPortTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data port range to port
|
||||
*
|
||||
* @param toPort int
|
||||
*/
|
||||
public void setDataPortTo(int toPort) {
|
||||
dataPortTo = toPort;
|
||||
}
|
||||
}
|
||||
|
@@ -199,7 +199,7 @@ public class NFSConfigBean
|
||||
*
|
||||
* @return the nFS server port
|
||||
*/
|
||||
public Integer getNFSServerPort()
|
||||
public Integer getNfsServerPort()
|
||||
{
|
||||
return NFSServerPort;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ public class NFSConfigBean
|
||||
* @param serverPort
|
||||
* the new nFS server port
|
||||
*/
|
||||
public void setNFSServerPort(Integer serverPort)
|
||||
public void setNfsServerPort(Integer serverPort)
|
||||
{
|
||||
NFSServerPort = serverPort;
|
||||
}
|
||||
|
@@ -1304,6 +1304,38 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean
|
||||
else
|
||||
throw new AlfrescoRuntimeException("FTP authenticator not specified");
|
||||
|
||||
// Check if a data port range has been specified
|
||||
|
||||
if ( ftpConfigBean.getDataPortFrom() != 0 && ftpConfigBean.getDataPortTo() != 0) {
|
||||
|
||||
// Range check the data port values
|
||||
|
||||
int rangeFrom = ftpConfigBean.getDataPortFrom();
|
||||
int rangeTo = ftpConfigBean.getDataPortTo();
|
||||
|
||||
if ( rangeFrom != 0 && rangeTo != 0) {
|
||||
|
||||
// Validate the FTP data port range
|
||||
|
||||
if ( rangeFrom < 1024 || rangeFrom > 65535)
|
||||
throw new InvalidConfigurationException("Invalid FTP data port range from value, " + rangeFrom);
|
||||
|
||||
if ( rangeTo < 1024 || rangeTo > 65535)
|
||||
throw new InvalidConfigurationException("Invalid FTP data port range to value, " + rangeTo);
|
||||
|
||||
if ( rangeFrom >= rangeTo)
|
||||
throw new InvalidConfigurationException("Invalid FTP data port range, " + rangeFrom + "-" + rangeTo);
|
||||
|
||||
// Set the FTP data port range
|
||||
|
||||
ftpConfig.setFTPDataPortLow(rangeFrom);
|
||||
ftpConfig.setFTPDataPortHigh(rangeTo);
|
||||
|
||||
// Log the data port range
|
||||
|
||||
logger.info("FTP server data ports restricted to range " + rangeFrom + ":" + rangeTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidConfigurationException ex)
|
||||
{
|
||||
@@ -1386,8 +1418,13 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean
|
||||
if (portMapperPort != null)
|
||||
{
|
||||
nfsConfig.setPortMapperPort(portMapperPort);
|
||||
if (nfsConfig.getPortMapperPort() <= 0 || nfsConfig.getPortMapperPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("Port mapper server port out of valid range");
|
||||
if ( nfsConfig.getPortMapperPort() == -1) {
|
||||
logger.info("NFS portmapper registration disabled");
|
||||
}
|
||||
else {
|
||||
if (nfsConfig.getPortMapperPort() <= 0 || nfsConfig.getPortMapperPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("Port mapper server port out of valid range");
|
||||
}
|
||||
}
|
||||
|
||||
// Check for a mount server port
|
||||
@@ -1396,17 +1433,17 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean
|
||||
if (mountServerPort != null)
|
||||
{
|
||||
nfsConfig.setMountServerPort(mountServerPort);
|
||||
if (nfsConfig.getMountServerPort() <= 0 || nfsConfig.getMountServerPort() >= 65535)
|
||||
if (nfsConfig.getMountServerPort() < 0 || nfsConfig.getMountServerPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("Mount server port out of valid range");
|
||||
}
|
||||
|
||||
// Check for an NFS server port
|
||||
|
||||
Integer nfsServerPort = nfsConfigBean.getNFSServerPort();
|
||||
Integer nfsServerPort = nfsConfigBean.getNfsServerPort();
|
||||
if (nfsServerPort != null)
|
||||
{
|
||||
nfsConfig.setNFSServerPort(nfsServerPort);
|
||||
if (nfsConfig.getNFSServerPort() <= 0 || nfsConfig.getNFSServerPort() >= 65535)
|
||||
if (nfsConfig.getNFSServerPort() < 0 || nfsConfig.getNFSServerPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("NFS server port out of valid range");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user