mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V1.3 to HEAD (3117:3125)
svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3117 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3125 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3402 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -50,10 +50,6 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
|
||||
// Session Thread group
|
||||
private static final ThreadGroup THREAD_GROUP_SESSION = new ThreadGroup("FTP_SESSION_GROUP");
|
||||
|
||||
// Server version
|
||||
|
||||
private static final String ServerVersion = "3.5.0";
|
||||
|
||||
// Listen backlog for the server socket
|
||||
|
||||
protected static final int LISTEN_BACKLOG = 10;
|
||||
@@ -100,10 +96,6 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
|
||||
{
|
||||
super("FTP", config);
|
||||
|
||||
// Set the server version
|
||||
|
||||
setVersion(ServerVersion);
|
||||
|
||||
// Allocate the session lists
|
||||
|
||||
m_sessions = new FTPSessionList();
|
||||
@@ -365,7 +357,6 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
|
||||
if (logger.isDebugEnabled() && hasDebug())
|
||||
{
|
||||
logger.debug("FTP Server starting on port " + getPort());
|
||||
logger.debug("Version " + isVersion());
|
||||
}
|
||||
|
||||
// Create a server socket to listen for incoming FTP session requests
|
||||
|
@@ -412,7 +412,7 @@ public class NetBIOSNameServer extends NetworkServer implements Runnable
|
||||
|
||||
// Allocate the datagram packet, using the add name buffer
|
||||
|
||||
DatagramPacket pkt = new DatagramPacket(buf, len, dest, getPort());
|
||||
DatagramPacket pkt = new DatagramPacket(buf, len, dest, RFCNetBIOSProtocol.NAME_PORT);
|
||||
|
||||
// Send the add name request
|
||||
|
||||
@@ -469,7 +469,7 @@ public class NetBIOSNameServer extends NetworkServer implements Runnable
|
||||
|
||||
// Allocate the datagram packet, using the refresh name buffer
|
||||
|
||||
DatagramPacket pkt = new DatagramPacket(buf, len, dest, getPort());
|
||||
DatagramPacket pkt = new DatagramPacket(buf, len, dest, RFCNetBIOSProtocol.NAME_PORT);
|
||||
|
||||
// Send the refresh name request
|
||||
|
||||
@@ -525,7 +525,7 @@ public class NetBIOSNameServer extends NetworkServer implements Runnable
|
||||
|
||||
// Allocate the datagram packet, using the add name buffer
|
||||
|
||||
DatagramPacket pkt = new DatagramPacket(buf, len, dest, getPort());
|
||||
DatagramPacket pkt = new DatagramPacket(buf, len, dest, RFCNetBIOSProtocol.NAME_PORT);
|
||||
|
||||
// Send the add name request
|
||||
|
||||
@@ -683,7 +683,12 @@ public class NetBIOSNameServer extends NetworkServer implements Runnable
|
||||
{
|
||||
super("NetBIOS", config);
|
||||
|
||||
// Set the NetBIOS name server port
|
||||
|
||||
setServerPort( config.getNetBIOSNamePort());
|
||||
|
||||
// Perform common constructor code
|
||||
|
||||
commonConstructor();
|
||||
}
|
||||
|
||||
@@ -712,7 +717,6 @@ public class NetBIOSNameServer extends NetworkServer implements Runnable
|
||||
// Set the local address to bind the server to, and server port
|
||||
|
||||
setBindAddress(getConfiguration().getNetBIOSBindAddress());
|
||||
setServerPort(RFCNetBIOSProtocol.NAME_PORT);
|
||||
|
||||
// Copy the WINS server addresses, if set
|
||||
|
||||
@@ -1716,7 +1720,6 @@ public class NetBIOSNameServer extends NetworkServer implements Runnable
|
||||
protected final void sendPacket(NetBIOSPacket nbpkt, int len, InetAddress replyAddr, int replyPort)
|
||||
throws java.io.IOException
|
||||
{
|
||||
|
||||
// Allocate the datagram packet, using the add name buffer
|
||||
|
||||
DatagramPacket pkt = new DatagramPacket(nbpkt.getBuffer(), len, replyAddr, replyPort);
|
||||
|
@@ -67,6 +67,7 @@ import org.alfresco.filesys.server.filesys.DiskInterface;
|
||||
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
||||
import org.alfresco.filesys.server.filesys.HomeShareMapper;
|
||||
import org.alfresco.filesys.smb.ServerType;
|
||||
import org.alfresco.filesys.smb.TcpipSMB;
|
||||
import org.alfresco.filesys.util.IPAddress;
|
||||
import org.alfresco.filesys.util.X64;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
@@ -182,6 +183,16 @@ public class ServerConfiguration implements ApplicationListener
|
||||
|
||||
private String m_broadcast;
|
||||
|
||||
// NetBIOS ports
|
||||
|
||||
private int m_nbNamePort = RFCNetBIOSProtocol.NAME_PORT;
|
||||
private int m_nbSessPort = RFCNetBIOSProtocol.PORT;
|
||||
private int m_nbDatagramPort = RFCNetBIOSProtocol.DATAGRAM;
|
||||
|
||||
// Native SMB port
|
||||
|
||||
private int m_tcpSMBPort = TcpipSMB.PORT;
|
||||
|
||||
// Announce the server to network neighborhood, announcement interval in
|
||||
// minutes
|
||||
|
||||
@@ -586,7 +597,7 @@ public class ServerConfiguration implements ApplicationListener
|
||||
m_platform = PlatformType.LINUX;
|
||||
else if (osName.startsWith("Mac OS X"))
|
||||
m_platform = PlatformType.MACOSX;
|
||||
else if (osName.startsWith("Solaris"))
|
||||
else if (osName.startsWith("Solaris") || osName.startsWith("SunOS"))
|
||||
m_platform = PlatformType.SOLARIS;
|
||||
}
|
||||
|
||||
@@ -896,8 +907,49 @@ public class ServerConfiguration implements ApplicationListener
|
||||
|
||||
throw new AlfrescoRuntimeException( "Failed to get IP address(es) for the local server, check hosts file and/or DNS setup");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check if the session port has been specified
|
||||
|
||||
String portNum = elem.getAttribute("sessionPort");
|
||||
if ( portNum != null && portNum.length() > 0) {
|
||||
try {
|
||||
setNetBIOSSessionPort(Integer.parseInt(portNum));
|
||||
if ( getNetBIOSSessionPort() <= 0 || getNetBIOSSessionPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("NetBIOS session port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid NetBIOS session port");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the name port has been specified
|
||||
|
||||
portNum = elem.getAttribute("namePort");
|
||||
if ( portNum != null && portNum.length() > 0) {
|
||||
try {
|
||||
setNetBIOSNamePort(Integer.parseInt(portNum));
|
||||
if ( getNetBIOSNamePort() <= 0 || getNetBIOSNamePort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("NetBIOS name port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid NetBIOS name port");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the datagram port has been specified
|
||||
|
||||
portNum = elem.getAttribute("datagramPort");
|
||||
if ( portNum != null && portNum.length() > 0) {
|
||||
try {
|
||||
setNetBIOSDatagramPort(Integer.parseInt(portNum));
|
||||
if ( getNetBIOSDatagramPort() <= 0 || getNetBIOSDatagramPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("NetBIOS datagram port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid NetBIOS datagram port");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -937,6 +989,20 @@ public class ServerConfiguration implements ApplicationListener
|
||||
// Enable the TCP/IP SMB support, if enabled for this platform
|
||||
|
||||
setTcpipSMB(platformOK);
|
||||
|
||||
// Check if the port has been specified
|
||||
|
||||
String portNum = elem.getAttribute("port");
|
||||
if ( portNum != null && portNum.length() > 0) {
|
||||
try {
|
||||
setTcpipSMBPort(Integer.parseInt(portNum));
|
||||
if ( getTcpipSMBPort() <= 0 || getTcpipSMBPort() >= 65535)
|
||||
throw new AlfrescoRuntimeException("TCP/IP SMB port out of valid range");
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new AlfrescoRuntimeException("Invalid TCP/IP SMB port");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2013,6 +2079,36 @@ public class ServerConfiguration implements ApplicationListener
|
||||
return m_nbBindAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NetBIOS name server port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getNetBIOSNamePort()
|
||||
{
|
||||
return m_nbNamePort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NetBIOS session port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getNetBIOSSessionPort()
|
||||
{
|
||||
return m_nbSessPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the NetBIOS datagram port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getNetBIOSDatagramPort()
|
||||
{
|
||||
return m_nbDatagramPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the network broadcast mask to be used for broadcast datagrams.
|
||||
*
|
||||
@@ -2154,6 +2250,16 @@ public class ServerConfiguration implements ApplicationListener
|
||||
return m_win32NBUseWinsock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the native SMB port
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public final int getTcpipSMBPort()
|
||||
{
|
||||
return m_tcpSMBPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the timezone name
|
||||
*
|
||||
@@ -2716,6 +2822,36 @@ public class ServerConfiguration implements ApplicationListener
|
||||
m_netBIOSEnable = ena;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the NetBIOS name server port
|
||||
*
|
||||
* @param port int
|
||||
*/
|
||||
public final void setNetBIOSNamePort(int port)
|
||||
{
|
||||
m_nbNamePort = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the NetBIOS session port
|
||||
*
|
||||
* @param port int
|
||||
*/
|
||||
public final void setNetBIOSSessionPort(int port)
|
||||
{
|
||||
m_nbSessPort = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the NetBIOS datagram port
|
||||
*
|
||||
* @param port int
|
||||
*/
|
||||
public final void setNetBIOSDatagramPort(int port)
|
||||
{
|
||||
m_nbDatagramPort = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable the TCP/IP SMB support
|
||||
*
|
||||
@@ -2726,6 +2862,16 @@ public class ServerConfiguration implements ApplicationListener
|
||||
m_tcpSMBEnable = ena;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the TCP/IP SMB port
|
||||
*
|
||||
* @param port int
|
||||
*/
|
||||
public final void setTcpipSMBPort( int port)
|
||||
{
|
||||
m_tcpSMBPort = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable the Win32 NetBIOS SMB support
|
||||
*
|
||||
|
@@ -198,11 +198,15 @@ public class TcpipNetBIOSHostAnnouncer extends HostAnnouncer
|
||||
*/
|
||||
protected void sendAnnouncement(String hostName, byte[] buf, int offset, int len) throws Exception
|
||||
{
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Send NetBIOS host announcement to " + m_bcastAddr.getHostAddress() + ", port " + m_bcastPort);
|
||||
|
||||
// Send the host announce datagram
|
||||
|
||||
m_nbdgram.SendDatagram(NetBIOSDatagram.DIRECT_GROUP, hostName, NetBIOSName.FileServer, getDomain(),
|
||||
NetBIOSName.MasterBrowser, buf, len, offset);
|
||||
NetBIOSName.MasterBrowser, buf, len, offset, m_bcastAddr, m_bcastPort);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,7 +20,6 @@ import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
|
||||
import org.alfresco.filesys.netbios.RFCNetBIOSProtocol;
|
||||
import org.alfresco.filesys.server.config.ServerConfiguration;
|
||||
import org.alfresco.filesys.smb.mailslot.TcpipNetBIOSHostAnnouncer;
|
||||
|
||||
@@ -154,7 +153,7 @@ public class NetBIOSSessionSocketHandler extends SessionSocketHandler
|
||||
|
||||
// Create the NetBIOS SMB handler
|
||||
|
||||
SessionSocketHandler sessHandler = new NetBIOSSessionSocketHandler(server, RFCNetBIOSProtocol.PORT, config
|
||||
SessionSocketHandler sessHandler = new NetBIOSSessionSocketHandler(server, config.getNetBIOSSessionPort(), config
|
||||
.getSMBBindAddress(), sockDbg);
|
||||
sessHandler.initialize();
|
||||
|
||||
@@ -171,7 +170,7 @@ public class NetBIOSSessionSocketHandler extends SessionSocketHandler
|
||||
// DEBUG
|
||||
|
||||
if (logger.isDebugEnabled() && sockDbg)
|
||||
logger.debug("TCP NetBIOS session handler created");
|
||||
logger.debug("TCP NetBIOS session handler created on port " + config.getNetBIOSSessionPort());
|
||||
|
||||
// Check if a host announcer should be created
|
||||
|
||||
@@ -188,6 +187,7 @@ public class NetBIOSSessionSocketHandler extends SessionSocketHandler
|
||||
announcer.setDomain(config.getDomainName());
|
||||
announcer.setComment(config.getComment());
|
||||
announcer.setBindAddress(config.getSMBBindAddress());
|
||||
announcer.setPort(config.getNetBIOSDatagramPort());
|
||||
|
||||
// Set the announcement interval
|
||||
|
||||
@@ -222,7 +222,7 @@ public class NetBIOSSessionSocketHandler extends SessionSocketHandler
|
||||
// DEBUG
|
||||
|
||||
if (logger.isDebugEnabled() && sockDbg)
|
||||
logger.debug("TCP NetBIOS host announcer created");
|
||||
logger.debug("TCP NetBIOS host announcer created on port " + config.getNetBIOSDatagramPort());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -80,15 +80,6 @@ public class SMBServer extends NetworkFileServer implements Runnable
|
||||
|
||||
private int m_srvType = ServerType.WorkStation + ServerType.Server + ServerType.NTServer;
|
||||
|
||||
// Next available session id
|
||||
|
||||
private int m_sessId;
|
||||
|
||||
// Server shutdown flag and server active flag
|
||||
|
||||
private boolean m_shutdown = false;
|
||||
private boolean m_active = false;
|
||||
|
||||
// Server GUID
|
||||
|
||||
private UUID m_serverGUID;
|
||||
@@ -472,7 +463,7 @@ public class SMBServer extends NetworkFileServer implements Runnable
|
||||
|
||||
// Clear the server shutdown flag
|
||||
|
||||
m_shutdown = false;
|
||||
setShutdown(false);
|
||||
|
||||
// Get the list of IP addresses the server is bound to
|
||||
|
||||
@@ -529,7 +520,7 @@ public class SMBServer extends NetworkFileServer implements Runnable
|
||||
|
||||
// Wait for incoming connection requests
|
||||
|
||||
while (m_shutdown == false)
|
||||
while (hasShutdown() == false)
|
||||
{
|
||||
|
||||
// Sleep for a while
|
||||
@@ -569,7 +560,7 @@ public class SMBServer extends NetworkFileServer implements Runnable
|
||||
// Do not report an error if the server has shutdown, closing the server socket
|
||||
// causes an exception to be thrown.
|
||||
|
||||
if (m_shutdown == false)
|
||||
if (hasShutdown() == false)
|
||||
{
|
||||
logger.error("Server error : ", ex);
|
||||
|
||||
@@ -654,7 +645,7 @@ public class SMBServer extends NetworkFileServer implements Runnable
|
||||
|
||||
// Indicate that the server is closing
|
||||
|
||||
m_shutdown = true;
|
||||
setShutdown(true);
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -21,7 +21,6 @@ import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
|
||||
import org.alfresco.filesys.server.config.ServerConfiguration;
|
||||
import org.alfresco.filesys.smb.TcpipSMB;
|
||||
|
||||
/**
|
||||
* Native SMB Session Socket Handler Class
|
||||
@@ -153,7 +152,7 @@ public class TcpipSMBSessionSocketHandler extends SessionSocketHandler
|
||||
|
||||
// Create the NetBIOS SMB handler
|
||||
|
||||
SessionSocketHandler sessHandler = new TcpipSMBSessionSocketHandler(server, TcpipSMB.PORT, config
|
||||
SessionSocketHandler sessHandler = new TcpipSMBSessionSocketHandler(server, config.getTcpipSMBPort(), config
|
||||
.getSMBBindAddress(), sockDbg);
|
||||
|
||||
sessHandler.initialize();
|
||||
@@ -168,6 +167,6 @@ public class TcpipSMBSessionSocketHandler extends SessionSocketHandler
|
||||
// DEBUG
|
||||
|
||||
if (logger.isDebugEnabled() && sockDbg)
|
||||
logger.debug("Native SMB TCP session handler created");
|
||||
logger.debug("Native SMB TCP session handler created on port " + config.getTcpipSMBPort());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user