Add Support for Security Descriptor Information#28
Merged
Conversation
Pending: proper build the request
And use them to get security descriptor Also debug packets (will be temporal)
By adding low and high level methods for both Share and File in both getting and setting security info
This was
linked to
issues
Feb 3, 2025
To see if linter works properly
This reverts commit aaea781.
arashpayan
reviewed
Feb 5, 2025
Because previous version was not comptaible with go v1.23.x
Collaborator
Author
|
@arashpayan at this moment the methods are named |
It was a mistake brought from Share.SecurityInfoRaw()
leolovesmile
pushed a commit
to leolovesmile/go-smb2
that referenced
this pull request
Sep 29, 2025
The security descriptor functionality is implemented through four main method pairs, available on both `Share` and `File` structs: - `SecurityInfo` / `SetSecurityInfo`: High-level methods that work with parsed security descriptors. - `SecurityInfoRaw` / `SetSecurityInfoRaw`: Low-level methods that work with raw binary data. **note** for high-level methods, both, the structure and parsing are imported from https://github.com/cloudsoda/sddl package, it is important because, by depending on that package, this project will depend on golang `1.23` version. See the following links for more details: - CloudSoda/go-smb2#27 - CloudSoda/go-smb2#28 Signed-off-by: Gustavo Serrano <[email protected]> (cherry picked from commit eb0657583727aba81d491b188455af656be144af) # Conflicts: # client.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This MR implements comprehensive support for querying and setting security descriptor information for both SMB shares and files. The implementation provides both high-level and low-level APIs to handle security descriptors.
Implementation Overview
The security descriptor functionality is implemented through four main method pairs, available on both
ShareandFilestructs:SecurityInfo/SetSecurityInfo: High-level methods that work with parsed security descriptorsSecurityInfoRaw/SetSecurityInfoRaw: Low-level methods that work with raw binary datanote for high-level methods, both, the structure and parsing are imported from sddl package, it is important because, by depending on that package, this project will depend on golang
1.23versionMethod Comparison
Share Methods
Share.SecurityInfo(name string, info SecurityInformationRequestFlags) (*sddl.SecurityDescriptor, error)SecurityInfoRawand parses the binary data into a structuredSecurityDescriptorShare.SecurityInfoRaw(name string, info SecurityInformationRequestFlags) ([]byte, error)READ_CONTROLand optionallyACCESS_SYSTEM_SECURITY)SecurityInfoShare.SetSecurityInfo(name string, flags SecurityInformationRequestFlags, sd *sddl.SecurityDescriptor) errorSecurityDescriptoras inputSecurityDescriptorEncoderand delegates toSetSecurityInfoRawShare.SetSecurityInfoRaw(name string, flags SecurityInformationRequestFlags, sd Encoder) errorWRITE_DACACCESS_SYSTEM_SECURITYwhen SACL information is includedWRITE_OWNERwhen owner information is includedFile.SetSecurityInfoRawFile Methods
File.SecurityInfo(flags SecurityInformationRequestFlags) (*sddl.SecurityDescriptor, error)Share.SecurityInfobut operates on an already opened fileFile.SecurityInfoRaw(flags SecurityInformationRequestFlags) ([]byte, error)SMB2 QUERY_INFOcommandFile.SetSecurityInfo(flags SecurityInformationRequestFlags, sd *sddl.SecurityDescriptor) errorSecurityDescriptorto raw format through encoderSetSecurityInfoRawFile.SetSecurityInfoRaw(flags SecurityInformationRequestFlags, sd Encoder) errorKey Differences
Scope of Operation:
API Level:
*Raw) provide direct access to binary security descriptor dataUsage Context:
Technical Details
SecurityInformationRequestFlagsKey Implementation Details
Access Rights Management:
Credit Management:
Error Handling:
Interface Design:
Encoderinterface, allowing for custom security descriptor encoders