Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read fileId of FileIdBothDirectoryInformation and FileIdFullDirectoryInformation as long #693

Merged
merged 1 commit into from
Jan 31, 2022

Conversation

hannosgit
Copy link
Contributor

@hannosgit hannosgit commented Jan 29, 2022

This PR attempts to unify the reading/parsing of the fileId field in FileIdBothDirectoryInformation and FileIdFullDirectoryInformation.

The fileId field in FileIdBothDirectoryInformation and FileIdFullDirectoryInformation and the indexNumber in FileInternalInformation all refer to the same file ID, described in [MS-FCC].

Currently, the indexNumber field in FileInternalInformation is of type long, but the fileId of the other two classes is of type byte[].
I think it would be cleaner if the fileId fields of FileIdBothDirectoryInformation and FileIdFullDirectoryInformation are also exposed as type long in the API of this library, as these fields always have 8 bytes.

Specification:
[MS-FCC] section 2.1.9 64-bit file ID
[MS-FCC] section 2.4.17 FileIdBothDirectoryInformation FileId
[MS-FCC] section 2.4.19 FileIdFullDirectoryInformation FileId
[MS-FCC] section 2.4.22 FileInternalInformation IndexNumber

Changes

  • Read fileId of FileIdBothDirectoryInformation into a long
  • Read fileId of FileIdFullDirectoryInformation into a long
  • Add integration tests to ensure that the fileIds match the fileIndex provided by FileInternalInformation

* Read fileId of FileIdBothDirectoryInformation into a long
* Read fileId of FileIdFullDirectoryInformation into a long
@hierynomus
Copy link
Owner

Thanks, I'll merge the change.

@hierynomus hierynomus merged commit 052ce95 into hierynomus:master Jan 31, 2022
@hierynomus
Copy link
Owner

Also kudos for the clear PR and references to the docs!!

hierynomus pushed a commit that referenced this pull request May 8, 2023
* Read fileId of FileIdBothDirectoryInformation into a long
* Read fileId of FileIdFullDirectoryInformation into a long
hierynomus added a commit that referenced this pull request Jul 3, 2023
* Ignore VSCode

* Add NtStatus.STATUS_UNSUCCESSFUL

