Commit a0fb97c2 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix for *INFO dates not matching *EX dates

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'
parent 0dabebbd
/* (2.34)
/* (2.35)
*
* This file is automatically maintained by srccommit, do not edit manually.
* 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_Date_CMHG 01 Aug 2009
#define Module_Date_CMHG 15 Oct 2011
#define Module_MajorVersion "2.34"
#define Module_Version 234
#define Module_MajorVersion "2.35"
#define Module_Version 235
#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_ComponentPath "castle/RiscOS/Sources/Networking/Omni/Protocols/LanManFS"
#define Module_FullVersion "2.34"
#define Module_HelpVersion "2.34 (01 Aug 2009)"
#define Module_LibraryVersionInfo "2:34"
#define Module_FullVersion "2.35"
#define Module_HelpVersion "2.35 (15 Oct 2011)"
#define Module_LibraryVersionInfo "2:35"
......@@ -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);
}
if (!(hS->hServer->t2flags & T2FLAGS_TESTEDSWAP)) {
if (!(hS->hServer->t2flags & T2FLAGS_TESTEDSWAP))
{
/* Need to test whether we have to swap the date/time fields */
char fnbuffer[8];
char fnbuffer[8];
DOS_ATTRIBS aattrbuf;
DOS_ATTRIBS sattrbuf;
hS->hServer->t2flags |= T2FLAGS_TESTEDSWAP;
fnbuffer[0] = *filename;
fnbuffer[1] = ':';
fnbuffer[2] = '\\';
fnbuffer[3] = '\0';
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[4] = '\0';
Transact_init(&tp, 6 * 2); /* will accept 6 WORD return params */
Transact_addsetupword(&tp, TRANSACT2_FINDFIRST);
if (LM_Vars.namemode & NM_INTERNAL) {
Transact_addword(&tp, ATTR_DIR | ATTR_SYS | ATTR_HID); /* findfirst_Attribute */
if (LM_Vars.namemode & NM_INTERNAL)
{ /* findfirst_Attribute */
Transact_addword(&tp, ATTR_DIR | ATTR_SYS | ATTR_HID);
}
else {
Transact_addword(&tp, ATTR_DIR); /* findfirst_Attribute */
else
{
Transact_addword(&tp, ATTR_DIR);
}
Transact_addword(&tp, 1); /* findfirst_SearchCount */
Transact_addword(&tp, 0); /* findfirst_flags */
Transact_addword(&tp, 1); /* Search level */
Transact_addword(&tp, 1); /* findfirst_SearchCount = 1 please */
Transact_addword(&tp, 1); /* findfirst_Flags = auto close after this query */
Transact_addword(&tp, 1); /* Search level = standard level */
Transact_addlong(&tp, 0L); /* reserved, MBZ */
Transact_addstring(&tp, fnbuffer+2); /* findfirst_FileName[] */
debug1("Looking for `%s'\n", fnbuffer+2);
res = SMB_Transact2(hS, &tp);
if (res == OK) {
if (res == OK)
{
debug0("SMB_Transact2 worked\n");
SMB_TxWords[0] = Transact_getword(tp.parms_out_buf);
if (Transact_getword(tp.parms_out_buf + 2) == 1) {
DOS_ATTRIBS sattrbuf;
if (Transact_getword(tp.parms_out_buf + 2) == 1)
{
debug1("Filename was `%s'\n", tp.data_out_buf + 23);
res = Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, &sattrbuf, NULL);
if (res == OK) {
if (sattrbuf.utime != aattrbuf.utime) {
debug0("Need to swap date/time!\n");
hS->hServer->t2flags |= T2FLAGS_SWAPDATETIME;
swap_time_date(tp.data_out_buf);
if (res == OK)
{
if (sattrbuf.utime != aattrbuf.utime)
{
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+8);
Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, &sattrbuf, NULL);
if (sattrbuf.utime != aattrbuf.utime) {
debug0("Didnt get the right thing anyway\n");
if (sattrbuf.utime != aattrbuf.utime)
{
debug0("Even after swapping they don't match\n");
}
else {
else
{
hS->hServer->t2flags |= T2FLAGS_SWAPDATETIME;
debug0("Tested and verified!\n");
}
}
else {
else
{
debug0("Don't need to swap date/time!\n");
}
}
}
(void) Do_SMB(hS, SMBfindclose2, 1, NULL, NULL);
}
else {
else
{
debug0("SMB_Transact2 failed\n");
}
}
......@@ -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
* 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+4);
swap_time_date(tp.data_out_buf+8);
......
......@@ -66,35 +66,35 @@ SWIClass SETS "LanMan"
LTORG
veneer_fsentry_open
STMFD SP!, {R8}
Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*0
B fsentry_common
veneer_fsentry_getbytes
STMFD SP!, {R8}
Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*1
B fsentry_common
veneer_fsentry_putbytes
STMFD SP!, {R8}
Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*2
B fsentry_common
veneer_fsentry_args
STMFD SP!, {R8}
Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*3
B fsentry_common
veneer_fsentry_close
STMFD SP!, {R8}
Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*4
B fsentry_common
veneer_fsentry_file
STMFD SP!, {R8}
Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*5
B fsentry_common
veneer_fsentry_func
STMFD SP!, {R8}
Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*6
B fsentry_common
veneer_fsentry_gbpb
STMFD SP!, {R8}
Push "R8"
MOV R8, #fsentry_branchtable - %F10 + 4*7
B fsentry_common
......@@ -102,7 +102,7 @@ veneer_fsentry_gbpb
fsentry_common ; os_error *fsentry_common( Parameter_Block * )
; 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, sl, LSL #20 ; SP_LWM
......@@ -132,7 +132,7 @@ fsentry_common ; os_error *fsentry_common( Parameter_Block * )
; Save the returned value in R8
MOVS R8, r0
; 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
MOVNE r0, R8
......@@ -156,7 +156,7 @@ fsentry_common ; os_error *fsentry_common( Parameter_Block * )
NOP
]
LDMFD SP!, {R8}
Pull "R8"
MOV pc, lr
......@@ -189,12 +189,11 @@ OmniS_Suicide ; (char *modulename)
Return
suicide_cb
STMFD SP!, {r0-r1, r14}
Push "r0-r1, r14"
MOV r0, #4 ; kill named module
MOV r1, r12
SWI XOS_Module
LDMFD SP!, {r0-r1, r14}
MOV pc, r14
Pull "r0-r1, pc"
; Free routine -------------------------------------------
......@@ -212,10 +211,10 @@ suicide_cb
EXPORT Free_ServiceRoutine
Free_ServiceRoutine ; On entry R0 = reason code 0-3
STMFD SP!, {R1, R4}
Push "R1, R4"
SWI XLanMan_FreeOp
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
ALIGN
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment