Giter Club home page Giter Club logo

Comments (7)

miketeo avatar miketeo commented on June 6, 2024

Hi, Vinod.
According to the MS-SMB2 protocol specs, page 314, "<57> Section 2.2.33: Windows-based servers do not support resuming an enumeration at a specified FileIndex. The server will ignore this flag."

In addition, the interpretation of the FileIndex field is not exactly what you have implemented; it does not refer to the entry offset. Instead, the value must be from the FileIndex field in a previous listing response (see MS-FSCC, section 2.4.8). So, you will end up having to enumerate the entire directory listing from the beginning.

Hope this helps you in the debugging.
Michael

from pysmb.

vinodc avatar vinodc commented on June 6, 2024

Thanks Michael. The explanation and PDFs were helpful. Seeing as Windows-based servers ignore the flag, I'll hold off on implementing this at the current time and perhaps revisit it in the future.

from pysmb.

vinodc avatar vinodc commented on June 6, 2024

Hi Michael. It appears this restriction is no longer in place in the current docs on product behavior: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/a64e55aa-1152-48e4-8206-edd96444e7f7

Does it make sense to implement FileIndex support for enumeration now? I'm curious as to the best approach for this, and whether you had one in mind.

from pysmb.

miketeo avatar miketeo commented on June 6, 2024

A server which does not implement enumeration means your client needs to handle all the returned values in one single request-response. This may not be ideal if your client were to run in embedded devices where memory and processing power could be limited.

With that being said, it is not easy to implement an accurate enumeration of a directory as the contents of the directory could be changing rapidly on a busy machine. It is similar to doing a SELECT with LIMIT/OFFSET on a busy database table; the returned rows could be repeated or missed out.

I didn't really do much testing on this enumeration feature, but other services like Samba might choose to implement enumeration.

from pysmb.

vinodc avatar vinodc commented on June 6, 2024

That makes sense. The documentation does appear to indicate support for it in some of the newer Windows server versions, and Samba. Do you have plans to add support for this feature to pysmb to allow optional enumeration?

from pysmb.

miketeo avatar miketeo commented on June 6, 2024

Currently, pysmb repeats the QUERY_DIRECTORY request again on the same fid until it receives STATUS_NO_MORE_FILES response from the server. Apparently, it achieves the same effect as enumeration.

from pysmb.

vinodc avatar vinodc commented on June 6, 2024

Alright; glad to hear.

from pysmb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.