Commit 343dc077 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Fixed most dodgy pathname problems.

  All *LM... commands are now filing system commands.
  *Connect and *Disconnect renamed to *LMConnect and *LMDisconnect.
Detail:
  When translating RISC OS to DOS filenames, a loop could develop if
    any path component contained a dodgy character.  This is now fixed
    with the exception of problems when both < and > characters appear
    in pathnames since that confuses FileSwitch.  New mappings will be
    need to be agreed for these characters (and remappings for $ and %
    which overload < and > respectively)
  All *LM... commands are now filing system commands, which means that
    you need to prefix them with LanMan: unless LanManFS is the current
    filesystem (following spec review).
  *Connect and *Disconnect renamed to *LMConnect and *LMDisconnect
    (following spec review).
  Trace builds allow "*LanMan:LMNameMode 4" to enable display of system
    and hidden files on the remote filesystem.
Admin:
  Tested briefly against Windows 98 and Windows NT 4 SP3.
  If a directory name contains a dodgy character, repeated searches will
    be made on the remote filesystem.  This is inefficient and a name
    cache would alleviate this.  There is no name cacheing in the current
    version.

Version 1.87, 1.1.1.1.2.9. Tagged as 'LanManFS-1_87-1_1_1_1_2_9'
parent f18708fa
......@@ -4,11 +4,11 @@
*
*/
#define Module_MajorVersion_CMHG 1.87
#define Module_MinorVersion_CMHG 1.1.1.1.2.8
#define Module_Date_CMHG 22 Jan 1999
#define Module_MinorVersion_CMHG 1.1.1.1.2.9
#define Module_Date_CMHG 03 Feb 1999
#define Module_MajorVersion "1.87"
#define Module_Version 187
#define Module_MinorVersion "1.1.1.1.2.8"
#define Module_Date "22 Jan 1999"
#define Module_MinorVersion "1.1.1.1.2.9"
#define Module_Date "03 Feb 1999"
......@@ -34,6 +34,7 @@
#include "xlate.h"
#include "attr.h"
#include "smb.h"
#include "Transact.h"
/* Some globals ================================== */
......@@ -203,6 +204,7 @@ static err_t Func_ReadDir ( int reason, char *path_name, char *buffer,
int n_names, int dir_offset, int buflen, int *pOutNread,
int *pOutNextOffset )
{
static Transact_SearchContext scon;
int tmp;
err_t res;
......@@ -272,7 +274,7 @@ static err_t Func_ReadDir ( int reason, char *path_name, char *buffer,
strcpy ( RD_CurrentPath, DOSnamebuf);
RD_CurOffset = 0;
res = SMB_ReadDirEntries ( DOSnamebuf, RD_ReqCount+RD_ReqOffset,
Dir_CallbackFn, NULL );
Dir_CallbackFn, NULL, &scon );
}
else
res = OK;
......@@ -284,7 +286,7 @@ static err_t Func_ReadDir ( int reason, char *path_name, char *buffer,
{
debug0("\n>> Continue search\n");
res = SMB_ReadDirEntries ( NULL, RD_ReqCount+RD_ReqOffset-RD_CurOffset,
Dir_CallbackFn, NULL );
Dir_CallbackFn, NULL, &scon );
}
/* Process results */
......
......@@ -448,7 +448,11 @@ static _kernel_oserror *Cmd_LMNAMEMODE ( const char *args )
if ( GetArgs( args, argv, 1 ) < 1 ||
sscanf( argv[0], "%d", &tmp) != 1 ||
tmp < 0 ||
#ifdef TRACE
0
#else
tmp > 2
#endif
)
return Xlt_Error (EBADPARAM);
......@@ -654,6 +658,31 @@ static CommandFnPtr Cmd_Dispatch[MAX_CMDS] =
Cmd_NBNSIP
};
#ifdef TRACE
static void chk_a_command(CommandFnPtr ptr, int num)
{
if (Cmd_Dispatch[num] != ptr) {
fprintf(stderr, "Command-table error (%d)\n", num);
}
}
static void chk_commands(void)
{
chk_a_command(Cmd_LANMAN, CMD_LanMan);
chk_a_command(Cmd_CONNECT, CMD_LMConnect);
chk_a_command(Cmd_DISCONNECT, CMD_LMDisconnect);
chk_a_command(Cmd_LOGON, CMD_LMLogon);
chk_a_command(Cmd_LMINFO, CMD_LMInfo);
chk_a_command(Cmd_LMNAMEMODE, CMD_LMNameMode);
chk_a_command(Cmd_LOGOFF, CMD_LMLogoff);
chk_a_command(Cmd_LMSERVER, CMD_LMServer);
chk_a_command(Cmd_LMPRINTERS, CMD_LMPrinters);
chk_a_command(Cmd_LMSTATS, CMD_LMStats);
chk_a_command(Cmd_FS, CMD_FS);
chk_a_command(Cmd_LMTRANSPORT, CMD_LMTransport);
chk_a_command(Cmd_NBNSIP, CMD_LMNameServer);
}
#endif
/* --------------------- */
_kernel_oserror *LM_Command ( const char *args, int argc, int cmd_no, void *pw )
......@@ -942,7 +971,11 @@ _kernel_oserror *LM_Initialise(const char *cmd_tail, int pod_base, void *pw)
if (R.r[1] < 0xA2)
return Xlt_Error(ERISCOSVER);
if (cmd_tail != NULL)
#ifdef TRACE
chk_commands();
#endif
if (cmd_tail != NULL)
{
err = Xlt_Error(ProcessCmdLine(cmd_tail));
if (err != NULL)
......
......@@ -230,7 +230,7 @@ EXPORT err_t _NB_FormatName ( nametype_t nt, char *name, NETNAME *res )
for ( i=0; i<15; i++)
{
if ( name[i] < 0x20 ) break;
if ( name[i] <= 0x20 ) break;
if (name[i] == '\xA0') res->b[i] = ' ';
else res->b[i] = toupper(name[i]);
}
......@@ -248,8 +248,9 @@ EXPORT nametype_t _NB_DecodeName ( NETNAME *pnn, char *buf )
{
BYTE *p = pnn->b;
char *last_nonsp = buf;
int i;
while ( *p >= 0x20 )
for (i=0; i<15 && *p >= 0x20; ++i)
*buf++ = *p++;
*buf = 0;
......@@ -1243,7 +1244,7 @@ static NAME_ENTRY *FindRemoteName ( NETNAME *pnn )
pNE->nn = *pnn; /* Copy name */
pNE->pStatResp = NULL; /* for safety */
for ( i=3; i>=0; i-- )
if (0) for ( i=3; i>=0; i-- )
{
if ( i > 0 ) /* Send 3 broadcasts */
{
......
......@@ -326,8 +326,9 @@ EXPORT nametype_t _NB_DecodeName ( NETNAME *pnn, char *buf )
{
BYTE *p = pnn->b;
char *last_nonsp = buf;
int i;
while ( *p >= 0x20 )
for (i=0; i<15 && *p >= 0x20; ++i)
*buf++ = *p++;
*buf = 0;
......
......@@ -84,12 +84,12 @@
#include "buflib.h"
#include "netbios.h"
#include "smb.h"
#include "lmvars.h"
#include "attr.h" /* For InvalidateDrive */
#include "xlate.h" /* For string functions */
#ifdef LONGNAMES
#include "Transact.h" /* for transaction structure building helpers */
#endif
#include "lmvars.h"
#include "attr.h" /* For InvalidateDrive */
#include "xlate.h" /* For string functions */
/* Definitions ===================================================== */
......@@ -239,7 +239,6 @@ typedef struct
#define ERRCMD 0xFF
#define SEARCH_ST_SIZE 21
#define SEARCH_TOT_SIZE 43
#define SEARCH_COUNT 10
......@@ -317,7 +316,6 @@ struct ActiveShare
char sharename[SHARENAME_LEN]; /* upper case */
};
typedef struct ActiveShare *hSHARE;
#define GetFid(FH) ((FH) & 0xFFFF)
#define MakeFH(pS,FID) ((pS)->FH_base | (FID & 0xFFFF) )
......@@ -1843,7 +1841,12 @@ static err_t SMB_GetAttribsX2 (hSHARE hS, char *filename, DOS_ATTRIBS *pAttr )
fnbuffer[4] = '\0';
Transact_init(&tp, 6 * 2); /* will accept 6 WORD return params */
Transact_addsetupword(&tp, TRANSACT2_FINDFIRST);
if (LM_Vars.namemode & 4) {
Transact_addword(&tp, ATTR_DIR | ATTR_SYS | ATTR_HID); /* findfirst_Attribute */
}
else {
Transact_addword(&tp, ATTR_DIR); /* findfirst_Attribute */
}
Transact_addword(&tp, 1); /* findfirst_SearchCount */
Transact_addword(&tp, 0); /* findfirst_flags */
Transact_addword(&tp, 1); /* Search level */
......@@ -2094,13 +2097,6 @@ err_t SMB_GetFreeSpace ( char lettr, struct disk_size_response *pDSR )
/* ------------------------------- */
/* State which is held from one call to the next of
SMB_EnumerateDir */
static bool NextSearchOK;
static BYTE SearchState[SEARCH_ST_SIZE];
static hSHARE SearchDrive;
#ifdef LONGNAMES
/* Note.
......@@ -2123,12 +2119,9 @@ static err_t SMB_AbandonFind2( hSHARE hS, WORD dir_handle )
}
static err_t SMB_ReadDirEntriesX2 ( hSHARE hS, char *path, int count,
ENUM_DIR_FN dirfn, void *private )
ENUM_DIR_FN dirfn, void *private,
struct Transact2_SearchContext *con )
{
static struct TransactParms tp;
static DWORD resume_key;
static WORD dir_handle;
static char last_filename[DOS_NAME_LEN];
char *ptr_last_filename;
err_t res;
BYTE *p;
......@@ -2140,16 +2133,16 @@ static err_t SMB_ReadDirEntriesX2 ( hSHARE hS, char *path, int count,
const int next_flags = /*ffirst_CLOSE_IF_DONE |*/ ffirst_RETURN_KEYS;// | fnext_CONTINUE;
int flags;
if (path != NULL && NextSearchOK == true || count < 0) {
if (path != NULL && con->t1.NextSearchOK == true || count < 0) {
/* We need to abandon the current search attached to dir_handle.
* Ignore errors.
*/
debug3("SMB_ReadDirEntriesX2 -> path (%p) NextSearchOK (%d) count (%d)\n",
path, NextSearchOK, count);
(void) SMB_AbandonFind2( hS, dir_handle );
path, con->t1.NextSearchOK, count);
(void) SMB_AbandonFind2( hS, con->dir_handle );
}
NextSearchOK = false;
con->t1. NextSearchOK = false;
if (count < 0) return ENOMOREFILES;
//count = min (count, 10);
......@@ -2159,38 +2152,43 @@ static err_t SMB_ReadDirEntriesX2 ( hSHARE hS, char *path, int count,
/* Initial search - note we accept SIX return parameters - contrary to
* Microsoft's own document - because it doesn't work if you only pass 5. Grr.
*/
resume_key = 0;
con->resume_key = 0;
flags = first_flags;
Transact_init(&tp, 6 * 2); /* will accept 6 WORD return params */
Transact_addsetupword(&tp, TRANSACT2_FINDFIRST);
Transact_addword(&tp, ATTR_DIR); /* findfirst_Attribute */
Transact_addword(&tp, count); /* findfirst_SearchCount */
Transact_addword(&tp, first_flags); /* findfirst_flags */
Transact_addword(&tp, 1); /* Search level */
Transact_addlong(&tp, 0L); /* reserved, MBZ */
Transact_addstring(&tp, path+2); /* findfirst_FileName[] */
res = SMB_Transact2(hS, &tp);
Transact_init(&con->tp, 6 * 2); /* will accept 6 WORD return params */
Transact_addsetupword(&con->tp, TRANSACT2_FINDFIRST);
if (LM_Vars.namemode & 4) {
Transact_addword(&con->tp, ATTR_DIR | ATTR_SYS | ATTR_HID); /* findfirst_Attribute */
}
else {
Transact_addword(&con->tp, ATTR_DIR); /* findfirst_Attribute */
}
Transact_addword(&con->tp, count); /* findfirst_SearchCount */
Transact_addword(&con->tp, first_flags); /* findfirst_flags */
Transact_addword(&con->tp, 1); /* Search level */
Transact_addlong(&con->tp, 0L); /* reserved, MBZ */
Transact_addstring(&con->tp, path+2); /* findfirst_FileName[] */
res = SMB_Transact2(hS, &con->tp);
if (res != OK)
return res;
p = tp.parms_out_buf;
dir_handle = Transact_getword(p); p += 2;
debug1("SID = 0x%04hx\n", dir_handle);
p = con->tp.parms_out_buf;
con->dir_handle = Transact_getword(p); p += 2;
debug1("SID = 0x%04hx\n", con->dir_handle);
}
else {
/* continuation */
flags = next_flags;
Transact_init(&tp, 4 * 2); /* will accept 4 WORD return params */
Transact_addsetupword(&tp, TRANSACT2_FINDNEXT);
Transact_addword(&tp, dir_handle); /* findnext_DirHandle */
Transact_addword(&tp, count); /* findnext_SearchCount */
Transact_addword(&tp, 1); /* Search level */
Transact_addlong(&tp, resume_key); /* Resume key from previous */
Transact_addword(&tp, next_flags); /* findnext_flags */
Transact_addstring(&tp, last_filename); /* resumption filename */
res = SMB_Transact2(hS, &tp);
Transact_init(&con->tp, 4 * 2); /* will accept 4 WORD return params */
Transact_addsetupword(&con->tp, TRANSACT2_FINDNEXT);
Transact_addword(&con->tp, con->dir_handle); /* findnext_DirHandle */
Transact_addword(&con->tp, count); /* findnext_SearchCount */
Transact_addword(&con->tp, 1); /* Search level */
Transact_addlong(&con->tp, con->resume_key); /* Resume key from previous */
Transact_addword(&con->tp, next_flags); /* findnext_flags */
Transact_addstring(&con->tp, con->last_filename); /* resumption filename */
res = SMB_Transact2(hS, &con->tp);
if (res != OK)
return res;
p = tp.parms_out_buf;
p = con->tp.parms_out_buf;
}
/* Remainder of response handling is common to both sub-commands */
n_read = Transact_getword(p); p += 2;
......@@ -2201,14 +2199,14 @@ static err_t SMB_ReadDirEntriesX2 ( hSHARE hS, char *path, int count,
ptr_last_filename = NULL;
}
else {
ptr_last_filename = (char *) tp.data_out_buf + lastname;
ptr_last_filename = (char *) con->tp.data_out_buf + lastname;
}
if (eos) {
debug0(">> Server said it was the end of the search operation\n");
}
p = tp.data_out_buf;
p = con->tp.data_out_buf;
/* At this point, p is pointing to the start of the returned data
* buffer, n_read contains the number of files known to be in the
* return buffer, eos is non-zero if the search is completed.
......@@ -2238,20 +2236,20 @@ static err_t SMB_ReadDirEntriesX2 ( hSHARE hS, char *path, int count,
//NextSearchOK = eos ? false : true;
debug0("Bugger. Looks like client ran out of space (or could be name xlate code)\n");
if (eos) {
(void) SMB_AbandonFind2( hS, dir_handle );
(void) SMB_AbandonFind2( hS, con->dir_handle );
}
else {
int j;
NextSearchOK = true;
con->t1.NextSearchOK = true;
for (j=i; j<n_read; ++j) dirfn(p, 1, private);
}
return EOUTOFMEM;
}
else {
resume_key = next_resume_key;
con->resume_key = next_resume_key;
ptr_last_filename = (char *) p + 23;
(void) strncpy(last_filename, ptr_last_filename?ptr_last_filename:"",
sizeof(last_filename));
(void) strncpy(con->last_filename, ptr_last_filename?ptr_last_filename:"",
sizeof(con->last_filename));
}
p += 23 + length + 1;
if ( i == count ) /* By implication, if n_read >= count */
......@@ -2259,48 +2257,52 @@ static err_t SMB_ReadDirEntriesX2 ( hSHARE hS, char *path, int count,
debug3("i = %3d; count = %3d; n_read = %3d\n", i, count, n_read);
debug0("OK - there are more to come later; ");
if (flags & ffirst_RETURN_KEYS) {
debug1("Resume key is 0x%08x; ", resume_key);
debug1("Resume key is 0x%08x; ", con->resume_key);
}
debug1("Next filename is `%s'\n", last_filename);
NextSearchOK = true;
debug1("Next filename is `%s'\n", con->last_filename);
con->t1.NextSearchOK = true;
}
}
if (eos) {
debug0(">> Server said it was the end of the search operation\n");
NextSearchOK = false;
con->t1.NextSearchOK = false;
}
return NextSearchOK ? OK : ENOMOREFILES;
return con->t1.NextSearchOK ? OK : ENOMOREFILES;
}
#endif
err_t SMB_ReadDirEntries ( char *path, int count,
ENUM_DIR_FN dirfn, void *private )
ENUM_DIR_FN dirfn, void *private, Transact_SearchContext *conp )
{
err_t res;
int i, n_read;
BYTE *entry;
BUFCHAIN pB, pBres;
static Transact_SearchContext rde_context;
struct Transact1_SearchContext *con;
con = (conp == NULL) ? &rde_context.t1 : &conp->t1;
/* Start or continue search? */
if ( path != NULL ) /* Start search */
{
SearchDrive = GetShare(path, &res);
if ( SearchDrive == NULL )
con->SearchDrive = GetShare(path, &res);
if ( con->SearchDrive == NULL )
return res;
}
else
{
if ( !NextSearchOK || SearchDrive == NULL )
if ( !con->NextSearchOK || con->SearchDrive == NULL )
return ENOMOREFILES;
}
#ifdef LONGNAMES
if (SearchDrive->t2flags & T2FLAGS_LONGNAMES)
if (con->SearchDrive->t2flags & T2FLAGS_LONGNAMES)
{
return SMB_ReadDirEntriesX2(SearchDrive, path, count, dirfn, private);
struct Transact2_SearchContext *const t2sc = (conp == NULL) ? &rde_context.t2 : &conp->t2;
return SMB_ReadDirEntriesX2(con->SearchDrive, path, count, dirfn, private, t2sc);
}
#endif
......@@ -2319,7 +2321,7 @@ err_t SMB_ReadDirEntries ( char *path, int count,
}
else /* Continue search */
{
pB = MkDataBlock (NULL, DATA_VARBLK, SearchState,
pB = MkDataBlock (NULL, DATA_VARBLK, con->SearchState,
SEARCH_ST_SIZE, false);
if ( pB != NULL)
pB = MkDataString( pB, DATA_ASCII, "" );
......@@ -2332,9 +2334,9 @@ err_t SMB_ReadDirEntries ( char *path, int count,
SMB_TxWords[0] = count;
SMB_TxWords[1] = ATTR_DIR /* | ATTR_SYS | ATTR_HID */;
NextSearchOK = false;
con->NextSearchOK = false;
res = Do_SMB ( SearchDrive, SMBsearch, 2, pB, &pBres );
res = Do_SMB ( con->SearchDrive, SMBsearch, 2, pB, &pBres );
if ( res != OK )
return res;
......@@ -2353,14 +2355,14 @@ err_t SMB_ReadDirEntries ( char *path, int count,
dirfn ( entry+SEARCH_ST_SIZE, 0, private );
if ( i == count ) /* By implication, if n_read >= count */
{
NextSearchOK = true;
memcpy ( SearchState, entry, SEARCH_ST_SIZE );
con->NextSearchOK = true;
memcpy ( con->SearchState, entry, SEARCH_ST_SIZE );
}
entry += SEARCH_TOT_SIZE;
}
/* Return OK, or 'no more' */
return NextSearchOK ? OK : ENOMOREFILES;
return con->NextSearchOK ? OK : ENOMOREFILES;
}
/* Public file read/write operations ============================= */
......
......@@ -38,10 +38,42 @@
#ifdef LONGNAMES
//#include "NFSConsts.h"
#define FileChar_TypedNamePrefix ','
#define FileString_DeadFile "xxx"
#define FileString_UntypedFile "lxa"
/* Magic value used to indicate an incomplete file - used by the Filer,
* for example, when writing a new file
*/
static const int deaddead = 0xDEADDEAD;
/* For the moment, untyped files have these invented load/exec addresses.
* They ensure that if such a file is *Load'ed or *Run'ed, then a data
* abort will occur
*/
static const int untyped_load = 0x03800000;
static const int untyped_exec = 0x03800000;
/* Macro returns non-zero if the specifiec load addressis indicative of
* a filetyped object. Rather than checking for the top 12 bits being
* set, it's much quicker to arithmetic shift it right 20 bits and test
* for -1. (Norcroft generates: MVN rn, #0: TEQ rn, ra, ASR #20)
*/
#define IS_FILETYPED(load_addr) ((((signed int)(load_addr)) >> 20) == -1)
/* Extracts the filetype from a load address. Assumes that IS_FILETYPED
* would return non-zero. In isolation, Norcroft generates:
* MOV ra, ra, LSL #12: MOV ra, ra, LSR #20.
*/
#define GET_FILETYPE(load_addr) ((((unsigned int)(load_addr)) << 12) >> 20)
/* Encodes a filetype into a load address - Norcroft compiler makes a
* nice job of this macro (result in load): ORR rn, load, #0xf0000000
* ORR rn, rn, #0x0FF00000: MOV load,load,LSL #12:
* EOR load, type, load LSR #20: EOR load,rn,load LSL #8
*/
#define ENCODE_FILETYPE(load,type) \
(((load)|0xFFF00000)^((GET_FILETYPE(load)^(type))<<8))
#endif
......@@ -609,7 +641,7 @@ static const char lanmanfs_lookup_table[257]=
static const char lanmanfs_inverse_lookup_table[257]=
"________________________________"
"\xa0!\"?<>+'()*+,-\\.0123456789:;<=>#"
"\xa0!\"?$%+'()*+,-\\.0123456789:;<=>#"
"=ABCDEFGHIJKLMNOPQRSTUVWXYZ[.],_"
"`abcdefghijklmnopqrstuvwxyz{|}~_"
"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ"
......@@ -619,19 +651,25 @@ static const char lanmanfs_inverse_lookup_table[257]=
/* These two structures MUST be kept in step in order to allow the
* wildcard resolution code function correctly
* wildcard resolution code function correctly.
*/
static const char lanmanfs_contentious_characters[]=
"+=><,\xa0";
static const char lanmanfs_contentious_pairing[]=
"&@%$^\x20";
/* Translate DOS names to RISC OS names using the translation table
*
* This routine translates the given DOS filename into the RISC OS filename,
* stripping the file extension if there is one and setting up the pRA
* structure with the type details of the file.
*/
static void Xlt_NameDOStoROX2 ( char *dst, char *src, RISCOS_ATTRIBS *pRA )
{
int i;
char *odst = dst;
for ( i=0; i<255; i++ ) /* Length limit is 255 chars */
for ( i=0; i<(DOS_NAME_LEN-1); i++ ) /* Length limit is 255 chars */
{
int c = src[i] & 0xFF;
if (c == 0) break; /* Found the terminator */
......@@ -649,50 +687,69 @@ static void Xlt_NameDOStoROX2 ( char *dst, char *src, RISCOS_ATTRIBS *pRA )
}
}
/* This is slightly more complicated now by the ,xxx naming scheme.
*
* This function returns ENOWILDCARD if the file exists remotely and
* has exactly the same name as was requested. This implies that it
* was a text file or a directory.
*
* If it returns OK, then it means that the file exists but requires
* a wildcard lookup.
/* This function copies the string src to dst. Once it gets past the
* level'th character, it maps each character through the RISC OS->DOS
* character conversion table.
*
* If it returns ENOTPRESENT, then it means that the file definitely
* is not there.
* This means that partially converted filenames can be copied verbatim
* and the not-yet-done portions translated as required.
*/
static int Xlt_CopyViaInverseTable( char *dst, const char *src, int blat )
static void Xlt_CopyViaInverseTable( char *dst, const char *src, int level )
{
int wild_count = 0, c, i;
int i;
for ( i=0; i<(DOS_NAME_LEN-1); i++ )
{
c = src[i] & 0xFF;
int c = src[i] & 0xFF;
if (c == 0) break;
if (strchr(lanmanfs_contentious_characters, c)) {
++wild_count;
if (blat) {
dst[i] = '?';
continue;
}
if (i < level) {
dst[i] = c;
}
else {
dst[i] = lanmanfs_inverse_lookup_table[c];
}
dst[i] = lanmanfs_inverse_lookup_table[c];
}
dst[i] = 0;
return wild_count;
}
/* Temporary state data structure for the filename mangling */
typedef struct {
char *dstcpy;
char dstcpybuf[DOS_NAME_LEN + 4];
char matchbuf[DOS_NAME_LEN + 4];
} Xlt_NXCX2_Data;
/* Xlt_ContentiousCharCheck
*
* Checks contentious characters. Returns the actual remote char if
* the chars are not equal but match under the contentious char table.
* Returns '\0' if no match is found.
*/
static char Xlt_ContentiousCharCheck(char e, char d)
{
int i;
for (i=0; lanmanfs_contentious_characters[i]; ++i) {
if ((e == lanmanfs_contentious_characters[i] ||
e == lanmanfs_contentious_pairing[i]) &&
(d == lanmanfs_contentious_characters[i] ||
d == lanmanfs_contentious_pairing[i])) {
return e;
}
}
return '\0';
}
/* An unusual routine. The SMB_ReadDirectoryEntriesX2 routine calls this
* function back in order to process each directory entry as it is
* discovered whilst we are searching for filename matches. In order to
* get that routine to stop when we have found a match, we return it a
* value of EOUTOFMEM. If we want it to continue, we return OK.
* value of EOUTOFMEM. If we want it to continue, we return OK. The
* private handle (_dst) is actually a pointer to the state structure
* and that structure is updated with the real filename once a match
* has been found. The format parameter should always be 1.
*/
static err_t Xlt_NameXlateCallbackX2 ( BYTE *entry, int format, void *_dst )
{
......@@ -728,27 +785,28 @@ static err_t Xlt_NameXlateCallbackX2 ( BYTE *entry, int format, void *_dst )
}
}
else {
int i;
for (i=0; lanmanfs_contentious_characters[i]; ++i) {
if ((e == lanmanfs_contentious_characters[i] ||
e == lanmanfs_contentious_pairing[i]) &&