Merge from HEAD into WCM-DEV2. Also fixes build breakage in

jndi-client and catalina-virtual that I introduced earlier. 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3393 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-07-24 18:27:41 +00:00
parent c50a4aa669
commit f7d9d83036
83 changed files with 4469 additions and 1999 deletions

View File

@@ -19,6 +19,19 @@ package org.alfresco.filesys.ftp;
import java.net.*;
import java.io.*;
import org.alfresco.filesys.server.SrvSession;
import org.alfresco.filesys.server.filesys.AccessMode;
import org.alfresco.filesys.server.filesys.DiskDeviceContext;
import org.alfresco.filesys.server.filesys.DiskInterface;
import org.alfresco.filesys.server.filesys.FileAction;
import org.alfresco.filesys.server.filesys.FileOpenParams;
import org.alfresco.filesys.server.filesys.FileStatus;
import org.alfresco.filesys.server.filesys.NetworkFile;
import org.alfresco.filesys.server.filesys.NotifyChange;
import org.alfresco.filesys.server.filesys.TreeConnection;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* FTP Data Session Class
* <p>
@@ -30,9 +43,16 @@ import java.io.*;
*
* @author GKSpencer
*/
public class FTPDataSession implements Runnable
public class FTPDataSession extends SrvSession implements Runnable
{
// Debug logging
private static final Log logger = LogFactory.getLog("org.alfresco.ftp.protocol");
// Data session command types
public enum DataCommand { StoreFile, ReturnFile };
// FTP session that this data connection is associated with
private FTPSrvSession m_cmdSess;
@@ -54,10 +74,6 @@ public class FTPDataSession implements Runnable
private ServerSocket m_passiveSock;
// Adapter to bind the passive socket to
private InetAddress m_bindAddr;
// Transfer in progress and abort file transfer flags
private boolean m_transfer;
@@ -66,7 +82,27 @@ public class FTPDataSession implements Runnable
// Send/receive data byte count
private long m_bytCount;
// Data command type
private DataCommand m_dataCmd;
// Requested file name
private String m_reqFileName;
// Path to the local file
private FTPPath m_ftpPath;
// Restart position
private long m_restartPos;
// Thread that runs the data command
private Thread m_dataThread;
/**
* Class constructor
* <p>
@@ -77,7 +113,10 @@ public class FTPDataSession implements Runnable
*/
protected FTPDataSession(FTPSrvSession sess) throws IOException
{
// Setup the base class
super( -1, sess.getServer(), "FTPDATA", null);
// Set the associated command session
m_cmdSess = sess;
@@ -100,6 +139,9 @@ public class FTPDataSession implements Runnable
*/
protected FTPDataSession(FTPSrvSession sess, int localPort, InetAddress bindAddr) throws IOException
{
// Setup the base class
super( -1, sess.getServer(), "FTPDATA", null);
// Set the associated command session
@@ -124,6 +166,9 @@ public class FTPDataSession implements Runnable
*/
protected FTPDataSession(FTPSrvSession sess, InetAddress bindAddr) throws IOException
{
// Setup the base class
super( -1, sess.getServer(), "FTPDATA", null);
// Set the associated command session
@@ -146,6 +191,9 @@ public class FTPDataSession implements Runnable
*/
protected FTPDataSession(FTPSrvSession sess, InetAddress addr, int port)
{
// Setup the base class
super( -1, sess.getServer(), "FTPDATA", null);
// Set the associated command session
@@ -171,6 +219,9 @@ public class FTPDataSession implements Runnable
*/
protected FTPDataSession(FTPSrvSession sess, int localPort, InetAddress addr, int port)
{
// Setup the base class
super( -1, sess.getServer(), "FTPDATA", null);
// Set the associated command session
@@ -271,6 +322,16 @@ public class FTPDataSession implements Runnable
return m_transfer;
}
/**
* Determine if the transfer has been aborted
*
* @return boolean
*/
public final boolean isTransferAborted()
{
return m_abort;
}
/**
* Abort an in progress file transfer
*/
@@ -358,12 +419,524 @@ public class FTPDataSession implements Runnable
}
m_passiveSock = null;
}
// Commit, or rollback, any active user transaction
try
{
// Commit or rollback the transaction
endTransaction();
}
catch ( Exception ex)
{
// Debug
if ( logger.isDebugEnabled())
logger.debug("Error committing transaction", ex);
}
}
/**
* Store a file using a seperate thread to receive the data and write the file
*
* @param ftpPath FTPPath
*/
public final void doStoreFile( FTPPath ftpPath, long restartPos, String reqFileName)
{
// Set the transfer details
m_dataCmd = DataCommand.StoreFile;
m_ftpPath = ftpPath;
m_restartPos = restartPos;
m_reqFileName = reqFileName;
// Run the transfer in a seperate thread
m_dataThread = new Thread(this);
m_dataThread.setName(m_cmdSess.getUniqueId() + "_DATA_STORE");
m_dataThread.start();
}
/**
* Return a file using a seperate thread to read the file and send the data
*
* @param ftpPath FTPPath
*/
public final void doReturnFile( FTPPath ftpPath, long restartPos, String reqFileName)
{
// Set the transfer details
m_dataCmd = DataCommand.ReturnFile;
m_ftpPath = ftpPath;
m_restartPos = restartPos;
m_reqFileName = reqFileName;
// Run the transfer in a seperate thread
m_dataThread = new Thread(this);
m_dataThread.setName(m_cmdSess.getUniqueId() + "_DATA_RETURN");
m_dataThread.start();
}
/**
* Run a file send/receive in a seperate thread
*/
public void run()
{
// Setup the authentication context as we are running in a seperate thread from the main FTP session
try
{
// Setup the authentication context for the thread
m_cmdSess.authenticateDataSession();
// Run the required data command
switch ( m_dataCmd)
{
// Store a file
case StoreFile:
runStoreFile();
break;
// Return a file
case ReturnFile:
runReturnFile();
break;
}
}
catch ( org.alfresco.repo.security.authentication.AuthenticationException ex)
{
if ( logger.isErrorEnabled())
logger.error("Failed to authenticate FTP data session", ex);
// Close the data connection to the client
m_cmdSess.getFTPServer().releaseDataSession(this);
closeSession();
}
}
/**
* Return a file to the client
*/
private final void runReturnFile()
{
// Send the file to the client
OutputStream os = null;
DiskInterface disk = null;
TreeConnection tree = null;
NetworkFile netFile = null;
Socket dataSock = null;
try
{
// Open an output stream to the client
dataSock = getSocket();
os = dataSock.getOutputStream();
// Create a temporary tree connection
tree = m_cmdSess.getTreeConnection(m_ftpPath.getSharedDevice());
// Check if the file exists and it is a file, if so then open the
// file
disk = (DiskInterface) m_ftpPath.getSharedDevice().getInterface();
// Create the file open parameters
FileOpenParams params = new FileOpenParams(m_ftpPath.getSharePath(), FileAction.OpenIfExists,
AccessMode.ReadOnly, 0);
// Check if the file exists and it is a file
int sts = disk.fileExists( this, tree, m_ftpPath.getSharePath());
if (sts == FileStatus.FileExists)
{
// Open the file
netFile = disk.openFile( this, tree, params);
}
// Check if the file has been opened
if (netFile == null)
{
m_cmdSess.sendFTPResponse(550, "File " + m_reqFileName + " not available");
return;
}
// Allocate the buffer for the file data
byte[] buf = new byte[FTPSrvSession.DEFAULT_BUFFERSIZE];
long filePos = m_restartPos;
int len = -1;
while (filePos < netFile.getFileSize())
{
// Read another block of data from the file
len = disk.readFile( this, tree, netFile, buf, 0, buf.length, filePos);
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_FILEIO))
logger.debug(" Write len=" + len + " bytes");
// Write the current data block to the client, update the file position
if (len > 0)
{
// Write the data to the client
os.write(buf, 0, len);
// Update the file position
filePos += len;
// Update the transfer byte count
m_bytCount += len;
}
// Check if the transfer has been aborted
if ( isTransferAborted())
{
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_FILE))
logger.debug(" Transfer aborted (RETR)");
// Send a status to the client
sendFTPResponse( 226, "Aborted data connection");
// Finally block will cleanup
return;
}
}
// Close the output stream to the client
os.close();
os = null;
// Indicate that the file has been transmitted
sendFTPResponse(226, "Closing data connection");
// Close the data session
m_cmdSess.getFTPServer().releaseDataSession(this);
// Close the network file
disk.closeFile( this, tree, netFile);
netFile = null;
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_FILEIO))
logger.debug(" Transfer complete, file closed");
}
catch (SocketException ex)
{
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_ERROR))
logger.debug(" Error during transfer", ex);
// Indicate that there was an error during transmission of the file
// data
sendFTPResponse(426, "Data connection closed by client");
}
catch (Exception ex)
{
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_ERROR))
logger.debug(" Error during transfer", ex);
// Indicate that there was an error during transmission of the file
// data
sendFTPResponse(426, "Error during transmission");
}
finally
{
try
{
// Close the network file
if (netFile != null && disk != null && tree != null)
disk.closeFile(m_cmdSess, tree, netFile);
// Close the output stream to the client
if (os != null)
os.close();
// Close the data connection to the client
m_cmdSess.getFTPServer().releaseDataSession( this);
closeSession();
}
catch (Exception ex)
{
if ( logger.isErrorEnabled())
logger.error( "Error during FTP data session close", ex);
}
}
}
/**
* Store a file received from the client
*/
private final void runStoreFile()
{
// Store the file from the client
InputStream is = null;
DiskInterface disk = null;
TreeConnection tree = null;
NetworkFile netFile = null;
Socket dataSock = null;
try
{
// Create a temporary tree connection
tree = m_cmdSess.getTreeConnection(m_ftpPath.getSharedDevice());
// Check if the session has the required access to the filesystem
if (tree == null || tree.hasWriteAccess() == false)
{
// Session does not have write access to the filesystem
sendFTPResponse(550, "Access denied");
return;
}
// Check if the file exists
disk = (DiskInterface) m_ftpPath.getSharedDevice().getInterface();
int sts = disk.fileExists(this, tree, m_ftpPath.getSharePath());
if (sts == FileStatus.DirectoryExists)
{
// Return an error status
sendFTPResponse(500, "Invalid path (existing directory)");
return;
}
// Create the file open parameters
FileOpenParams params = new FileOpenParams(m_ftpPath.getSharePath(),
sts == FileStatus.FileExists ? FileAction.TruncateExisting : FileAction.CreateNotExist,
AccessMode.ReadWrite, 0);
// Create a new file to receive the data
if (sts == FileStatus.FileExists)
{
// Overwrite the existing file
netFile = disk.openFile(this, tree, params);
}
else
{
// Create a new file
netFile = disk.createFile(this, tree, params);
}
// Notify change listeners that a new file has been created
DiskDeviceContext diskCtx = (DiskDeviceContext) tree.getContext();
if (diskCtx.hasChangeHandler())
diskCtx.getChangeHandler().notifyFileChanged(NotifyChange.ActionAdded, m_ftpPath.getSharePath());
// Send the intermediate response
sendFTPResponse(150, "File status okay, about to open data connection");
// Get the data connection socket
try
{
dataSock = getSocket();
}
catch (Exception ex)
{
}
if (dataSock == null)
{
sendFTPResponse(426, "Connection closed; transfer aborted");
return;
}
// Open an input stream from the client
is = dataSock.getInputStream();
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_FILE))
logger.debug("Storing ftp="
+ m_ftpPath.getFTPPath() + ", share=" + m_ftpPath.getShareName() + ", path="
+ m_ftpPath.getSharePath());
// Allocate the buffer for the file data
byte[] buf = new byte[FTPSrvSession.DEFAULT_BUFFERSIZE];
long filePos = 0;
int len = is.read(buf, 0, buf.length);
while (len > 0)
{
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_FILEIO))
logger.debug(" Receive len=" + len + " bytes");
// Write the current data block to the file, update the file
// position
disk.writeFile(this, tree, netFile, buf, 0, len, filePos);
filePos += len;
// Read another block of data from the client
len = is.read(buf, 0, buf.length);
}
// Close the input stream from the client
is.close();
is = null;
// Close the network file
disk.closeFile(this, tree, netFile);
netFile = null;
// Commit the transaction now before notifying the client that the transfer is finished
endTransaction();
// Indicate that the file has been received
sendFTPResponse(226, "Closing data connection");
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_FILEIO))
logger.debug(" Transfer complete, file closed");
}
catch (SocketException ex)
{
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_ERROR))
logger.debug(" Error during transfer", ex);
// Indicate that there was an error during transmission of the file data
sendFTPResponse(426, "Data connection closed by client");
}
catch (Exception ex)
{
// DEBUG
if (logger.isDebugEnabled() && m_cmdSess.hasDebug(FTPSrvSession.DBG_ERROR))
logger.debug(" Error during transfer", ex);
// Indicate that there was an error during transmission of the file
// data
sendFTPResponse(426, "Error during transmission");
}
finally
{
try
{
// Close the network file
if (netFile != null && disk != null && tree != null)
disk.closeFile( this, tree, netFile);
// Close the input stream to the client
if (is != null)
is.close();
// Close the data connection to the client
m_cmdSess.getFTPServer().releaseDataSession(this);
closeSession();
}
catch (Exception ex)
{
if ( logger.isErrorEnabled())
logger.error( "Error during FTP data session close", ex);
}
}
}
/**
* Send an FTP response to the client via the command session
*
* @param stsCode int
* @param msg String
*/
protected final void sendFTPResponse(int stsCode, String msg)
{
try
{
m_cmdSess.sendFTPResponse( stsCode, msg);
}
catch (Exception ex)
{
}
}
/**
* Return the client address
*
* @return InetAddress
*/
public InetAddress getRemoteAddress() {
return m_cmdSess.getRemoteAddress();
}
}

