Skip to content

DFS support - #21

Closed
tooptoop4 wants to merge 8 commits into
CloudSoda:mainfrom
tooptoop4:dfs
Closed

DFS support#21
tooptoop4 wants to merge 8 commits into
CloudSoda:mainfrom
tooptoop4:dfs

Conversation

@tooptoop4

Copy link
Copy Markdown

Fixes #20

see hirochachacha/go-smb2#79

credit to @ashutosh-bhole-druva hirochachacha/go-smb2#79

@tooptoop4

Copy link
Copy Markdown
Author

@arashpayan can u merge?

Comment thread README.md Outdated
@tooptoop4
tooptoop4 requested a review from b-turchyn February 13, 2024 17:28
Comment thread README.md

@b-turchyn b-turchyn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compilation error that needs to be resolved, otherwise the PR will break the library.

Comment thread internal/smb2/request.go
Comment thread internal/smb2/request.go Outdated
@tooptoop4
tooptoop4 requested a review from b-turchyn February 13, 2024 19:49
@b-turchyn

Copy link
Copy Markdown

Thanks for providing the missing file.

A few points:

  1. I've hit some defects in the code from my original testing, namely that Share doesn't have mapWriterLock and dfsTargetList populated when mounting a share. I've got this fixed locally and successfully traversed one DFS link. Which leads into...
  2. Something I've noticed while testing this is if the DFS link is mid-way through the network share, this implementation won't detect it. Rather, it's the responsibility of the user of this new functionality to iterate through each step of the path, see if there's a link present, and traverse it to go to the next server.
    i.e. if the user wants to mount \\example.com\foo\bar\baz and bar is the DFS link, this current implementation is clunky.
    I think there's opportunities to make this nicer. Some sort of helper to be able to access the "true" location across multiple directory traversals would be a welcome addition.

I don't want to downplay the value that this will provide. It's still better than no DFS support, and that's great. But usage is based around the assumptions that:

  1. The developer knows which specific shares are the DFS links
  2. The developer is willing to be responsible for handle the jumping between servers to get to the final target

Maybe the original developer anticipated some of this. Not sure! It's more likely that I'm stoopid and am missing something.

Others are more than welcome to get into this and kick the tires. I have no affiliation to this project; I'm just interested in this functionality for my own needs, and my Golang and SMB knowledge are weak enough that I wouldn't consider my approval to carry any weight. All I'll really be able to do is give an "it works for my use case" thumbs-up.

@arashpayan

Copy link
Copy Markdown
Collaborator

I intend to review it and bring it in. I'll be working on/with this package next week, so I'll have hours allocated to review this then. In the meantime, I'd appreciate any feedback from others similar to what @b-turchyn provided. I'm a complete novice when it comes to DFS so it'll take me some time to get up to speed, and there's a good chance I'll still overlook something.

@arashpayan

Copy link
Copy Markdown
Collaborator

Don't worry. I haven't forgotten about this PR. I've recently been working on adding support for getting and setting security descriptors. Once I bring those changes into main I can focus on DFS.

@cyberb

cyberb commented Jul 19, 2024

Copy link
Copy Markdown

sorry is it possible to merge this?

Comment thread client.go
}

// this is for handling multiple calls
fs.mapWriterLock.Lock()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

panics with nil pointer as mapWriterLock is never set

Comment thread client.go

//check if its present in the map
//TODO: Add the TTL for this target and check here. Otherwise invalidate this cache entry
cachedTargetList, ok := fs.dfsTargetList[getFirstChild(dfsname, dirname, isLink)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dfsTargetList is not initialized either

Comment thread client.go
ctx context.Context
ctx context.Context
dfsTargetList map[string][]*DFSTarget //For caching the DFS targets for a path
mapWriterLock *sync.RWMutex

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you make it non pointer then you do not need to initialize it

@tooptoop4

Copy link
Copy Markdown
Author

stale

@tooptoop4 tooptoop4 closed this Oct 17, 2024
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.

DFS support

4 participants