1. 03 Jan, 2018 1 commit
    • Robert Sprowson's avatar
      Name resolution, wildcarded FSEntry_File 5 & 9, and buffer overrun fixes · 517c6bdb
      Robert Sprowson authored
      Make SMB_RxWords a bit bigger per static anaylsis
        https://www.riscosopen.org/forum/forums/4/topics/9503
      when LONGNAMES is undefined, since NT LM 0.12 dialect is allowed at the same time as short names.
      
      A change to name translation in LanManFS-2_60 broke all forms of nested contentious name resolution, ie. where a leafname containing a contentious character was itself in a directory containing one.
      The cited problem names ('1 2/3' and '1 /s') can both be resolved at one level only, no 2nd pass is required. The resolution function walks along the elements of the path one at a time to reach the leaf (ie. no element is processed twice). A test case has been created to allow some regression testing when making future changes in this area.
      
      When building tboxlibint
        Copy h.* <Lib$Dir>.tboxlibint.h.*
      when the directory is empty FileSwitch checks the destination ending in ...\h\* which the short names translation would error with ENOWILDCARD, but the long names translation attempts to resolve it by finding the trailing '\' and appending a '*' (ie. not doing anything), this returns no results and is passed back unfaulted. The special check in fsentry_file() for ENOWILDCARD for the two ReadCatalogueInformation thus doesn't trigger, and an attempt to FileGetAttribs() is made on the still wildcarded path. This is rejected by the server when in SMB_GetAttribsX2() does a TRANSACT2_QUERYPATHINFORMATION, which expects a non wildcarded object (on Windows servers at least), propagating an error back up to the user.
      This stopped a ROM build from completing the exports phase via LanManFS on a Windows share.
      
      Const-ify a few things.
      
      Changed files
        Xlate.c: Revert change from revision 1.21, return ENOWILDCARD when appropriate.
        SMC.c: Increase MAX_WCT buffer size to 17.
        UK/CmdHelp: Add some missing chevrons round the command syntax for required parameters.
        test/Contentious: Test case for nested contentious character resolution code.
      
      Version 2.61. Tagged as 'LanManFS-2_61'
      517c6bdb
  2. 21 Jan, 2017 1 commit
    • Robert Sprowson's avatar
      Fix for truncating writes to servers that declare MaxBufferSize >= 64k smb.c,... · e6b73849
      Robert Sprowson authored
      Fix for truncating writes to servers that declare MaxBufferSize >= 64k smb.c, lines 2726 onwards: when chopping up the next buffer, make sure the size sent still fits in the SMB_COM_WRITE count field (16 bits). For completeness, make sure the estimate of bytes remaining is similarly saturated too.
      
      smb.c, lines 2711-2713: cifs-v1-spec-02 section 5.27 says the server always expects to receive up to 65535 bytes, so this test should not be subject to the negotiated MaxBufferSize, and is expected to often exceed it. Currently we use 32k, if this is ever increased we really ought to take into account MaxRawSize that the server tells us.
      
      Tested with a handful of files of power-of-2 sizes and odd sizes. Inspection in Wireshark looks OK. Variation of a diagnosis by Will Ling https://www.riscosopen.org/forum/forums/4/topics/8966
      
      Version 2.59. Tagged as 'LanManFS-2_59'
      e6b73849
  3. 14 May, 2016 1 commit
    • ROOL's avatar
      [419] LanManFS does not see all visible files · e6ff7fc3
      ROOL authored
      Detail:
        When the number of files read from the server didn't fit in the OS_GBPB buffer, continuation of the enumeration would fail.
        Resume key *and* filename used when resuming a directory enumeration to the same directory.
      Admin:
        Submission from Colin Granville.
      
      Version 2.56. Tagged as 'LanManFS-2_56'
      e6ff7fc3
  4. 09 Aug, 2015 1 commit
    • ROOL's avatar
      Add support for NTLM authenticated logins · f1009949
      ROOL authored
      SMB.c:
      Line 875 don't free chain pB that early it is (and was being) used later on.
      Fixes to correct which SMB_RxWords the Sesskey and bloblen are retrieved from, for each of the dialects supported.
      Call the new auth code when the protocol flags require it.
      Don't uppercase passwords all the time, the server may require case sensitivity.
      md5c.c/md4c.c:
      Verbatim copies of the RSA reference implementations of MD4 and MD5 from the respective RFC's.
      Auth.c:
      Implementation of the hash/mash/reply that Microsoft requires. Define AUTHTEST of this file to build a simple application that verifies the algorithms.
      
      Tested against a Win7 install, inspecting in Wireshark that the passwords are no longer sent in the clear.
      Implements ticket #332.
      Submission from Colin Granville.
      
      Version 2.52. Tagged as 'LanManFS-2_52'
      f1009949
  5. 12 Jul, 2015 1 commit
    • ROOL's avatar
      Be more efficient with buffers · 44df7e69
      ROOL authored
      Take note of, and use, the MaxBufferSize that the server tells us during negotiation rather than a fixed value.
      If the server doesn't say, use 1k as the default as before.
      Submission from Colin Granville.
      
      Version 2.50. Tagged as 'LanManFS-2_50'
      44df7e69
  6. 05 Jul, 2015 1 commit
  7. 03 Oct, 2013 1 commit
    • Robert Sprowson's avatar
      Internationalised · e3559214
      Robert Sprowson authored
      Unused LMFiler put in the attic.
      As LanMan has historically put its resources into ThirdPart/OmniClient this component has no ROM resources phase - it still registers the resources at run time.
      
      Version 2.40. Tagged as 'LanManFS-2_40'
      e3559214
  8. 11 Nov, 2012 1 commit
    • Robert Sprowson's avatar
      Fix and speed up EXT#handle=number doing nothing when number is beyond 2GB · 18a0315a
      Robert Sprowson authored
      Internally LanManFS was representing file offsets and data lengths as signed numbers, while in general this doesn't matter (they are passed through opaquely as just numbers and not manipulated) in a couple of places they were being used as while () loop exit conditions.
      Function WriteZeroes (used when extending a file via OS_Args) therefore never performed the call to SMB_Write when beyond 2G because the loop condition was never met.
      Additionally, it was literally transferring buffers of zeros across the network which is unnecessary as the server is documented as doing a zero fill itself, this represents at least a x40 speed up (on a slow 1MB/s drive write speed at the server end) or more.
      Changed offset & lengths from int to uint.
      Added the earlier CIFS spec (the later copy is missing section 5 for some reason) to docs.
      
      Version 2.38. Tagged as 'LanManFS-2_38'
      18a0315a
  9. 15 Oct, 2011 1 commit
    • 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
  10. 01 Aug, 2009 1 commit
    • Robert Sprowson's avatar
      Fix for renames where only the case has changed. · 0dabebbd
      Robert Sprowson authored
      Detail:
       Added an extra check after the Xlate path resolution code so that
       the case of the path given to resolve is honoured. This now means that
       the strcmp() done in SMB_Rename fails and the rename is actually sent to
       the server. Before "*rename test Test" would have the path resolved and
       since 'test' already existed both names would be the same, in this example
       something like "*rename A:\test A:\test" would result.
      Admin:
       Made the non LONGNAMES version compile again (not tested).
       Removed local definitions of FSControl reason codes, uses Interface header
       now.
       Made the case of #includes match CVS to allow future compilation on a case
       sensitive system.
       Deleted unused "Version" header.
      
      Version 2.34. Tagged as 'LanManFS-2_34'
      0dabebbd
  11. 19 Jul, 2009 1 commit
    • Robert Sprowson's avatar
      Workaround for NTFS returning resume keys of zero. · d1ca5496
      Robert Sprowson authored
      Detail:
        When the underlying FS is NTFS, eg. WinXP Pro, the requested
        resume keys for a directory search are always zero - this is passed
        back via OSGBPB and on the next call it triggers a new search. So
        we get stuck in an infinite loop.
        Now checks for a resume key stuck at zero, and makes a fake one static
        to the search context then sets the continuation bit in the SMB_FIND_NEXT
        call because the server returning the duff key remembers the position.
        Dir_CallbackFn could return with "taken" undefined. Move a few lines
        higher.
        Missing "#else" added to CHECK_ARMBOOT_EXISTS so if this is disabled
        no further attempt is made to find !ArmBoot.
        Couple of typos corrected.
        Spelling of "disk" changed to "disc" in an error message.
      Admin:
        Tested with XP Pro SP3 with NTFS, directories which previously hung
        the filer now open correctly. Checked with XP Home SP3 with FAT32 to
        verify behaviour unchanged from 2.32.
        Note, with large directories the initial path translation triggers a
        dir search too which takes ages compared with the actual number of
        entries returned. This could be cached to make counting far faster.
      
      Version 2.33. Tagged as 'LanManFS-2_33'
      d1ca5496
  12. 15 Apr, 2009 2 commits
    • Ben Avison's avatar
      Multiple fixes. · 186192a3
      Ben Avison authored
      Detail:
        Too many to list here: see doc/RPSChanges.
      Admin:
        Received from Rob Sprowson approx 2009-02-08. Builds, but not tested by ROOL.
      
      Version 2.32. Tagged as 'LanManFS-2_32'
      186192a3
    • Ben Avison's avatar
      Compatibility change for Microsoft security fix MS09-001. · 3ba506cd
      Ben Avison authored
      Detail:
        Security fix MS09-001 (detailed in Microsoft Knowledge base article KB958687)
        fixes some vulnerabilities in the SMB protocol which LanManFS uses. This
        highlighted an error in SMB_WriteRaw which reported zero data bytes but then
        supplied an offset to the non existant bytes: this is now faulted by Windows.
        As there are no data bytes, the offset should also be zero.
      Admin:
        Fix received from Rob Sprowson 2009-01-19.
      
      Version 2.31. Tagged as 'LanManFS-2_31'
      3ba506cd
  13. 16 Feb, 2004 1 commit
  14. 16 Jan, 2003 1 commit
    • Robert Sprowson's avatar
      Directory rename fixed - the mask being passed by the rename routine didn't... · 99169885
      Robert Sprowson authored
      Directory rename fixed - the mask being passed by the rename routine didn't have the ATTR_DIR bit set.Discovered this after reading lots of the spec which is also now included here in /doc.
      
      Copying files out of LanManFS filer "forgot" their filetype even though
      they appeared right in the filer,fixed.
      A stray debugging printf removed,along with one compiler warning.
      New sprites (yuck) to match !Omni.
      Reordered the shutdown in two places,first Omni_Shutdown bins the mounts
      lists which SMB_Shutdown uses.Second in NetBEUI mode the announcement that
      a protocol has terminated goes *after* the shutdown - otherwise you sit
      around for about 20s wondering where the link has gone.
      
      Version 2.25. Tagged as 'LanManFS-2_25'
      99169885
  15. 09 Jan, 2001 1 commit
    • Stewart Brodie's avatar
      Fixed bug in parsing of the protocol negotiation. · 4b49606e
      Stewart Brodie authored
      Detail:
        The wrong bit was being checked to see if we were using the extended
          security model (CAP_EXTENDED_SECURITY).  Thus the wrong format was
          being used in SMBsesssetup, which meant that we couldn't connect
          to Windows 2000.
        Much better debugging added to the name resolution code - this helped
          diagnose the faulty photocopier problem and is left in case anything
          like that happens again!
      Admin:
        Tested - I can now connect to Win 2000 shares.
      
      Version 2.17. Tagged as 'LanManFS-2_17'
      4b49606e
  16. 08 Aug, 2000 1 commit
    • Stewart Brodie's avatar
      Fixed machine stiff if connection left idle too long. · 4fc58c21
      Stewart Brodie authored
      Detail:
        SVC stack overflow occurred due to the recursive method used to
          discard the idle-out prevention responses.  This no longer
          happens.
        Fixed a bit of debugging which caused data aborts!
        Optimised a select() call to pass s + 1 as the first parameter to
          save Internet time in processing the fd_set.
      Admin:
        Tested on desktop build, with the idle timers set to send idle outs
          every second (so we don't have to wait 100 hours for the problem
          to occur).  No longer get problems with the machine stiffing.
      
      
      Version 2.12. Tagged as 'LanManFS-2_12'
      4fc58c21
  17. 04 Apr, 2000 1 commit
    • Stewart Brodie's avatar
      Fixed use of uninitialised pointer. · 01a3f774
      Stewart Brodie authored
        Now doesn't require that the !ArmBoot object is a directory
      Detail:
        The code in Omni.c was carefully checking that !ARMBOOT existed
          before attempting to run the boot file.  Unfortunately, it was
          using a method which bypassed the filename resolution (that does
          the ,xxx filetype name mapping), so it did not find the new Obey
          file in the 400 series baseline.  The check has been removed.
        The code in SMB.c was being caught out on an uninitialised variable
          usage when the attribute cache already held details of the object
          being sought.  The variable would have been initialised on a non-
          cached lookup, but the special case of booting a machine via LanManFS
          manages to get a cached lookup without having run through the routine
          before, resulting in a strcpy() with a destination of 0.
      Admin:
        Tested on Risc PC.
        Fixes fault 1511 (STB-400 Generic)
      
      Version 2.11. Tagged as 'LanManFS-2_11'
      01a3f774
  18. 21 Jan, 2000 1 commit
    • Stewart Brodie's avatar
      More tolerance has been added of files found on the remote server which have unexpected extensions. · 36543191
      Stewart Brodie authored
      Detail:
        LanManFS does not like it if you create (independently, using a PC or
          otherwise) files with names like "myfile,fff" which you intend to
          be displayed as files with type &FFF (ie. Text) on a RISC OS machine.
          If you tried to access the file for reading it, such as loading it
          into an editor, that worked due to the name matching resolution.
          However, any attempt to update the file caused LanManFS to attempt
          to write the file without the extension and not notice that a file
          with a ,fff extension already existed (Text files are special cased
          in the current implementation of name translation - see LanManFS
          Functional Specification for details and rationale).  Attempts to
          save typically succeed (giving you two files: myfile and myfile,fff)
          but generate "Operation not permitted" or such like.  This stemmed
          from the attempt being made by LanManFS to rename a file to the same
          name.  SMB_Rename now traps that and tells its caller that the rename
          succeeded.  The Xlate.c code now indicates correctly that the filename
          extension has been altered when a ,fff extension has to be chopped off.
      Admin:
        Tested briefly on desktop build against art-work's SAMBA server.
        Bug reported by TopCat engineers.
      
      Version 2.10. Tagged as 'LanManFS-2_10'
      36543191
  19. 29 Apr, 1999 1 commit
    • Stewart Brodie's avatar
      Now uses DebugLib. · 6ce2ce71
      Stewart Brodie authored
        Fixed search handle haemorrhaging.
      Detail:
        The directory lookup routines cached directory search handles to avoid
          hammering the server with repeated requests to open directories.
          Unfortunately, it was possible for these to be forgotten without
          being freed up leading to resource loss at the server end.  Eventually,
          the server gives up servicing you and reports errors.  This will only
          occur once a significant number of accesses have been performed (the
          number depends entirely on server configuration).  This leak is now
          fixed.
      Admin:
        Tested against Cerium - debug reports that no handles are being leaked.
      
      Version 2.07. Tagged as 'LanManFS-2_07'
      6ce2ce71
  20. 09 Mar, 1999 1 commit
    • Stewart Brodie's avatar
      Changed idle-out strategy. · feb9328e
      Stewart Brodie authored
        Introduced new error message for re-entrancy prevention trap to use.
      Detail:
        When 'pinging' an SMB server, LanManFS does not wait for any response
          but the response reading routine knows to just throw away any old
          SMBchkpth responses that it gets and try reading again.
        Re-entrancy trap now has its own error "LanManFS in use" &1663E, which
          means you no longer see "!Armboot files nested too deeply" which is
          confusing.  The only way you can provoke this message is if you use
          Alt-Break whilst the NetBIOS/IP code is executing.  The error plays
          the same part as "FileCore in use" does for FileCore.
      Admin:
        Verified module still works and the anti idle-out features still work.
      
      Version 2.04. Tagged as 'LanManFS-2_04'
      feb9328e
  21. 18 Feb, 1999 1 commit
    • Stewart Brodie's avatar
      Protocol negotiated features need to be per-server, not per-share. · 91cb8981
      Stewart Brodie authored
      Detail:
        Long filename flag tarnsferred to be a server property rather than
          a share property, otherwise subsequent shares to the same server
          do not get long filenames (because the subsequent shares don't
          have to go through the connection negotiation phase)
      Admin:
        Tested on by mounting lots of drives through desktop Omni frontend.
      
      Version 2.02. Tagged as 'LanManFS-2_02'
      91cb8981
  22. 16 Feb, 1999 1 commit
    • Stewart Brodie's avatar
      Support for long filename. · d49e6981
      Stewart Brodie authored
        Support for spaces in machine names.
        Merge of sbrodie_LanManFS_dev branch to trunk.
      Detail:
        LanManFS 2.00 supports the "NT LM 0.12" protocol, enabling it to
          use long filenames on mounted shares.
      Admin:
        Supporting documentation:
          1215,256/FS: LanManFS Software Functional Specification.
        Same as LanManFS-1_87_1_1_1_1_2_13.
      
      Version 2.00. Tagged as 'LanManFS-2_00'
      d49e6981
  23. 03 Dec, 1998 1 commit