View File

@@ -98,10 +98,10 @@ public class FTPDate
buf.append(hr);
buf.append(":");
int sec = cal.get(Calendar.SECOND);
if (sec < 10)
int min = cal.get(Calendar.MINUTE);
if (min < 10)
buf.append("0");
buf.append(sec);
buf.append(min);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -460,8 +460,6 @@ public class ServerConfiguration implements ApplicationListener
throw new AlfrescoRuntimeException("Property 'configService' not set");
}
initialised = false;
// Create the configuration context
ConfigLookupContext configCtx = new ConfigLookupContext(ConfigArea);
@@ -470,59 +468,106 @@ public class ServerConfiguration implements ApplicationListener
determinePlatformType();
// Initialize the filesystems
boolean filesysInitOK = false;
Config config = null;
try
{
// Process the CIFS server configuration
Config config = configService.getConfig(ConfigCIFS, configCtx);
processCIFSServerConfig(config);
// Process the FTP server configuration
config = configService.getConfig(ConfigFTP, configCtx);
processFTPServerConfig(config);
// Process the security configuration
config = configService.getConfig(ConfigSecurity, configCtx);
processSecurityConfig(config);
// Process the filesystems configuration
config = configService.getConfig(ConfigFilesystems, configCtx);
processFilesystemsConfig(config);
// Successful initialisation
initialised = true;
// Indicate that the filesystems were initialized
filesysInitOK = true;
}
catch (UnsatisfiedLinkError ex)
{
// Error accessing the Win32NetBIOS DLL code
logger.error("Error accessing Win32 NetBIOS, check DLL is on the path");
// Disable the CIFS server
setNetBIOSSMB(false);
setTcpipSMB(false);
setWin32NetBIOS(false);
setSMBServerEnabled(false);
}
catch (Throwable ex)
catch (Exception ex)
{
// Configuration error
logger.error("File server configuration error, " + ex.getMessage(), ex);
}
// Disable the CIFS server
// Initialize the CIFS and FTP servers, if the filesystem(s) initialized successfully
if ( filesysInitOK == true)
{
// Initialize the CIFS server
setNetBIOSSMB(false);
setTcpipSMB(false);
setWin32NetBIOS(false);
try
{
// Process the CIFS server configuration
config = configService.getConfig(ConfigCIFS, configCtx);
processCIFSServerConfig(config);
// Process the security configuration
config = configService.getConfig(ConfigSecurity, configCtx);
processSecurityConfig(config);
// Log the successful startup
logger.info("CIFS server started");
}
catch (UnsatisfiedLinkError ex)
{
// Error accessing the Win32NetBIOS DLL code
logger.error("Error accessing Win32 NetBIOS, check DLL is on the path");
// Disable the CIFS server
setNetBIOSSMB(false);
setTcpipSMB(false);
setWin32NetBIOS(false);
setSMBServerEnabled(false);
}
catch (Throwable ex)
{
// Configuration error
logger.error("CIFS server configuration error, " + ex.getMessage(), ex);
// Disable the CIFS server
setNetBIOSSMB(false);
setTcpipSMB(false);
setWin32NetBIOS(false);
setSMBServerEnabled(false);
}
setSMBServerEnabled(false);
// Initialize the FTP server
try
{
// Process the FTP server configuration
config = configService.getConfig(ConfigFTP, configCtx);
processFTPServerConfig(config);
// Log the successful startup
logger.info("FTP server started");
}
catch (Exception ex)
{
// Configuration error
logger.error("FTP server configuration error, " + ex.getMessage(), ex);
}
}
else
{
// Log the error
logger.error("CIFS and FTP servers not started due to filesystem initialization error");
}
}

View File

@@ -174,7 +174,11 @@ public class DiskDeviceContext extends DeviceContext
*/
public void CloseContext()
{
// Close the notify handler
if ( hasChangeHandler())
getChangeHandler().shutdownRequest();
// Call the base class
super.CloseContext();

View File

@@ -28,17 +28,18 @@ public final class FileSystem
// Filesystem attributes
public static final int CaseSensitiveSearch = 0x00000001;
public static final int CasePreservedNames = 0x00000002;
public static final int UnicodeOnDisk = 0x00000004;
public static final int PersistentACLs = 0x00000008;
public static final int FileCompression = 0x00000010;
public static final int VolumeQuotas = 0x00000020;
public static final int SparseFiles = 0x00000040;
public static final int ReparsePoints = 0x00000080;
public static final int RemoteStorage = 0x00000100;
public static final int VolumeIsCompressed = 0x00008000;
public static final int ObjectIds = 0x00010000;
public static final int Encryption = 0x00020000;
public static final int CasePreservedNames = 0x00000002;
public static final int UnicodeOnDisk = 0x00000004;
public static final int PersistentACLs = 0x00000008;
public static final int FileCompression = 0x00000010;
public static final int VolumeQuotas = 0x00000020;
public static final int SparseFiles = 0x00000040;
public static final int ReparsePoints = 0x00000080;
public static final int RemoteStorage = 0x00000100;
public static final int LFNAPISupport = 0x00004000;
public static final int VolumeIsCompressed = 0x00008000;
public static final int ObjectIds = 0x00010000;
public static final int Encryption = 0x00020000;
// Filesystem type strings

View File

@@ -75,6 +75,10 @@ public abstract class HostAnnouncer extends Thread
private byte m_updateCount;
// Error count
private int m_errorCount;
// Shutdown flag, host announcer should remove the announced name as it shuts down
private boolean m_shutdown = false;
@@ -156,6 +160,16 @@ public abstract class HostAnnouncer extends Thread
return m_names.numberOfStrings();
}
/**
* Return the error count
*
* @return int
*/
protected final int getErrorCount()
{
return m_errorCount;
}
/**
* Return the specified host name being announced.
*
@@ -493,6 +507,24 @@ public abstract class HostAnnouncer extends Thread
m_srvtype = typ;
}
/**
* Increment the error count
*
* @return int
*/
protected final int incrementErrorCount()
{
return ++m_errorCount;
}
/**
* Clear the error count
*/
protected final void clearErrorCount()
{
m_errorCount = 0;
}
/**
* Shutdown the host announcer and remove the announced name from Network Neighborhood.
*/

