Source
...
Target
Commits (2)
  • Robert Sprowson's avatar
    Fix for *INFO dates not matching *EX dates · a0fb97c2
    Robert Sprowson authored
    These two displays take different code paths, and *INFO goes via a check to workaround a bug in Win98 servers. Unfortunately, the check no longer works because Microsoft don't return the '.' and '..' entries in SMB Trans2 FIND_FIRST, and the logic previously always set the "need to frig the dates" flag. Now, the flag is only set if something comes back and after doing a test swap the results are also correct.
    Turned on the 'auto close Trans2 FIND_FIRST' flag in the request block to save having to do a second transaction to close it.
    Swapped the LDMFD/STMFD for Push and Pull in the assembler.
    Tested against WinXP SP3, dates are no longer bonkers.
    
    Version 2.35. Tagged as 'LanManFS-2_35'
    a0fb97c2
  • Robert Sprowson's avatar
    5977e5ce
/* (2.34) /* (2.35)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 2.34 #define Module_MajorVersion_CMHG 2.35
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 01 Aug 2009 #define Module_Date_CMHG 15 Oct 2011
#define Module_MajorVersion "2.34" #define Module_MajorVersion "2.35"
#define Module_Version 234 #define Module_Version 235
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "01 Aug 2009" #define Module_Date "15 Oct 2011"
#define Module_ApplicationDate "01-Aug-09" #define Module_ApplicationDate "15-Oct-11"
#define Module_ComponentName "LanManFS" #define Module_ComponentName "LanManFS"
#define Module_ComponentPath "castle/RiscOS/Sources/Networking/Omni/Protocols/LanManFS" #define Module_ComponentPath "castle/RiscOS/Sources/Networking/Omni/Protocols/LanManFS"
#define Module_FullVersion "2.34" #define Module_FullVersion "2.35"
#define Module_HelpVersion "2.34 (01 Aug 2009)" #define Module_HelpVersion "2.35 (15 Oct 2011)"
#define Module_LibraryVersionInfo "2:34" #define Module_LibraryVersionInfo "2:35"
...@@ -253,7 +253,7 @@ static int SearchFileForEntry ( int FH, char *name ) ...@@ -253,7 +253,7 @@ static int SearchFileForEntry ( int FH, char *name )
/* --------------------------- */ /* --------------------------- */
static bool CacheEmpty () static bool CacheEmpty (void)
{ {
int i; int i;
for ( i=0; i<AttrCacheLen; i++) for ( i=0; i<AttrCacheLen; i++)
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "os.h" #include "os.h"
#include "swis.h" #include "swis.h"
#include "sys/dcistructs.h" #include "sys/dcistructs.h"
#include "AsmUtils/callbacks.h"
/* Our includes */ /* Our includes */
...@@ -130,7 +131,7 @@ int LLC_CallbackFn_handler(_kernel_swi_regs *r, void *pw) ...@@ -130,7 +131,7 @@ int LLC_CallbackFn_handler(_kernel_swi_regs *r, void *pw)
/* --------------------- */ /* --------------------- */
static void SetCallback() static void SetCallback(void)
{ {
if (!CallbackSet) if (!CallbackSet)
{ {
...@@ -601,7 +602,7 @@ err_t LLC_AttachDriver( char *name, const NETADDR *Multi_Addr ) ...@@ -601,7 +602,7 @@ err_t LLC_AttachDriver( char *name, const NETADDR *Multi_Addr )
/* --------------------------------- */ /* --------------------------------- */
static void DetachDriver() static void DetachDriver(void)
{ {
_kernel_swi_regs R; _kernel_swi_regs R;
...@@ -1238,9 +1239,9 @@ static void ReceiveProcess (BUFCHAIN pB) ...@@ -1238,9 +1239,9 @@ static void ReceiveProcess (BUFCHAIN pB)
LLC_RcvProcess( &srcaddr, pB); LLC_RcvProcess( &srcaddr, pB);
} }
/* LLC_BackgroundProcess() -------------------------- */ /* LLC_BackgroundProcess(void) -------------------------- */
void LLC_BackgroundProcess() void LLC_BackgroundProcess(void)
{ {
BUFCHAIN pB; BUFCHAIN pB;
...@@ -1560,7 +1561,7 @@ void LLC_Shutdown ( void ) ...@@ -1560,7 +1561,7 @@ void LLC_Shutdown ( void )
/* 25/3/96 - if our callback has been set, collect it now before /* 25/3/96 - if our callback has been set, collect it now before
we leave. All rx packets have been flushed & timers deleted, we leave. All rx packets have been flushed & timers deleted,
so it is safe to do this without fear of the consequences */ so it is safe to do this without fear of the consequences */
CollectCallbacks(); usermode_donothing();
for ( i=0; i < MAX_LLC_CONN; i++ ) for ( i=0; i < MAX_LLC_CONN; i++ )
{ {
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "kernel.h" #include "kernel.h"
#include "os.h" #include "os.h"
#include "swis.h" #include "swis.h"
#include "AsmUtils/callbacks.h"
/* Our includes */ /* Our includes */
...@@ -1331,7 +1332,7 @@ static NAME_ENTRY *FindRemoteName ( NETNAME *pnn ) ...@@ -1331,7 +1332,7 @@ static NAME_ENTRY *FindRemoteName ( NETNAME *pnn )
tstart = NB_GetTime(); tstart = NB_GetTime();
do do
{ {
CollectCallbacks(); usermode_donothing();
NBIP_CallbackFn_handler(); NBIP_CallbackFn_handler();
if (pNE->status == RMT_FOUND) if (pNE->status == RMT_FOUND)
{ {
...@@ -1428,7 +1429,7 @@ EXPORT err_t _NB_AddLocalName ( nametype_t nt, char *name, hNAME *phName ) ...@@ -1428,7 +1429,7 @@ EXPORT err_t _NB_AddLocalName ( nametype_t nt, char *name, hNAME *phName )
tstart = NB_GetTime(); tstart = NB_GetTime();
do do
{ {
CollectCallbacks(); usermode_donothing();
NBIP_CallbackFn_handler(); NBIP_CallbackFn_handler();
if ( pNE->status == LCL_IN_CONFLICT ) /* Failed */ if ( pNE->status == LCL_IN_CONFLICT ) /* Failed */
{ {
...@@ -1469,7 +1470,7 @@ EXPORT err_t _NB_RemoveLocalName ( hNAME hName ) ...@@ -1469,7 +1470,7 @@ EXPORT err_t _NB_RemoveLocalName ( hNAME hName )
tstart = NB_GetTime(); tstart = NB_GetTime();
do do
{ {
CollectCallbacks(); usermode_donothing();
NBIP_CallbackFn_handler(); NBIP_CallbackFn_handler();
} }
while ( (NB_GetTime() - tstart) < 50 ); while ( (NB_GetTime() - tstart) < 50 );
...@@ -1515,7 +1516,7 @@ EXPORT int _NB_FindNames ( NETNAME *pnnFind, ...@@ -1515,7 +1516,7 @@ EXPORT int _NB_FindNames ( NETNAME *pnnFind,
tstart = NB_GetTime(); tstart = NB_GetTime();
do do
{ {
CollectCallbacks(); usermode_donothing();
NBIP_CallbackFn_handler(); NBIP_CallbackFn_handler();
} }
while ( SR.spaces_left > 0 && (NB_GetTime() - tstart) < timeout ); while ( SR.spaces_left > 0 && (NB_GetTime() - tstart) < timeout );
...@@ -1532,7 +1533,7 @@ EXPORT int _NB_FindNames ( NETNAME *pnnFind, ...@@ -1532,7 +1533,7 @@ EXPORT int _NB_FindNames ( NETNAME *pnnFind,
tstart = NB_GetTime(); tstart = NB_GetTime();
do do
{ {
CollectCallbacks(); usermode_donothing();
NBIP_CallbackFn_handler(); NBIP_CallbackFn_handler();
} }
while ( SR.spaces_left > 0 && (NB_GetTime() - tstart) < timeout ); while ( SR.spaces_left > 0 && (NB_GetTime() - tstart) < timeout );
...@@ -1602,7 +1603,7 @@ static bool ReadData ( int sid, BYTE *where, int len, uint timeout, int flags ) ...@@ -1602,7 +1603,7 @@ static bool ReadData ( int sid, BYTE *where, int len, uint timeout, int flags )
while ( len > 0 ) while ( len > 0 )
{ {
CollectCallbacks(); /* Let IP do its thing */ usermode_donothing(); /* Let IP do its thing */
NBIP_CallbackFn_handler(); /* Process any datagrams */ NBIP_CallbackFn_handler(); /* Process any datagrams */
tv.tv_sec=0; tv.tv_sec=0;
...@@ -1827,7 +1828,7 @@ EXPORT err_t _NB_SendData ( hSESSION hS, BUFCHAIN Data ) ...@@ -1827,7 +1828,7 @@ EXPORT err_t _NB_SendData ( hSESSION hS, BUFCHAIN Data )
} }
while ( i==IOV_MAX ); while ( i==IOV_MAX );
CollectCallbacks(); usermode_donothing();
FreeChain(Data); FreeChain(Data);
return OK; return OK;
} }
...@@ -1867,7 +1868,7 @@ EXPORT err_t _NB_SendBlockData ( hSESSION hS, BYTE *where, int datalen ) ...@@ -1867,7 +1868,7 @@ EXPORT err_t _NB_SendBlockData ( hSESSION hS, BYTE *where, int datalen )
return ELINKFAILED; return ELINKFAILED;
} }
CollectCallbacks(); usermode_donothing();
return OK; return OK;
} }
......
...@@ -1804,64 +1804,75 @@ static err_t SMB_GetAttribsX2 (hSHARE hS, char *filename, DOS_ATTRIBS *pAttr ) ...@@ -1804,64 +1804,75 @@ static err_t SMB_GetAttribsX2 (hSHARE hS, char *filename, DOS_ATTRIBS *pAttr )
return Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, pAttr, NULL); return Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, pAttr, NULL);
} }
if (!(hS->hServer->t2flags & T2FLAGS_TESTEDSWAP)) { if (!(hS->hServer->t2flags & T2FLAGS_TESTEDSWAP))
{
/* Need to test whether we have to swap the date/time fields */ /* Need to test whether we have to swap the date/time fields */
char fnbuffer[8]; char fnbuffer[8];
DOS_ATTRIBS aattrbuf; DOS_ATTRIBS aattrbuf;
DOS_ATTRIBS sattrbuf;
hS->hServer->t2flags |= T2FLAGS_TESTEDSWAP; hS->hServer->t2flags |= T2FLAGS_TESTEDSWAP;
fnbuffer[0] = *filename; fnbuffer[0] = *filename;
fnbuffer[1] = ':'; fnbuffer[1] = ':';
fnbuffer[2] = '\\'; fnbuffer[2] = '\\';
fnbuffer[3] = '\0'; fnbuffer[3] = '\0';
debug1("Looking up `%s' to test buffer format\n", fnbuffer); debug1("Looking up `%s' to test buffer format\n", fnbuffer);
if (SMB_GetAttribsX2 ( hS, fnbuffer, &aattrbuf ) == OK) { if (SMB_GetAttribsX2 ( hS, fnbuffer, &aattrbuf ) == OK)
{
fnbuffer[3] = '\0'; fnbuffer[3] = '\0';
fnbuffer[4] = '\0';
Transact_init(&tp, 6 * 2); /* will accept 6 WORD return params */ Transact_init(&tp, 6 * 2); /* will accept 6 WORD return params */
Transact_addsetupword(&tp, TRANSACT2_FINDFIRST); Transact_addsetupword(&tp, TRANSACT2_FINDFIRST);
if (LM_Vars.namemode & NM_INTERNAL) { if (LM_Vars.namemode & NM_INTERNAL)
Transact_addword(&tp, ATTR_DIR | ATTR_SYS | ATTR_HID); /* findfirst_Attribute */ { /* findfirst_Attribute */
Transact_addword(&tp, ATTR_DIR | ATTR_SYS | ATTR_HID);
} }
else { else
Transact_addword(&tp, ATTR_DIR); /* findfirst_Attribute */ {
Transact_addword(&tp, ATTR_DIR);
} }
Transact_addword(&tp, 1); /* findfirst_SearchCount */ Transact_addword(&tp, 1); /* findfirst_SearchCount = 1 please */
Transact_addword(&tp, 0); /* findfirst_flags */ Transact_addword(&tp, 1); /* findfirst_Flags = auto close after this query */
Transact_addword(&tp, 1); /* Search level */ Transact_addword(&tp, 1); /* Search level = standard level */
Transact_addlong(&tp, 0L); /* reserved, MBZ */ Transact_addlong(&tp, 0L); /* reserved, MBZ */
Transact_addstring(&tp, fnbuffer+2); /* findfirst_FileName[] */ Transact_addstring(&tp, fnbuffer+2); /* findfirst_FileName[] */
debug1("Looking for `%s'\n", fnbuffer+2); debug1("Looking for `%s'\n", fnbuffer+2);
res = SMB_Transact2(hS, &tp); res = SMB_Transact2(hS, &tp);
if (res == OK) { if (res == OK)
{
debug0("SMB_Transact2 worked\n"); debug0("SMB_Transact2 worked\n");
SMB_TxWords[0] = Transact_getword(tp.parms_out_buf); SMB_TxWords[0] = Transact_getword(tp.parms_out_buf);
if (Transact_getword(tp.parms_out_buf + 2) == 1) { if (Transact_getword(tp.parms_out_buf + 2) == 1)
DOS_ATTRIBS sattrbuf; {
debug1("Filename was `%s'\n", tp.data_out_buf + 23); debug1("Filename was `%s'\n", tp.data_out_buf + 23);
res = Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, &sattrbuf, NULL); res = Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, &sattrbuf, NULL);
if (res == OK) { if (res == OK)
if (sattrbuf.utime != aattrbuf.utime) { {
debug0("Need to swap date/time!\n"); if (sattrbuf.utime != aattrbuf.utime)
hS->hServer->t2flags |= T2FLAGS_SWAPDATETIME; {
swap_time_date(tp.data_out_buf); debug0("Might need to swap date/time\n");
swap_time_date(tp.data_out_buf+0);
swap_time_date(tp.data_out_buf+4); swap_time_date(tp.data_out_buf+4);
swap_time_date(tp.data_out_buf+8); swap_time_date(tp.data_out_buf+8);
Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, &sattrbuf, NULL); Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, &sattrbuf, NULL);
if (sattrbuf.utime != aattrbuf.utime) { if (sattrbuf.utime != aattrbuf.utime)
debug0("Didnt get the right thing anyway\n"); {
debug0("Even after swapping they don't match\n");
} }
else { else
{
hS->hServer->t2flags |= T2FLAGS_SWAPDATETIME;
debug0("Tested and verified!\n"); debug0("Tested and verified!\n");
} }
} }
else { else
{
debug0("Don't need to swap date/time!\n"); debug0("Don't need to swap date/time!\n");
} }
} }
} }
(void) Do_SMB(hS, SMBfindclose2, 1, NULL, NULL);
} }
else { else
{
debug0("SMB_Transact2 failed\n"); debug0("SMB_Transact2 failed\n");
} }
} }
...@@ -1881,7 +1892,8 @@ static err_t SMB_GetAttribsX2 (hSHARE hS, char *filename, DOS_ATTRIBS *pAttr ) ...@@ -1881,7 +1892,8 @@ static err_t SMB_GetAttribsX2 (hSHARE hS, char *filename, DOS_ATTRIBS *pAttr )
* and dates of the file before calling Xlt to expand them ... but only * and dates of the file before calling Xlt to expand them ... but only
* if the remote server has this bug. * if the remote server has this bug.
*/ */
if (hS->hServer->t2flags & T2FLAGS_SWAPDATETIME) { if (hS->hServer->t2flags & T2FLAGS_SWAPDATETIME)
{
swap_time_date(tp.data_out_buf); swap_time_date(tp.data_out_buf);
swap_time_date(tp.data_out_buf+4); swap_time_date(tp.data_out_buf+4);
swap_time_date(tp.data_out_buf+8); swap_time_date(tp.data_out_buf+8);
......
...@@ -89,7 +89,5 @@ extern void veneer_fsentry_gbpb( void ); ...@@ -89,7 +89,5 @@ extern void veneer_fsentry_gbpb( void );
extern void Free_ServiceRoutine(void); extern void Free_ServiceRoutine(void);
extern void CollectCallbacks(void);
extern char Default_FileTName[6]; extern char Default_FileTName[6];
extern int Default_FileType; extern int Default_FileType;
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
; Original based on FSinC ; Original based on FSinC
; 20-10-94 IH Add suicide callback bit ; 20-10-94 IH Add suicide callback bit
; Add 'free' veneer ; Add 'free' veneer
; 26-01-96 Add CollectCallbacks
; ************************************************** ; **************************************************
GET Hdr:ListOpts GET Hdr:ListOpts
...@@ -66,35 +65,35 @@ SWIClass SETS "LanMan" ...@@ -66,35 +65,35 @@ SWIClass SETS "LanMan"
LTORG LTORG
veneer_fsentry_open veneer_fsentry_open
STMFD SP!, {R8} Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*0 MOV R8, #fsentry_branchtable - %F10 + 4*0
B fsentry_common B fsentry_common
veneer_fsentry_getbytes veneer_fsentry_getbytes
STMFD SP!, {R8} Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*1 MOV R8, #fsentry_branchtable - %F10 + 4*1
B fsentry_common B fsentry_common
veneer_fsentry_putbytes veneer_fsentry_putbytes
STMFD SP!, {R8} Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*2 MOV R8, #fsentry_branchtable - %F10 + 4*2
B fsentry_common B fsentry_common
veneer_fsentry_args veneer_fsentry_args
STMFD SP!, {R8} Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*3 MOV R8, #fsentry_branchtable - %F10 + 4*3
B fsentry_common B fsentry_common
veneer_fsentry_close veneer_fsentry_close
STMFD SP!, {R8} Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*4 MOV R8, #fsentry_branchtable - %F10 + 4*4
B fsentry_common B fsentry_common
veneer_fsentry_file veneer_fsentry_file
STMFD SP!, {R8} Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*5 MOV R8, #fsentry_branchtable - %F10 + 4*5
B fsentry_common B fsentry_common
veneer_fsentry_func veneer_fsentry_func
STMFD SP!, {R8} Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*6 MOV R8, #fsentry_branchtable - %F10 + 4*6
B fsentry_common B fsentry_common
veneer_fsentry_gbpb veneer_fsentry_gbpb
STMFD SP!, {R8} Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*7 MOV R8, #fsentry_branchtable - %F10 + 4*7
B fsentry_common B fsentry_common
...@@ -102,7 +101,7 @@ veneer_fsentry_gbpb ...@@ -102,7 +101,7 @@ veneer_fsentry_gbpb
fsentry_common ; os_error *fsentry_common( Parameter_Block * ) fsentry_common ; os_error *fsentry_common( Parameter_Block * )
; Store the input registers onto the stack ; Store the input registers onto the stack
STMFD SP!,{R0-R7, SL, FP, IP, LR} Push "R0-R7, SL, FP, IP, LR"
MOV sl, SP, LSR #20 MOV sl, SP, LSR #20
MOV sl, sl, LSL #20 ; SP_LWM MOV sl, sl, LSL #20 ; SP_LWM
...@@ -132,7 +131,7 @@ fsentry_common ; os_error *fsentry_common( Parameter_Block * ) ...@@ -132,7 +131,7 @@ fsentry_common ; os_error *fsentry_common( Parameter_Block * )
; Save the returned value in R8 ; Save the returned value in R8
MOVS R8, r0 MOVS R8, r0
; Get the stuff off the stack ; Get the stuff off the stack
LDMFD SP!, {r0-r7, sl, fp, ip, lr} Pull "r0-r7, sl, fp, ip, lr"
; If returned value indicates an error, then set the overflow and put it back in r0 ; If returned value indicates an error, then set the overflow and put it back in r0
MOVNE r0, R8 MOVNE r0, R8
...@@ -156,7 +155,7 @@ fsentry_common ; os_error *fsentry_common( Parameter_Block * ) ...@@ -156,7 +155,7 @@ fsentry_common ; os_error *fsentry_common( Parameter_Block * )
NOP NOP
] ]
LDMFD SP!, {R8} Pull "R8"
MOV pc, lr MOV pc, lr
...@@ -189,12 +188,11 @@ OmniS_Suicide ; (char *modulename) ...@@ -189,12 +188,11 @@ OmniS_Suicide ; (char *modulename)
Return Return
suicide_cb suicide_cb
STMFD SP!, {r0-r1, r14} Push "r0-r1, r14"
MOV r0, #4 ; kill named module MOV r0, #4 ; kill named module
MOV r1, r12 MOV r1, r12
SWI XOS_Module SWI XOS_Module
LDMFD SP!, {r0-r1, r14} Pull "r0-r1, pc"
MOV pc, r14
; Free routine ------------------------------------------- ; Free routine -------------------------------------------
...@@ -212,10 +210,10 @@ suicide_cb ...@@ -212,10 +210,10 @@ suicide_cb
EXPORT Free_ServiceRoutine EXPORT Free_ServiceRoutine
Free_ServiceRoutine ; On entry R0 = reason code 0-3 Free_ServiceRoutine ; On entry R0 = reason code 0-3
STMFD SP!, {R1, R4} Push "R1, R4"
SWI XLanMan_FreeOp SWI XLanMan_FreeOp
TEQ R1,#0 ; set Z if R1 was 0 on exit, preserve V TEQ R1,#0 ; set Z if R1 was 0 on exit, preserve V
LDMFD SP!, {R1, R4, PC} ; As it says in book Pull "R1, R4, PC" ; As it says in book
DCB "Nothing libellous or obscene", 0 ; Contractual obligation DCB "Nothing libellous or obscene", 0 ; Contractual obligation
ALIGN ALIGN
......