Fix: SMB share-open no longer pops macOS auth dialog#21
Merged
Conversation
1 task
Opening an SMB share for a host not in Keychain (fresh Docker container, new NAS, colleague's laptop) used to pop the kernel `smbfs` credential dialog with the current OS user prefilled. Root cause: `NetFSMountURLSync` got NULL user/passwd plus an empty `openOptions`, so NetFS fell through to Keychain lookup → miss → prompt. Cmdr already knows whether the user picked "guest" vs typed credentials in `NetworkMountView.svelte`. Plumb that intent into NetFS: - Guest mount: set `kNetFSUseGuestKey = true` (the literal `"Guest"` key, since `kNetFSUseGuestKey` is a `#define` in `<NetFS/NetFS.h>` rather than an exported symbol) in `openOptions`. NetFS authenticates as guest, skips Keychain, no prompt. - Credentialed mount: already worked — we already pass user/passwd as CFStrings. Unchanged. - The existing `ForceNewSession` flag for path disambiguation (different-server same-share-name case) coexists with the new `Guest` flag in the same dictionary. Tests: - New `smb_integration_mount_guest_no_dialog` (gated to macOS, requires Docker SMB) asserts a guest mount against `smb-consumer-guest` returns in < 10 s. A real dialog blocks indefinitely, so the tight wall-clock budget is the regression signal. - No paired auth-success/failure test: NetFS aggressively caches SMB sessions across calls, so a tight harness can't reliably distinguish "creds passed correctly" from "session reused" without forcibly tearing down the session. The auth path is exercised manually via `pnpm dev`. - Module doc-comment now explains the credential-passing contract and why each branch matters. Cleaner take on #17, which tried to skip the OS mount entirely and broke path resolution. ## Test plan - `./scripts/check.sh --check clippy --check rust-tests --check rust-integration-tests --check rustfmt --check svelte-check`: green (1892 unit tests, 31 integration tests). - `cargo nextest run --run-ignored only -E 'test(smb_integration_mount_guest_no_dialog)'` against the running Docker SMB containers: green in 2.5 s on a 10 s budget. - Manual: open an SMB share via Network view against a fresh Docker container without Keychain creds → no dialog, share mounts.
c447f81 to
6926bd7
Compare
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.
Opening an SMB share for a host not in Keychain (fresh Docker container, new NAS, colleague's laptop) used to pop the kernel
smbfscredential dialog with the current OS user prefilled. Root cause:NetFSMountURLSyncgotNULLuser/passwd plus an emptyopenOptions, so NetFS fell through to Keychain lookup → miss → prompt. The fix tells NetFS "this is a guest mount, don't consult Keychain" via thekNetFSUseGuestKeyopen option (literal key"Guest", since the constant is a#definerather than an exported symbol).Cleaner take on #17, which tried to skip the OS mount entirely and broke path resolution (synthetic
/Volumes/<share>got prefix-matched toMacintosh HD,std::fs::read_dirhit ENOENT, deleted-path recovery bounced the pane back to/Volumes).mount_share_sync(macOS) builds a singleopenOptionsCFMutableDictionarythat combines the existingForceNewSessionflag (path disambiguation) with the newGuestflag (no-credentials mount). Credentialed mounts already worked: we already pass user/passwd as CFStrings.mount.rsexplains the credential-passing contract, the Keychain-fallback failure mode, and the two cases (guest vs. credentialed) we plumb through to NetFS.smb_integration_mount_guest_no_dialogtest (gated totarget_os = "macos", requires Docker SMB containers): asserts a guest mount againstsmb-consumer-guestreturns in < 10 s. A real credential dialog blocks indefinitely, so the tight wall-clock budget is the regression signal.mount_linux.rs, gvfs-based) unchanged: the dialog issue is macOS-specific.pnpm devagainstsmb-consumer-auth.Test plan
./scripts/check.sh --check clippy --check rust-tests --check rust-integration-tests --check rustfmt --check svelte-checkgreen (1892 unit tests, 31 integration tests).cargo nextest run --run-ignored only -E 'test(smb_integration_mount_guest_no_dialog)'against the running Docker SMB containers: green in 2.5 s on a 10 s budget.smb-consumer-guest, port 10480) without any Keychain creds — no dialog, share mounts, contents listable.oxfmtfailures in 5 unrelated markdown files (AGENTS.md,docs/notes/totalcmd-plugin-analysis.md, etc.) exist atorigin/maintoo — not introduced here.