Implement the WebSDK/nwafp.h NCP 0x2222/35 AFP subfunction 0x0b, Alloc Temporary Directory Handle, for the same conservative path-backed subset used by the current AFP Entry ID and File Information probes.\n\nThe documented request carries an AFP volume number, a base AFP Entry ID, and an optional AFP-style path. mars_nwe still has no persistent CNID/base-ID lookup, so this patch deliberately accepts only requests with a path component and rejects entry-id-only allocation as Invalid Path. For the supported smoke-test path, raw SYS:-style paths are resolved through the existing NetWare path machinery and the final handle is allocated with nw_alloc_dir_handle() as a temporary, task-scoped NetWare directory handle.\n\nThe implementation keeps the AFP namespace gate intact: without the optional Netatalk/libatalk backend, the endpoint continues to return Invalid Namespace rather than pretending that the Mac namespace exists. With the backend enabled, successful replies contain the allocated temporary directory handle and the effective-rights mask returned by the existing directory-handle table. Diagnostics include the AFP volume/base Entry ID input, path, returned handle, and rights so smoke-test output can be matched to server logs.\n\nAdd a Linux ncpfs/libncp smoke helper for the new endpoint. The helper sends the AFP 0x0b request through NWRequestSimple(), prints the returned handle and rights mask, and immediately deallocates the handle in the same connection via the normal NetWare Deallocate Directory Handle call. The README documents that these handles are connection/task-local and must not be copied into later tests or reused from server logs.\n\nTests:\n- git diff --check\n- gcc -fsyntax-only tests/linux/afp_temp_dir_handle_smoke.c with temporary local ncpfs header stubs\n\nNot run:\n- Full CMake build in this container: missing gdbm/ncpfs development headers/libraries.\n\nTODO:\n- Replace the path-backed subset with persistent CNID/base-ID lookup once the AFP metadata backend grows durable directory identity support.\n- Verify live Linux smoke cases against SYS:, SYS:PUBLIC, SYS:SYSTEM, and SYS:BURST on a mars_nwe host with ENABLE_NETATALK_LIBATALK=ON.
Document the Linux smoke-test coverage for NCP 0x23 AFP subfunction 0x06, Get Entry ID From NetWare Handle.
The WebSDK documents the request as NCP 0x2222/35/06, with the SDK headers exposing the same operation through AFPGetEntryIDFromNetWareHandle() and NWAFPGetEntryIDFromNetWareHandle(). Unlike the path and name probes, this request is centered on a 6-byte NetWare file handle that is valid only in the current client connection.
Record the known-good libncp smoke invocations for SYS:PUBLIC files. The test opens each file in the same connection, passes the returned NetWare handle to the AFP request, and verifies the conservative reply shape: volume 0, a 32-bit AFP Entry ID, and data-fork indicator fork=0.
Also document the current implementation boundary. The returned Entry IDs are still stat-derived fallback values, server diagnostics mark them with fallback, parent Entry ID derivation remains conservative, and persistent CNID/AppleDouble/libatalk-backed identity plus AFP resource-fork handle semantics remain TODO work.
Tests:
- Documentation-only change; no binary rebuild required.
- Previously verified: ./afp_entry_id_smoke --from-handle -S MARS -U SUPERVISOR -P ... SYS:PUBLIC/pmdflts.ini
- Previously verified: ./afp_entry_id_smoke --from-handle -S MARS -U SUPERVISOR -P ... SYS:PUBLIC/ohlogscr.bat
Wire NCP 0x23/0x06 AFP Get Entry ID From NetWare Handle to the existing AFP entry-id backend.
The WebSDK documents NCP 0x2222/35/06 as taking a 6-byte NetWare file handle and returning the volume number, a 32-bit AFP Entry ID, and a fork indicator. The SDK headers expose the same operation as AFPGetEntryIDFromNetWareHandle() and NWAFPGetEntryIDFromNetWareHandle().
Use the connection-local mars_nwe file handle table to map the supplied NetWare file handle back to its Unix path, require the optional libatalk backend as for the other AFP calls, and then return a libatalk Entry ID when available or the existing stat-derived fallback ID otherwise. Report the data fork for now because mars_nwe does not yet expose AFP resource-fork open semantics.
Extend the Linux AFP entry-id smoke test with --from-handle. The test opens the requested file through libncp in the same connection, sends the returned 6-byte NetWare file handle to the AFP call, and closes the file afterwards.
This implements the read-only data-fork handle-to-entry-id path; persistent CNID mapping and resource-fork handle semantics remain future work.
Document the Linux smoke coverage for NCP 0x23/0x04 AFP Get Entry ID From Name after the path-backed implementation was verified.
The same afp_entry_id_smoke tool now exercises both the older path-name probe and the name-based entry-id lookup. Record the --from-name examples for SYS:, SYS:PUBLIC, SYS:SYSTEM, and SYS:BURST, and note that the current implementation still returns stat-derived fallback Entry IDs until persistent CNID/AppleDouble mapping is available.
Update TODO.md so the implemented AFP status matches the tested endpoints while keeping the remaining base-entry-id-relative lookup and persistent Mac namespace work tracked as follow-up.
Fix two malformed fprintf() string literals introduced while adding the AFP Get Entry ID From Name smoke-test options.
The previous patch accidentally emitted literal newlines inside the diagnostic strings for invalid --volume and --entry-id arguments, which broke compilation of afp_entry_id_smoke.c.
This changes only Linux test diagnostics; AFP protocol behavior is unchanged.
Wire NCP 0x23/0x04 AFP Get Entry ID From Name to the same conservative path-backed Entry ID lookup used by the existing AFP path-name probe.
The WebSDK documents NCP 0x2222/35/04 as taking a volume number, an AFP base Entry ID, and an AFP path string that modifies that base, and returning the AFP Entry ID for the given path. The SDK headers expose the same call as NWAFPGetEntryIDFromName().
MARS-NWE does not yet maintain persistent CNID/base-ID lookup state, so support the verified SYS:-style path-backed subset first: require the optional libatalk backend, resolve the supplied path through the existing mars_nwe path machinery, and return the stored libatalk Entry ID when available or the existing stat-derived fallback Entry ID otherwise. Entry-ID-only lookup remains invalid path until persistent CNID/AppleDouble mapping is implemented.
Extend the Linux AFP Entry ID smoke test with --from-name so the new endpoint can be exercised without an AppleTalk client while keeping the existing 0x0c test path unchanged.
This adds the documented read-only Entry ID query path only; it does not add persistent AFP base-ID lookup or broader Mac namespace semantics.
Document the Linux AFP 2.0 Scan File Information smoke coverage after the endpoint was verified against SYS:PUBLIC.
The scan test exercises the WebSDK-documented NCP 0x23/0x11 request by walking a directory one entry at a time and feeding the returned next_last_seen AFP Entry ID into the next request. Record the verified multi-entry SYS:PUBLIC sequence and explain that the current Entry IDs are still stat-derived fallback values until persistent CNID/AppleDouble mapping is implemented.
Update the Linux test README with the afp_scan_info_smoke build target and examples, and move Scan File Information out of the generic unimplemented AFP follow-up list while keeping broader scan edge cases and full Mac namespace work tracked.
This is documentation-only and does not change AFP protocol behavior.
Wire NCP 0x23/0x11 AFP 2.0 Scan File Information to a conservative read-only directory scan.
The WebSDK documents NWAFPScanFileInformation as taking a volume number, AFP base entry id, last-seen AFP id, search mask, request mask, path string, and file-info buffer. The call scans a directory relative to the AFP base and returns AFP file information for the next matching entry, updating the last-seen id for the caller's next iteration.
Reuse the existing AFP file information formatter and libatalk/stat-derived entry-id path. For now, support path-backed scans only: resolve the supplied SYS:-style path through the mars_nwe path machinery, enumerate one child directory entry after the supplied last-seen id, and return a last-seen id plus an AFP file-info record. Entry-id-only scans, persistent CNID lookup, and full AFP search-mask semantics remain future work.
Add a Linux afp_scan_info_smoke helper using ncpfs/libncp so the new endpoint can be exercised without an AppleTalk client.
This implements the documented read-only scan path needed for directory browsing smoke tests, while keeping write-side AFP and persistent Mac namespace semantics unchanged.
Document the verified AFP 2.0 Get File Information smoke-test coverage after the endpoint was exercised against the same standard SYS volume paths as the older AFP file-information call.
The Linux afp_file_info_smoke test now covers both NCP 0x23/0x05 and NCP 0x23/0x0f. Record that --afp20 was verified against SYS:, SYS:PUBLIC, SYS:SYSTEM, and SYS:BURST using the current path-backed read-only reply.
Keep the remaining AFP limitations explicit: the reply still uses stat/libatalk-derived fields, marks temporary Entry IDs with the fallback diagnostic, and leaves persistent CNID/AppleDouble IDs, Parent ID mapping, and fuller Mac namespace metadata as future work.
This is documentation-only and does not change AFP protocol behavior.
Route NCP 0x23/0x0f AFP 2.0 Get File Information through the existing read-only AFP file-information helper.
The WebSDK and nwafp.h list both AFP Get File Information and AFP 2.0 Get File Information as path/file-information queries that return the AFP file-information record used by Mac namespace clients. The already implemented 0x05 path handles SYS:-style path requests and fills the safe read-only fields from Unix stat data plus the optional libatalk Finder Info and resource-fork helpers.
Use the same conservative path-backed reply for 0x0f for now. This gives Linux smoke-test coverage for the AFP 2.0 subfunction without adding entry-id-only lookup, persistent CNID mapping, write-side metadata updates, or fuller resource-fork semantics.
Extend afp_file_info_smoke with --afp20 so the same SYS:, SYS:PUBLIC, SYS:SYSTEM, and SYS:BURST cases can exercise the AFP 2.0 subfunction. Update the Linux test README and TODO tracking to record that AFP 2.0 file information is covered by the same temporary fallback model.
This implements only the read-only path-based subset; richer AFP 2.0 behavior remains future Mac-namespace work.
Document the Linux smoke-test coverage for the newly implemented AFP Get File Information endpoint.\n\nThe WebSDK-documented NCP 0x2222/35/05 path now has a Linux libncp smoke test alongside the existing AFP Entry ID probe. Record the verified SYS:, SYS:PUBLIC, SYS:SYSTEM, and SYS:BURST cases and describe the read-only reply fields currently populated from Unix stat data and the optional libatalk helper wrappers.\n\nAlso update the AFP Entry ID smoke-test documentation to match the current default raw-path mode, where SYS:-style paths are sent with directory handle 0 and handle allocation is kept behind --alloc-handle for separate debugging.\n\nKeep the remaining AFP/Mac namespace work in TODO.md, including persistent CNID/AppleDouble entry IDs, Parent ID mapping, Finder Info/resource-fork semantics, AFP 2.0 file information, and Scan File Information coverage.\n\nThis is documentation-only and does not change AFP protocol behavior.
Do not include the AFP Get File Information subfunction byte in the NWRequestSimple payload when the request is already sent through NCPC_SFN().
libncp's subfunction request helper supplies the NCP 0x23 AFP subfunction on the wire. The smoke test also placed 0x05 as the first byte of its local payload, so mars_nwe received a duplicated subfunction byte. The server then decoded the low byte of the request mask as the path length, producing a boundary-check failure with path_len=255 before the path could be resolved.
Build the smoke-test payload as the data following the subfunction byte: Volume Number, AFP Entry ID, Request Bit Map, Path String Length, and Path String. This matches the server-side decoder, which sees the subfunction byte at afp_req[0].
This changes only the Linux smoke test; server AFP protocol behavior is unchanged.
Wire NCP 0x23/0x05 AFP Get File Information to a conservative read-only reply
for SYS:-style paths.
The WebSDK documents NCP 0x2222/35/05 as taking a Volume Number, AFP Entry ID,
request bit map, and AFP path modifier string, and returning an AFP file
information record with entry id, parent id, attributes, data and resource fork
lengths, offspring count, NetWare dates, Finder Info, long and short names,
owner id, access privileges, and ProDOS information. The SDK headers expose the
same call as AFPGetFileInformation() and NWAFPGetFileInformation(), with the
wire reply matching RECPKT_AFPFILEINFO.
Resolve the supplied path through the existing mars_nwe path machinery, require
the optional Netatalk/libatalk backend as for the entry-id probe, and fill the
fields that can be derived safely from Unix stat data and the existing libatalk
helpers. Finder Info and resource fork length are read through nwatalk when
present; entry ids fall back to the existing stat-derived AFP id until
persistent CNID/AppleDouble ids are implemented. Parent id and ProDOS-specific
data remain zero for now.
Add a Linux afp_file_info_smoke test using ncpfs/libncp so the new call can be
exercised without an AppleTalk client. The test sends raw SYS:-style paths with
directory handle 0, matching the verified AFP Entry ID smoke-test path.
This implements only the read-only AFP file information query for path-based
requests; entry-id-only lookup, persistent CNID mapping, and write-side AFP
semantics remain future work.
Default the Linux AFP Entry ID smoke test to sending the supplied path directly
with directory handle 0.
The verified smoke cases use SYS:-style paths against mars_nwe, and those
requests reach NCP 0x23/0x0c and return Entry IDs. The intermediate automatic
temporary directory-handle allocation path is not required for that endpoint
coverage and can fail before the AFP request is sent, which makes the smoke
test diagnose the wrong subsystem.
Keep the handle-allocation path available behind --alloc-handle for follow-up
debugging, keep --raw-path as an explicit no-op for compatibility, and keep
--dir-handle N for testing relative paths against a handle that is valid in
the current connection.
This changes only the Linux smoke test; server AFP protocol behavior is
unchanged.
Document the Linux AFP Entry ID smoke-test coverage after the endpoint was verified against the standard SYS volume paths.
The test exercises the WebSDK-documented NCP 0x23/0x0c AFP Get Entry ID From Path Name request by logging in through libncp, allocating a temporary directory handle for the volume root, and sending the relative path to the AFP endpoint.
Record the verified SYS:, SYS:PUBLIC, SYS:SYSTEM, and SYS:BURST cases, and describe the current stat-derived fallback Entry ID diagnostics so the result is not confused with persistent CNID/AppleDouble storage.
Keep the remaining AFP work tracked in TODO.md, including replacing the fallback with persistent CNID/directory-id mapping and extending tests when additional AFP subfunctions are implemented.
This is documentation-only and does not change AFP protocol behavior.
Open the libncp connection with login_necessary set to true.
ncpfs/libncp does not block individual NCP endpoints here. The problem was that ncp_initialize(..., 0, ...) deliberately clears the user name even when -S/-U/-P were supplied, leaving the connection unauthenticated. mars_nwe then rejects directory-handle allocation for non-login paths with Invalid Path before the AFP NCP 0x23/0x0c request is ever sent.
The AFP Entry ID smoke test needs normal file-service path access in order to allocate or use a directory handle before issuing the AFP request. Require a logged-in connection, while still allowing no-password test users via libncp's existing -n option.
This changes only the Linux smoke test; server AFP protocol behavior is unchanged.
Allocate the temporary directory handle for the AFP Entry ID smoke test through mars_nwe's old directory-handle endpoint instead of the NCP 87 namespace helper.
The AFP Get Entry ID From Path Name call expects a directory handle plus a relative path. The previous smoke-test variants tried to obtain that handle through libncp's namespace allocation helper, but mars_nwe currently rejects the NCP 87 DIRBASE volume-root form before the AFP request is sent, so no AFP diagnostics appear in the server log.
Use the old NCP 0x16/0x13 Allocate Temporary Directory Handle call that mars_nwe implements directly, passing a VOL: root path and then sending only the relative path to NCP 0x23/0x0c. Keep the existing deallocate path.
This changes only the Linux smoke test; server AFP protocol behavior is unchanged.
Resolve the volume name before allocating the temporary directory handle used by the AFP Entry ID smoke test.
ncpfs does not block the AFP endpoint. Its ncp_ns_alloc_short_dir_handle() helper sends the namespace-aware handle allocation request using the supplied directory style, volume, directory entry, and path tuple. The ncpfs tests allocate a handle for a volume root with NCP_DIRSTYLE_DIRBASE, a volume number, directory entry 0, and no encoded path, then use that handle with relative paths.
The smoke test was still trying to allocate the handle as a NOHANDLE path using a raw VOL: string. mars_nwe rejects that request before the AFP request is sent, so the test never reaches NCP 0x23/0x0c and no AFP diagnostics appear in the server log.
Look up the volume number with ncp_get_volume_number(), allocate the temporary handle as DIRBASE(volume, 0, NULL), and keep passing only the relative path to AFP Get Entry ID From Path Name.
This changes only the Linux smoke test; server AFP protocol behavior is unchanged.
Pass NCP_PATH_STD to ncp_ns_alloc_short_dir_handle() when the AFP Entry ID
smoke test allocates a temporary directory handle for a VOL: path.
The test already uses libncp to allocate the handle, but it passed the raw
"SYS:" bytes together with an explicit byte length. ncpfs helpers expect
NCP_PATH_STD when the caller wants libncp to encode a normal NetWare path into
the component-counted wire format. Sending the raw VOL: string made the server
reject the handle allocation with completion 0x98 before the AFP endpoint was
reached.
Keep the libncp handle allocation path, but let libncp encode the root volume
path the same way the ncpfs tools do. This changes only the Linux smoke test;
server AFP protocol behavior is unchanged.
Use libncp\047s namespace-aware short directory handle helper in the AFP Entry ID smoke test instead of hand-building the old Allocate Temporary Directory Handle request.\n\nThe smoke test accepts NetWare-style VOL:PATH arguments, but NCP 0x23/0x0c AFP Get Entry ID From Path Name expects a directory handle plus a relative path. The previous test tried to allocate a temporary handle by issuing the old NCP 0x16/0x13 request directly, which failed with Invalid Path before the AFP endpoint was reached.\n\nMirror the ncpfs tools and call ncp_ns_alloc_short_dir_handle() for the volume root in the DOS namespace, then pass only the relative path to the AFP request. Keep deallocating the temporary handle after the request.\n\nThis changes only the Linux smoke test; server AFP protocol behavior is unchanged.
Teach the Linux AFP Entry ID smoke test to treat VOL:PATH arguments like normal NetWare paths instead of sending the full string as the AFP path component.
The WebSDK documents AFP Get Entry ID From Path Name as taking a NetWare directory handle plus a path string. A user-supplied path such as SYS:PUBLIC therefore needs a directory handle for the SYS volume root and a relative AFP path of PUBLIC; sending SYS:PUBLIC as the AFP path with directory handle zero makes the server reject the request with Invalid Path before the actual AFP lookup is useful.
Use the existing ncpfs/libncp request path to allocate a temporary directory handle for the volume root when the test receives a VOL:PATH argument and no explicit --dir-handle was supplied. Keep --raw-path for callers that want to send the path exactly as typed, and add --allow-invalid-path so negative path-resolution tests can distinguish Invalid Path from Invalid Namespace.
Also add failure diagnostics to the server-side AFP path lookup so unsupported-backend, boundary-check, path-resolution, and stat failures are visible in the mars_nwe log.
This changes only the Linux smoke test and debug logging; it does not change successful AFP protocol semantics.
Add an optional Linux-side smoke test for the first implemented NetWare AFP endpoint.
The WebSDK documents NCP 0x2222/35/12 AFP Get Entry ID From Path Name as taking a NetWare directory handle and path string and returning a 32-bit AFP entry id. MARS-NWE now has a guarded implementation of that probe when the optional Netatalk/libatalk backend is compiled in, but exercising it does not require a real AppleTalk workstation.
Use the ncpfs/libncp client library as the test transport. ncpfs is commonly available on Linux mars_nwe test hosts and its NWRequestSimple() helper builds the same length-prefixed subfunction request format used by normal libncp callers. The test accepts standard ncpfs connection options such as -S, -U, -P, and -n, sends NCP 0x23/0x0c, and prints the returned entry id.
Keep the test out of normal builds behind MARS_NWE_BUILD_LINUX_TESTS because it depends on host ncpfs development headers/library and on a running server. Add an --allow-invalid-namespace mode so builds without the Netatalk backend can still run a negative smoke test and verify that AFP remains unavailable.
This adds test infrastructure only and does not change server protocol behavior.