* Add NtStatus.STATUS_INSUFF_SERVER_RESOURCES (#611)

* Add NtStatus.STATUS_IO_REPARSE_TAG_NOT_HANDLED (#514)

* Update gradle build

* Update release plugin

* Release version: 0.11.0

* Fix signing task dependency

* Release version: 0.11.1

* Use BCSecurityProvider by default for SMB3 compatibility (Fixes #638)

* Ensure DFS Path Referral times out after transactTimeout (Fixes #578)

* Only add DFSPathResolver if both client and server support DFS (#640)

* Only add DFSPathResolver if both client and server support DFS

* Fix indentation problems

* Fix incorrectly reformatted javadoc

* Format using java formatter

* One more indentation fix

* Upgrade Bouncy Castle to 1.68 to fix vulnerability report (#641)

* address issue #604 - stop closing the dfs share connection immediately. (#609)

* stop closing the dfs share connection immediately.

* Add explanatory comment

Co-authored-by: Jeroen van Erp <jeroen@hierynomus.com>

* Add support for unregistering server from serverlist (Fixes #644) (#647)

* Add support for unregistering server from serverlist (Fixes #644)

* Fix indentation

* Reducing logging for smb3 (#650)

For each smb3 packet there's an info log message which produces a tremendous amount of output.
I would suggest to reduce log level to debug (or trace; similarly as in one of the other packet reciever classes).

* Consolidate SMBv1 error messages

* Upgrade BouncyCastle to 1.69

* Release version: 0.11.2

* Ensure artifact is signed

* Release version: 0.11.3

* Fix #665: Allow JCE KDF to work (#666)

* Fix #665: Allow JCE KDF to work

* Add header

* Add KDF unit test

* Use correct maxPayloadSize for encrypted packets (Fixes #668) (#683)

* Read fileId as long (#693)

* Read fileId of FileIdBothDirectoryInformation into a long
* Read fileId of FileIdFullDirectoryInformation into a long

* File the issue that nested folder creation throw NAME EXIST error. (#685)

* File the issue that nested folder creation throw NAME EXIST error.

* formatting

* Updated build status badges (#684)

- Added GitHub badge for Build SMBJ
- Corrected Codacy badge link
- Removed bintray badge link
- Removed Travis CI badge and configuration
- Removed Java profiler link
- Removed CircleCI configuration
- Removed unused github-ci configuration

* Use AceSize field when reading ACEs (#696)

Fixes issue seen in the wild where unnecessary padding at the end of an ACE
confused Smbj (but not Windows).

* Ensure that enough bytes are cached from InputStream to get a correct bytesLeft count for SMB2Write (fixes #669)

* GzipOutputStream integration test

* Ensure that enough bytes are cached from InputStream to get a correct bytesLeft count for SMB2Write

Co-authored-by: Stanislav Kardashov <skardashov@spins.com>
Co-authored-by: Jeroen van Erp <jeroen@hierynomus.com>

* Add GH workflow for publishing

* Update dependencies and build file

* Rename test class to *Spec

* Release version: 0.11.5

* Use the hostname part of the TargetHint for DFS step 9 (fixes \#419) (#722)

* Slightly reduce the locking in Connection.send and DirectTcpTransport (fixes \#732)

* Fixed indentation

* Converting bytes written to long (Fixes #740)

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Upgrading gradle to 8.0.2

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Add Implementation manifest attributes (Fixes #743)

* Revert accidental comment of integration docker tasks

* Do not send SMB2EncryptionCapabilities NegotiationContext is !isEncry… (#752)

* Do not send SMB2EncryptionCapabilities NegotiationContext is !isEncryptionSupported (Fixes #747)

* Add test for SMB2EncryptionCapabilities

* Add preliminary changelog for new release

* Ensure we call flip() on Buffer to avoid Java8 problems (Fixes #705)

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Ensure path is set for rmdir to prevent accidents (Fixes #756)

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Add support for reading / writing NIO ByteBuffers (#759)

* Add support for reading / writing NIO ByteBuffers

Currently one can transfer data using streams or array, but it would be
great to have the opportunity to use NIO buffers.

This adds two new method to the File class that accept a NIO ByteBuffer.

* Implemented ByteBuffer write using ByteChunkProvider

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

---------

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>
Co-authored-by: Christoph Läubrich <christoph@laeubi-soft.de>
Co-authored-by: Jeroen van Erp <jeroen@hierynomus.com>

* Fix some sonatype warnings

* resolve conflict with master

* Ignore non-semver tags for release workflow

* Small warning cleanup

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Setup ConnectionContext and AuthenticationContext for NTLM improvements

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Refactor TargetInfo/AvPairs

* Added null check and rename field

* Refactor NtlmFunctions

* Change hierarchy of Ntlm messages

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Next step of NTLM refactor

* NtlmNegotiate sends Domain/Workstation/Version fields

* Filter negotiateflags and use clientTargetInfo

* Rework keys in NtlmAuthenticator

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Change to structure of NtlmAuthenticate

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

* Added last changes

Required to put withIntegrity = false still, due to missing mechListMIC

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>

---------

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>
Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com>
Co-authored-by: ndimitry <18209884+ndimitry@users.noreply.github.com>
Co-authored-by: Patrick Boyd <pboyd04@gmail.com>
Co-authored-by: Hannes <65758037+hannosgit@users.noreply.github.com>
Co-authored-by: pyzhou <pyzhou@talend.com>
Co-authored-by: exceptionfactory <exceptionfactory@apache.org>
Co-authored-by: Chris Pacejo <chris@pacejo.net>
Co-authored-by: Stanislav Kardashov <stanislav.kardashov@gmail.com>
Co-authored-by: Stanislav Kardashov <skardashov@spins.com>
Co-authored-by: Christoph Läubrich <mail@laeubi-soft.de>
Co-authored-by: Christoph Läubrich <christoph@laeubi-soft.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants