mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -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.
|
||||
*/
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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
|
||||
|
Reference in New Issue
Block a user