View File

@@ -32,6 +32,10 @@ import org.alfresco.filesys.smb.server.win32.Win32NetBIOSSessionSocketHandler;
public class Win32NetBIOSHostAnnouncer extends HostAnnouncer
{
// Number of send errors before marking the LANA as offline
private static final int SendErrorCount = 3;
// Associated session handler
Win32NetBIOSSessionSocketHandler m_handler;
@@ -120,6 +124,36 @@ public class Win32NetBIOSHostAnnouncer extends HostAnnouncer
int sts = Win32NetBIOS.SendDatagram(getLana(), getNameNumber(), destName, buf, 0, len);
if ( sts != NetBIOS.NRC_GoodRet)
logger.debug("Win32NetBIOS host announce error " + NetBIOS.getErrorString( -sts));
{
// Log the error
if ( logger.isErrorEnabled())
logger.error("Host announce error " + NetBIOS.getErrorString( -sts) +
" (LANA " + getLana() + ")");
// Update the error count
if ( incrementErrorCount() == SendErrorCount)
{
// Mark the LANA as offline
m_handler.lanaStatusChange( getLana(), false);
// Clear the error count
clearErrorCount();
// Log the error
if ( logger.isErrorEnabled())
logger.error("Marked LANA as unavailable due to send errors");
}
}
else
{
// Clear the error count
clearErrorCount();
}
}
}

