Commit e332cf0f authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Fixed logon behaviour against NT4 servers.

  Added automatic bug detection code.
Detail:
  NT4 servers use differently formatted buffer to response to the logon
    requests and this was confusing the code which only knew about the
    oldest format of this buffer.  The code now knows about all three
    different possible response formats and processes them all properly.
  Windows 95/98 servers contain a bug which cause them to reverse the
    order of the date and time fields in QPathInformation transactions.
    My earlier workaround for this was to always reverse the time/date
    pairs - which causes it to fail when talking to Windows NT servers.
    On the first QPathInformation request on a given share, the request
    is first done on the root directory, and then the (non-broken) dir
    search transaction is executed and the results compared to determine
    whether the server is broken or not.  This means that it should
    interwork with NT, 95, 98 and also with Samba (which has a build
    option for emulating this bug or not!)
  Transact2 processing code is now aware of the multiple response packet
    options and can cope with the server sending secondary responses.
  Directory search entry per call limiter re-introduced to prevent these
    from secondary responses occurring anyway as they are still a pain to
    process efficiently.
Admin:
  Tested against Windows 98 and Windows NT 4.

Version 1.87, 1.1.1.1.2.6. Tagged as 'LanManFS-1_87-1_1_1_1_2_6'
parent 93866275
......@@ -81,7 +81,7 @@ ROM_OBJS = or.LanMan or.Omni or.Logon or.CoreFn or.Printers \
DBG_OBJS = od.LanMan o.Omni od.Logon od.CoreFn od.Printers \
od.Xlate od.buflib Interface.o RMInfo.o Errors.o od.Transact \
o.LLC o.NetBIOS o.SMB o.Attr od.RPC o.NBIP od.Stats LanMan_MH.o
o.LLC o.NetBIOS od.SMB o.Attr od.RPC o.NBIP od.Stats LanMan_MH.o
OBJSI = i.LanMan i.Omni i.Logon i.CoreFn i.Printers \
i.Xlate i.buflib i.Transact \
......
......@@ -4,11 +4,11 @@
*
*/
#define Module_MajorVersion_CMHG 1.87
#define Module_MinorVersion_CMHG 1.1.1.1.2.5
#define Module_Date_CMHG 11 Jan 1999
#define Module_MinorVersion_CMHG 1.1.1.1.2.6
#define Module_Date_CMHG 15 Jan 1999
#define Module_MajorVersion "1.87"
#define Module_Version 187
#define Module_MinorVersion "1.1.1.1.2.5"
#define Module_Date "11 Jan 1999"
#define Module_MinorVersion "1.1.1.1.2.6"
#define Module_Date "15 Jan 1999"
......@@ -231,9 +231,8 @@ static err_t Func_ReadDir ( int reason, char *path_name, char *buffer,
*/
/* There is no code inside this #ifdef - it just marks my comment. */
#else
if ( n_names*tmp > buflen ) n_names = buflen/tmp;
#endif
if ( n_names*tmp > buflen ) n_names = buflen/tmp;
if ( n_names <= 0 ) return EBADPARAM;
RD_Reason = reason;
......@@ -269,7 +268,7 @@ static err_t Func_ReadDir ( int reason, char *path_name, char *buffer,
RD_ReqOffset < RD_CurOffset || /* Going back in search */
strcmp(DOSnamebuf, RD_CurrentPath) != 0 ) /* New directory */
{
debug0("\n>> Start search\n");
debug1("\n>> Start search (%s)\n", DOSnamebuf);
strcpy ( RD_CurrentPath, DOSnamebuf);
RD_CurOffset = 0;
res = SMB_ReadDirEntries ( DOSnamebuf, RD_ReqCount+RD_ReqOffset,
......@@ -568,12 +567,18 @@ _kernel_oserror *fsentry_file( int *R )
ra.loadaddr = R[2];
Xlt_CnvROtoDOS ( &ra, &da, CNV_DATETIME );
#ifdef LONGNAMES
strncpy(DOSnamebuf + DOS_NAME_LEN, DOSnamebuf, DOS_NAME_LEN);
if (Xlt_AddROType(DOSnamebuf + DOS_NAME_LEN, ra.loadaddr)) {
err = SMB_Rename(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
if (err != OK) break;
strcpy(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
{
if (da.attr & ATTR_DIR)
;
else {
strncpy(DOSnamebuf + DOS_NAME_LEN, DOSnamebuf, DOS_NAME_LEN);
if (Xlt_AddROType(DOSnamebuf + DOS_NAME_LEN, ra.loadaddr)) {
err = SMB_Rename(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
if (err != OK) break;
strcpy(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
}
}
}
#endif
}
else if ( R[0] == FSEntry_File_Reason_WriteExecutionAddress )
......@@ -597,11 +602,19 @@ _kernel_oserror *fsentry_file( int *R )
ra.flags = R[5];
#ifdef LONGNAMES
strncpy(DOSnamebuf + DOS_NAME_LEN, DOSnamebuf, DOS_NAME_LEN);
if (Xlt_AddROType(DOSnamebuf + DOS_NAME_LEN, ra.loadaddr)) {
err = SMB_Rename(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
if (err != OK) break;
strcpy(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
{
RISCOS_ATTRIBS test_ra;
err = FileGetAttribs ( DOSnamebuf, &da, &test_ra );
if (err == OK && (da.attr & ATTR_DIR))
;
else {
strncpy(DOSnamebuf + DOS_NAME_LEN, DOSnamebuf, DOS_NAME_LEN);
if (Xlt_AddROType(DOSnamebuf + DOS_NAME_LEN, ra.loadaddr)) {
err = SMB_Rename(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
if (err != OK) break;
strcpy(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
}
}
}
#endif
......
This diff is collapsed.
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