View File

@@ -16,6 +16,8 @@
*/
package org.alfresco.filesys.smb.mailslot;
import java.io.IOException;
import org.alfresco.filesys.netbios.NetBIOSName;
import org.alfresco.filesys.netbios.win32.NetBIOS;
import org.alfresco.filesys.netbios.win32.NetBIOSSocket;
@@ -34,6 +36,10 @@ import org.alfresco.filesys.smb.server.win32.Win32NetBIOSSessionSocketHandler;
*/
public class WinsockNetBIOSHostAnnouncer extends HostAnnouncer
{
// Number of send errors before marking the LANA as offline
private static final int SendErrorCount = 3;
// Associated session handler
private Win32NetBIOSSessionSocketHandler m_handler;
@@ -116,8 +122,49 @@ public class WinsockNetBIOSHostAnnouncer extends HostAnnouncer
// Send the host announce datagram via the Win32 Netbios() API call
int sts = m_dgramSocket.sendDatagram(destNbName, buf, 0, len);
if ( sts != len)
logger.debug("WinsockNetBIOS host announce error");
boolean txOK = false;
try
{
int sts = m_dgramSocket.sendDatagram(destNbName, buf, 0, len);
if ( sts == len)
txOK = true;
}
catch ( IOException ex)
{
// Log the error
if ( logger.isErrorEnabled())
logger.error("Host announce error, " + ex.getMessage() + ", (LANA " + getLana() + ")");
}
// Check if the send was successful
if ( txOK == false)
{
// Update the error count
if ( incrementErrorCount() == SendErrorCount)
{
// Mark the LANA as offline
m_handler.lanaStatusChange( getLana(), false);
// Clear the error count
clearErrorCount();
// Log the error
if ( logger.isErrorEnabled())
logger.error("Marked LANA as unavailable due to send errors, (LANA " + getLana() + ")");
}
}
else
{
// Clear the error count
clearErrorCount();
}
}
}

View File

@@ -40,24 +40,24 @@ class FindInfoPacker
// File information levels
public static final int InfoStandard = 1;
public static final int InfoQueryEASize = 2;
public static final int InfoQueryEAFromList = 3;
public static final int InfoDirectory = 0x101;
public static final int InfoFullDirectory = 0x102;
public static final int InfoNames = 0x103;
public static final int InfoDirectoryBoth = 0x104;
public static final int InfoMacHfsInfo = 0x302;
public static final int InfoStandard = 1;
public static final int InfoQueryEASize = 2;
public static final int InfoQueryEAFromList = 3;
public static final int InfoDirectory = 0x101;
public static final int InfoFullDirectory = 0x102;
public static final int InfoNames = 0x103;
public static final int InfoDirectoryBoth = 0x104;
public static final int InfoMacHfsInfo = 0x302;
// File information fixed lengths, includes nulls on strings.
public static final int InfoStandardLen = 24;
public static final int InfoQueryEASizeLen = 28;
public static final int InfoDirectoryLen = 64;
public static final int InfoFullDirectoryLen = 68;
public static final int InfoNamesLen = 12;
public static final int InfoDirectoryBothLen = 94;
public static final int InfoMacHfsLen = 120;
public static final int InfoStandardLen = 24;
public static final int InfoQueryEASizeLen = 28;
public static final int InfoDirectoryLen = 64;
public static final int InfoFullDirectoryLen = 68;
public static final int InfoNamesLen = 12;
public static final int InfoDirectoryBothLen = 94;
public static final int InfoMacHfsLen = 120;
/**
* Pack a file information object into the specified buffer, using information level 1 format.
@@ -426,7 +426,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);
@@ -518,7 +518,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);
@@ -615,7 +615,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);
@@ -718,7 +718,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);
@@ -839,7 +839,7 @@ class FindInfoPacker
// Align the buffer pointer and set the offset to the next file information entry
buf.longwordAlign();
buf.wordAlign();
int curPos = buf.getPosition();
buf.setPosition(startPos);

View File

@@ -6576,41 +6576,12 @@ public class NTProtocolHandler extends CoreProtocolHandler
return;
}
// Check if this is a buffer length check, if so the maximum returned data count will be
// zero
// Return an empty security descriptor
byte[] paramblk = new byte[4];
DataPacker.putIntelInt(0, paramblk, 0);
if (tbuf.getReturnDataLimit() == 0)
{
// Return the security descriptor length in the parameter block
byte[] paramblk = new byte[4];
DataPacker.putIntelInt(_sdEveryOne.length, paramblk, 0);
// Initialize the transaction reply
outPkt.initTransactReply(paramblk, paramblk.length, null, 0);
// Set a warning status to indicate the supplied data buffer was too small to return the
// security
// descriptor
outPkt.setLongErrorCode(SMBStatus.NTBufferTooSmall);
}
else
{
// Return the security descriptor length in the parameter block
byte[] paramblk = new byte[4];
DataPacker.putIntelInt(_sdEveryOne.length, paramblk, 0);
// Initialize the transaction reply. Return the fixed security descriptor that allows
// anyone to access the
// file/directory
outPkt.initTransactReply(paramblk, paramblk.length, _sdEveryOne, _sdEveryOne.length);
}
outPkt.initTransactReply(paramblk, paramblk.length, null, 0);
// Send back the response

View File

@@ -78,7 +78,7 @@ public class SMBServer extends NetworkFileServer implements Runnable
// Server type flags, used when announcing the host
private int m_srvType = ServerType.WorkStation + ServerType.Server;
private int m_srvType = ServerType.WorkStation + ServerType.Server + ServerType.NTServer;
// Next available session id

View File

@@ -311,7 +311,8 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
// Set parameters
context.setFilesystemAttributes(FileSystem.CasePreservedNames);
context.setFilesystemAttributes(FileSystem.CasePreservedNames + FileSystem.UnicodeOnDisk +
FileSystem.CaseSensitiveSearch);
}
catch (Exception ex)
{
@@ -597,10 +598,8 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
{
// a valid use case
if (logger.isDebugEnabled())
{
logger.debug("Getting file information - File not found: \n" +
" path: " + path);
}
throw e;
}
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
@@ -1448,7 +1447,8 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
try
{
// get the node
// Get the node
NodeRef nodeRef = getNodeForPath(tree, name);
if (nodeService.exists(nodeRef))
{
@@ -1468,15 +1468,6 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
" node: " + nodeRef);
}
}
catch (FileNotFoundException e)
{
// already gone
if (logger.isDebugEnabled())
{
logger.debug("Deleted file <alfready gone>: \n" +
" file: " + name);
}
}
catch (NodeLockedException ex)
{
// Debug
@@ -1610,8 +1601,11 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
// DEBUG
if ( logger.isDebugEnabled())
if ( logger.isDebugEnabled())
{
logger.debug("Cached rename state for " + oldName + ", state=" + fstate);
logger.debug(" new name " + newName + ", state=" + newState);
}
}
}
else

View File

@@ -20,7 +20,6 @@ import org.alfresco.filesys.locking.FileLock;
import org.alfresco.filesys.locking.FileLockList;
import org.alfresco.filesys.locking.LockConflictException;
import org.alfresco.filesys.locking.NotLockedException;
import org.alfresco.filesys.server.filesys.FileName;
import org.alfresco.filesys.server.filesys.FileOpenParams;
import org.alfresco.filesys.server.filesys.FileStatus;
import org.alfresco.filesys.smb.SharingMode;
@@ -587,35 +586,7 @@ public class FileState
*/
public final static String normalizePath(String path)
{
// Split the path into directories and file name, only uppercase the directories to
// normalize the path.
String normPath = path;
if (path.length() > 3)
{
// Split the path to seperate the folders/file name
int pos = path.lastIndexOf(FileName.DOS_SEPERATOR);
if (pos != -1)
{
// Get the path and file name parts, normalize the path
String pathPart = path.substring(0, pos).toUpperCase();
String namePart = path.substring(pos);
// Rebuild the path string
normPath = pathPart + namePart;
}
}
// Return the normalized path
return normPath;
return path.toUpperCase();
}
/**

View File

@@ -448,7 +448,7 @@ public class FileStateTable implements Runnable
// Dump the file state cache entries to the specified stream
if (m_stateTable.size() > 0)
logger.info("++ FileStateCache Entries:");
logger.debug("++ FileStateCache Entries:");
Enumeration enm = m_stateTable.keys();
long curTime = System.currentTimeMillis();
@@ -458,7 +458,7 @@ public class FileStateTable implements Runnable
String fname = (String) enm.nextElement();
FileState state = m_stateTable.get(fname);
logger.info(" ++ " + fname + "(" + state.getSecondsToExpire(curTime) + ") : " + state);
logger.debug(" ++ " + fname + "(" + state.getSecondsToExpire(curTime) + ") : " + state);
}
}
}

View File

@@ -39,7 +39,7 @@ public class Win32NetBIOSLanaMonitor extends Thread
//
// Initial LANA listener array size
private static final int LanaListenerArraySize = 16;
private static final int LanaListenerArraySize = 256;
// Debug logging
@@ -153,24 +153,7 @@ public class Win32NetBIOSLanaMonitor extends Thread
// Check if the listener array has been allocated
if ( m_listeners == null)
{
int len = LanaListenerArraySize;
if ( lana > len)
len = (lana + 3) & 0x00FC;
m_listeners = new LanaListener[len];
}
else if ( lana >= m_listeners.length)
{
// Extend the LANA listener array
LanaListener[] newArray = new LanaListener[(lana + 3) & 0x00FC];
// Copy the existing array to the extended array
System.arraycopy(m_listeners, 0, newArray, 0, m_listeners.length);
m_listeners = newArray;
}
m_listeners = new LanaListener[LanaListenerArraySize];
// Add the LANA listener
@@ -343,6 +326,10 @@ public class Win32NetBIOSLanaMonitor extends Thread
m_lanas.set(lana);
m_lanaSts.set(lana, true);
// Add a listener for the new LANA
addLanaListener( sessHandler.getLANANumber(), sessHandler);
}
}
else