Commit Graph

157 Commits

Author SHA1 Message Date
OpenAI
ac79fa9d22 nwconn: support AFP scan from directory entry IDs
All checks were successful
Source release / source-package (push) Successful in 47s
2026-05-31 09:03:43 +02:00
Mario Fetka
63ee154c89 tests: drop transient AFP SetInfo layout markers 2026-05-31 07:49:27 +02:00
Mario Fetka
6230aa1d7c nwconn: resolve AFP entry-id-relative name lookups 2026-05-31 07:38:15 +02:00
Mario Fetka
77a40f9ed2 nwconn: share AFP entry-id resolver with metadata paths 2026-05-31 06:44:56 +02:00
Mario Fetka
fa96ebb264 nwatalk: use standalone mars_nwe AFP xattr backend 2026-05-31 06:15:03 +02:00
a
1cec6a64aa nwconn: resolve AFP open fork entry ids through nwatalk metadata 2026-05-30 23:29:25 +02:00
Mario Fetka
330d20a0e1 nwconn: route AFP open fork writes through NetWare opens 2026-05-30 23:13:51 +02:00
Mario Fetka
f0864c1150 nwconn: align AFP get and scan info layouts with WebSDK 2026-05-30 22:58:06 +02:00
a
e08ce594b5 nwconn: require WebSDK AFP set file information layout
All checks were successful
Source release / source-package (push) Successful in 48s
2026-05-30 22:40:58 +02:00
Mario Fetka
211d04ea62 nwconn: accept WebSDK AFP set file information layout 2026-05-30 22:35:35 +02:00
a
bcacd6142d nwconn: search files only for AFP file rename
All checks were successful
Source release / source-package (push) Successful in 48s
2026-05-30 22:20:33 +02:00
a
02e247b133 nwconn: implement AFP rename through NetWare move paths 2026-05-30 22:10:02 +02:00
Test
4183a63689 nwconn: implement AFP delete through NetWare remove paths 2026-05-30 21:55:14 +02:00
Mario Fetka
37039a773f nwconn: implement AFP create file through NetWare file creation
All checks were successful
Source release / source-package (push) Successful in 49s
2026-05-30 21:36:03 +02:00
Mario Fetka
9032848c9a nwconn: keep AFP file entry IDs on nwatalk fallback
All checks were successful
Source release / source-package (push) Successful in 47s
2026-05-30 21:00:20 +02:00
Mario Fetka
d1a7780532 nwconn: implement AFP create directory through NetWare directory creation
All checks were successful
Source release / source-package (push) Successful in 48s
2026-05-30 20:46:29 +02:00
Mario Fetka
f9c7a795df nwconn: align AFP endpoint names with WebSDK
All checks were successful
Source release / source-package (push) Successful in 48s
2026-05-30 20:39:14 +02:00
Mario Fetka
faa44d060b nwconn: derive AFP entry ids from NetWare handles
All checks were successful
Source release / source-package (push) Successful in 45s
2026-05-30 20:15:06 +02:00
OpenAI
a18de6abd2 nwconn: derive AFP access privileges from trustees
All checks were successful
Source release / source-package (push) Successful in 47s
2026-05-30 19:50:25 +02:00
Mario Fetka
34504f1381 Fix Compile
All checks were successful
Source release / source-package (push) Successful in 46s
2026-05-30 19:33:57 +02:00
Mario Fetka
31a9234c8b nwconn: route AFP access timestamps through atime
All checks were successful
Source release / source-package (push) Successful in 48s
2026-05-30 19:27:38 +02:00
OpenAI
b442500ef9 nwconn: route AFP create timestamps through nwarchive fileinfo
All checks were successful
Source release / source-package (push) Successful in 50s
2026-05-30 19:18:35 +02:00
OpenAI
bbc37565c8 nwconn: route AFP backup timestamps through nwarchive
All checks were successful
Source release / source-package (push) Successful in 48s
Implement the WebSDK AFP Set File Information Backup Date/Time request bitmap as a narrow metadata write that reuses mars_nwe's existing archive metadata helper instead of adding a new AFP-specific storage path.

The AFP Attributes word already maps Archive through the NetWare FILE_ATTR_A path; Backup Date/Time is a separate SetInfo field and belongs in the existing nwarchive.c archive date/time metadata.  Include nwarchive.h in nwconn, fill the AFP information record's Backup Date/Time fields from mars_nwe_get_archive_info(), and accept the SetInfo 0x2000 bitmap by calling mars_nwe_set_archive_info() after the normal AFP path resolution and Modify-rights gate.

Extend the Linux Set File Information smoke helper with --backup-time-epoch/--backup-time-only, verify the returned 120-byte file information record at offsets 28/30, and have afp_smoke_suite.sh dump user.org.mars-nwe.netware.archive so reports prove that the WebSDK field is stored through the NetWare archive metadata path.

Tests: git diff --check; bash -n tests/linux/afp_smoke_suite.sh; gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c
2026-05-30 18:21:54 +02:00
OpenAI
55fdf64c8e nwconn: align AFP attribute bits with WebSDK
All checks were successful
Source release / source-package (push) Successful in 46s
The WebSDK/NCP AFP File Information records use a distinct SetInfo request bitmap and attribute word.  The previous smoke-oriented implementation reused the low response-bit positions for Set Attributes, Modify Date/Time, FinderInfo, Hidden/Invisible, System, and Archive.  That made the current tests pass, but it was not faithful to the documented header semantics and risked keeping AFP metadata parallel to existing NetWare attributes.

Switch Set File Information to the documented request bitmap values: 0x0100 for Attributes, 0x1000 for Modify Date/Time, and 0x4000 for FinderInfo.  Switch the AFP attribute word to the documented NetWare-style bits: Hidden 0x0200, System 0x0400, Subdirectory 0x1000, and Archive 0x2000.

Map Hidden, System, and Archive through the existing NetWare attribute store via FILE_ATTR_H, FILE_ATTR_S, and FILE_ATTR_A.  This keeps AFP Set/Get/Scan aligned with mars_nwe's existing attribute helper instead of maintaining duplicate AFP-only xattr state.  FinderInfo remains AFP metadata and still uses the Modify-rights gate added earlier.

Update the Linux smoke helper and suite to use --hidden / --clear-hidden while keeping --invisible / --clear-invisible as compatibility aliases.  Document the corrected WebSDK bit values and the convergence rule that NetWare attributes must use mars_nwe NetWare helpers.

Tests: git diff --check; bash -n tests/linux/afp_smoke_suite.sh; gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c
2026-05-30 17:48:51 +02:00
OpenAI
dacfc0f7a1 nwconn: gate AFP metadata writes with Modify rights
All checks were successful
Source release / source-package (push) Successful in 54s
AFP Set File Information intentionally stores some Apple-specific metadata in mars_nwe-owned xattrs because FinderInfo and the narrow Invisible/System AFP bits do not have a complete NetWare-side representation yet.  Those xattrs are storage details, however, and should not let the AFP adapter bypass the same NetWare policy that protects ordinary metadata changes.

Add a small Modify-rights gate for AFP-specific metadata writes after the path-backed request has been resolved to a mars_nwe volume and Unix node.  The check uses the existing trustee/effective-rights helper with TRUSTEE_M before writing FinderInfo or AFP-only attribute xattrs.  Archive remains routed through the NetWare FILE_ATTR_A attribute helper, and Modify timestamp remains routed through nw_utime_node(), so their existing mars_nwe policy paths are unchanged.

This keeps the WebSDK/NWAFP Set File Information handler as an Apple-facing adapter over existing mars_nwe access control rather than a parallel metadata writer.  It also documents the convergence rule in TODO.md so later Create, Rename, and Delete work can continue to prefer existing NetWare helpers or thin wrappers over duplicated AFP-local file server logic.

Tests: git diff --check

TODO: add non-SUPERVISOR negative smoke coverage for missing Modify rights once a stable low-privilege test user and trustee setup are available.
2026-05-30 16:59:47 +02:00
OpenAI
b768c921c8 nwconn: return DOS namespace names for AFP entry ids
All checks were successful
Source release / source-package (push) Successful in 49s
Route AFP Get DOS Name From Entry ID through the existing mars_nwe DOS namespace alias helper instead of returning raw Unix directory entry names from the reverse lookup walk.

WebSDK semantics require this subfunction to return a DOSPathString. The current AFP entry ids are mars_nwe/libatalk metadata ids rather than namspace.c base handles, so the lookup still has to walk the volume tree, but each path component is now formatted with namedos.c build_dos_83_alias(). This keeps the Apple-facing adapter aligned with the existing DOS namespace rules used by normal NetWare clients.

Update the Linux smoke helper's default expectation for raw VOL:PATH smoke inputs to compare against the DOS 8.3 uppercase form. Explicit --expect remains available for callers that want to validate a specific alias.

Tests: git diff --check; gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_dos_name_smoke.c
2026-05-30 16:43:16 +02:00
OpenAI
7241a28393 nwconn: implement AFP DOS name reverse lookup
All checks were successful
Source release / source-package (push) Successful in 50s
Implement the WebSDK/NWAFP Get DOS Name From Entry ID subfunction (NCP 0x2222/35/18) as a conservative, read-only reverse lookup over mars_nwe's existing volume and AFP metadata infrastructure.

The documented request carries a volume number and 32-bit Macintosh directory entry ID, and the reply returns a length-prefixed DOS path string.  mars_nwe's current AFP entry IDs are not the namespace base handles maintained by namspace.c; they are mars_nwe/libatalk AFP metadata IDs cached through nwatalk.  Reuse the existing volume table as the search root and nwatalk_get_entry_id() as the identity probe instead of inventing a parallel namespace handle mapping.

The reverse lookup deliberately does not create fallback IDs while walking the volume.  It only matches entries that already have mars_nwe or Netatalk AFP metadata, which is the normal smoke-test sequence after Get Entry ID, Get File Information, or Scan File Information has cached the target ID.  This keeps the lookup read-only and avoids populating entry-id xattrs across an entire volume as a side effect.

Add a Linux afp_dos_name_smoke helper and wire it into the AFP smoke suite.  The helper can resolve the supplied VOL:PATH to an entry ID first, then sends the 0x12 request and verifies the returned path without the volume prefix.  The suite continues to exercise the existing path-backed AFP compatibility flow before future create/rename/remove work.

Tests:\n- git diff --check\n- bash -n tests/linux/afp_smoke_suite.sh\n- gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_dos_name_smoke.c\n\nTODO:\n- Replace the volume walk with a real CNID/base-ID index when persistent AFP identity storage grows one.\n- Return true DOS 8.3 aliases once the AFP reverse lookup is wired to the namespace alias helpers rather than preserving the cached path component spelling.
2026-05-30 16:08:30 +02:00
OpenAI
3675b30d43 nwconn: fix AFP archive attribute set mask scope
All checks were successful
Source release / source-package (push) Successful in 47s
Repair the AFP Set File Information attribute write path introduced by the NetWare archive mapping patch.

The validation pass already derives requested_bits from the AFP attribute word while checking the WebSDK/NWAFP Set Attributes semantics, but that variable is scoped to the validation block.  The later write pass accidentally reused the same name after it had gone out of scope, causing builds to fail with an undeclared identifier.

Derive the same mask again in the write pass as requested_set_bits and use it to decide whether the Archive bit should be routed through the existing NetWare FILE_ATTR_A path and whether the AFP-only xattr bits should be persisted through nwatalk.  This keeps Archive mapped to the existing NetWare attribute store while leaving Invisible/System in org.mars-nwe.afp.attributes.

Tests: git diff --check.  Build failure reported by Gentoo/Portage compile of src/nwconn.c.
2026-05-30 15:36:54 +02:00
OpenAI
51c04f148f nwconn: map AFP archive to NetWare attributes
All checks were successful
Source release / source-package (push) Successful in 57s
Route the AFP Set File Information Archive attribute through the existing NetWare attribute store instead of treating it as another mars_nwe AFP metadata xattr bit. The previous rename from Backup to Archive fixed the WebSDK naming, but the implementation still stored Archive together with Finder Invisible/System under org.mars-nwe.afp.attributes. That would duplicate NetWare's existing FILE_ATTR_A state and bypass the attribute path that already owns trustee Modify checks and volume attribute semantics.

Keep Finder Invisible and System as the narrow AFP metadata-only xattr bits for now, but strip Archive from nwatalk's xattr mask. AFP Get/Scan File Information now merges the AFP Archive bit from get_nw_attrib_dword(FILE_ATTR_A), while AFP Set File Information uses set_nw_attrib_word() for Archive set/clear. This reuses the existing nwattrib.c path, including TRUSTEE_M checks, instead of adding a new nwarchive.c flag. The org.mars-nwe.netware.archive xattr remains reserved for archive date/time/archiver metadata.

Tests: gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c; bash -n tests/linux/afp_smoke_suite.sh; git diff --check

TODO: verify the updated archive mapping with afp_smoke_suite.sh and confirm that Archive set/clear is reflected by AFP Get File Information while user.org.mars-nwe.afp.attributes remains limited to Invisible/System.
2026-05-30 15:31:56 +02:00
OpenAI
068afd5d8a nwconn: rename AFP backup attribute to archive
All checks were successful
Source release / source-package (push) Successful in 51s
The NWAFP Set File Information attribute word uses a metadata bit that our earlier smoke code called Backup.  That name is too easy to confuse with the distinct AFP backup date/time fields in the Set/Get File Information records.  Treat the bit consistently as the Archive attribute in the server constants, Netatalk/xattr helper mask, Linux smoke helper, smoke suite, and documentation.

Keep --backup and --clear-backup as compatibility aliases in afp_set_file_info_smoke so existing local invocations continue to work, but make the generated suite use --archive and --clear-archive.  The source-level xattr payload remains unchanged: org.mars-nwe.afp.attributes still stores the same versioned attribute word and bit value 0x0040.

Tests: git diff --check; bash -n tests/linux/afp_smoke_suite.sh; gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c
2026-05-30 14:47:32 +02:00
OpenAI
63f5fa699a nwconn: route AFP set file timestamps via NetWare helper
All checks were successful
Source release / source-package (push) Successful in 51s
Extend the conservative AFP Set File Information implementation to accept the file modification timestamp bitmap for path-backed file requests.  The WebSDK/NWAFP Set File Information payload carries the timestamp in the same bitmap-ordered parameter stream as file attributes and FinderInfo, so the parser now admits the documented modification timestamp field while continuing to reject every other Set File Information bitmap bit.

Do not implement a new AFP-specific timestamp backend.  After resolving the raw VOL:-style smoke path to the effective mars_nwe volume and Unix path, convert the AFP/NW DOS date+time fields to time_t and route the update through the existing nw_utime_node() helper.  That keeps trustee Modify-right checks and the established utime(2) fallback behavior shared with classic NetWare/NCP timestamp updates.

Keep the implementation deliberately file-only and path-backed.  Directory timestamps, create/access/backup timestamp fields, Entry-ID-only Set File Information, resource-fork semantics, DOS attribute mapping, Delete, Rename, Create, and Remove stay TODO so later patches can wire them to the existing NetWare helpers with focused smoke coverage.

Update afp_set_file_info_smoke with --mtime-epoch and --timestamp-only, verify the written AFP date/time via the follow-up Get File Information record, and extend afp_smoke_suite.sh to run the timestamp probe and record the backing Linux stat output.  The suite helper is already copied as a build target, so the new test is propagated into the build tree by the normal tests build.

Tests:

- git diff --check

- bash -n tests/linux/afp_smoke_suite.sh

- gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c
2026-05-30 14:29:24 +02:00
OpenAI
73d4a61a11 nwconn: route legacy AFP set file information
All checks were successful
Source release / source-package (push) Successful in 47s
Wire the older WebSDK/NWAFP Set File Information subfunction (0x09) through the same deliberately narrow metadata-write implementation as AFP 2.0 Set File Information (0x10).  Both subfunctions now accept the path-backed VOL:-style smoke subset and persist only FinderInfo plus the metadata-only Invisible/System/Backup AFP attribute bits through mars_nwe's org.mars-nwe.afp.* xattrs.

This keeps the implementation conservative: 0x09 does not add timestamp writes, DOS/NetWare mode-bit mapping, create/delete/rename behavior, fork-write semantics, or entry-id-only lookup.  It simply exposes the same already-tested FinderInfo/attribute payload semantics to clients that issue the legacy AFP Set File Information opcode.

Update the Linux smoke helper with --afp09/--afp20 selection and include the legacy FinderInfo probe in afp_smoke_suite.sh so future reports cover both write opcodes automatically.

Tests:

- bash -n tests/linux/afp_smoke_suite.sh

- gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c

- git diff --check
2026-05-30 13:14:22 +02:00
ChatGPT
cfd036e54c nwconn: persist additional AFP metadata attributes
All checks were successful
Source release / source-package (push) Successful in 49s
Extend the conservative AFP 2.0 Set File Information smoke path to accept the metadata-only System and Backup file attribute bits alongside the already-supported Finder Invisible bit.

The WebSDK/NWAFP Set File Information request uses the file Attributes bitmap to pass a set/clear attribute word. Netatalk stores several AFP file attributes in AppleDouble metadata while computing open-fork state dynamically and leaving enforcement-sensitive bits to the file/fork paths. Mirror only the low-risk mars_nwe subset here: persist Invisible, System, and Backup in the private org.mars-nwe.afp.attributes xattr, and keep NoWrite, NoRename, NoDelete, NoCopy, data-fork-open, resource-fork-open, timestamps, resource forks, and Entry-ID-only write semantics rejected until they have deliberate enforcement and backend design.

The xattr payload remains versioned and unchanged. Reads now expose the three supported metadata bits through Get/Scan File Information, and writes preserve the existing set/clear semantics over the supported mask.

Update the Linux Set File Information smoke helper with --system/--clear-system and --backup/--clear-backup options, while keeping the smoke-suite default unchanged. Document the expected Linux xattr forms 0x01000004 and 0x01000040 for those optional probes.

Tests: git diff --check; gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c.
2026-05-30 12:55:25 +02:00
OpenAI
c51fde95fe nwconn: persist AFP invisible file attributes
All checks were successful
Source release / source-package (push) Successful in 47s
Extend the conservative NCP 0x2222/35/16 AFP 2.0 Set File Information smoke path beyond FinderInfo-only writes by accepting the file Attributes bitmap for one deliberately narrow bit: Finder Invisible.

WebSDK and Netatalk FPSetFileParams semantics carry file attributes as bitmap bit 0, with ATTRBIT_SETCLR selecting set-vs-clear behavior. Mirror that model only for ATTRBIT_INVISIBLE and reject all other AFP attribute bits so DOS/NetWare mode bits, timestamp writes, resource forks, and broader file protection semantics are not implied accidentally.

Persist the mars_nwe-owned AFP attribute word in org.mars-nwe.afp.attributes via the local xattr abstraction. On Linux this maps to user.org.mars-nwe.afp.attributes, matching the org.mars-nwe.* source-level namespace while remaining portable on Linux xattr backends. Get File Information and Scan File Information now merge that stored Invisible bit into the existing 120-byte AFP file-info record.

Update the Linux Set File Information smoke helper with --invisible, --clear-invisible, --attributes-only, and --finder-info-only so FinderInfo and the narrow AFP attribute path can be tested independently or together.

Tests: git diff --check

Tests: gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c

TODO: keep all other AFP Set File Information bits rejected until their write-safe mapping to NetWare/DOS attributes, timestamps, CNID, and resource-fork metadata is designed.
2026-05-30 12:23:03 +02:00
OpenAI
4637f3ee57 nwatalk: cache AFP fallback entry ids in xattrs
All checks were successful
Source release / source-package (push) Successful in 48s
The AFP smoke endpoints can now read mars_nwe-owned entry ids from the versioned org.mars-nwe.afp.entry-id xattr, but a newly discovered file still had to fall back to the temporary stat-derived id on every request until a real CNID allocator exists.

Preserve the existing WebSDK/NWAFP response semantics while making that fallback sticky: when Get Entry ID, Get File Information, or Scan File Information has no mars_nwe xattr and no Netatalk/libatalk AppleDouble/CNID id, derive the existing compatibility id and cache it through nwatalk_set_entry_id().  The first request still logs fallback so diagnostics remain honest about the id origin; subsequent requests should read the xattr directly and avoid re-entering the stat fallback path.

Keep the write narrowly scoped to mars_nwe's private AFP metadata namespace.  The payload is versioned, big-endian, and stored through the nwxattr helper, so Linux persists it as user.org.mars-nwe.afp.entry-id while source-level code continues to use the Netatalk-style org.mars-nwe.afp.entry-id name.  This does not implement CNID allocation, parent-id lookup, entry-id-only resolution, FinderInfo mutation beyond the existing smoke path, or resource-fork semantics.

Tests:

- git diff --check

- cmake --build build-xattr-off --target nwconn with ENABLE_NETATALK_LIBATALK=OFF

- cmake --build build-xattr-on --target nwconn with ENABLE_NETATALK_LIBATALK=ON against Netatalk 4.4.3 headers plus local link stubs
2026-05-30 11:56:43 +02:00
OpenAI
b8016f99a3 nwarchive: scope private xattrs under NetWare namespace
All checks were successful
Source release / source-package (push) Successful in 48s
Move the mars_nwe NetWare-core archive/fileinfo xattr names from the flat org.mars-nwe namespace into an explicit org.mars-nwe.netware subnamespace.

The earlier xattr namespace cleanup intentionally removed the unreleased user.mars_nwe names and introduced Netatalk-style org.mars-nwe source-level keys.  Keeping archive and fileinfo at org.mars-nwe.archive and org.mars-nwe.fileinfo would make those NetWare server metadata records peers of AFP metadata instead of identifying their ownership.  The archive date/time/archiver and file create/creator/modifier records are NetWare-core file metadata, so place them under org.mars-nwe.netware.* while leaving AFP metadata under org.mars-nwe.afp.*.

No legacy fallback is added because the old names only existed in local test systems and have not been released.  The existing nwxattr wrapper still maps source-level org.mars-nwe.<domain>.* names to user.org.mars-nwe.<domain>.* on Linux, mirroring Netatalk's org.netatalk.* EA abstraction.

Tests: git diff --check

TODO: keep future nwbind/nwserv/AFP metadata in explicit org.mars-nwe.<domain>.* subnamespaces instead of adding new flat org.mars-nwe.* keys.
2026-05-30 11:41:43 +02:00
OpenAI
995a1e6cd7 nwconn: add AFP FinderInfo set smoke path
All checks were successful
Source release / source-package (push) Successful in 49s
Implement a deliberately narrow write-safe slice of the WebSDK/NWAFP Set File Information semantics for the NCP 0x2222/35/16 AFP 2.0 Set File Information call.

The only accepted request bitmap is the FinderInfo bit (0x0020). The handler uses the same path-backed raw VOL:-style compatibility subset as the existing AFP get, scan, open-fork, and temporary-directory-handle smoke endpoints, resolves the effective NetWare volume from the path prefix, rejects entry-id-only lookup until persistent CNID/base-ID mapping exists, and rejects directory or non-FinderInfo writes rather than pretending to implement DOS attribute, timestamp, delete-protect, resource-fork, or broader Mac namespace write semantics.

Store the 32-byte FinderInfo block in mars_nwe-owned metadata under the source-level xattr name org.mars-nwe.afp.finder-info and teach the existing AFP file-info response builder to read that value before falling back to Netatalk/libatalk AppleDouble FinderInfo. This makes the write immediately verifiable through AFP 2.0 Get File Information without changing data-fork or resource-fork contents.

Add a small local xattr abstraction for mars_nwe-private metadata names. Netatalk exposes names such as org.netatalk.Metadata at the libatalk layer, but prefixes them with user. on Linux inside its EA wrapper. Mirror that behavior for mars_nwe so source code and documentation use org.mars-nwe.* consistently while Linux stores user.org.mars-nwe.* where the kernel requires a namespace prefix. Convert the existing archive/fileinfo xattr calls to the same wrapper so the previous org.mars-nwe.* namespace rename remains functional on Linux.

Add tests/linux/afp_set_file_info_smoke, which sends AFP 0x10 with a FinderInfo bitmap, then verifies the result through AFP 0x0f Get File Information. Document the smoke command, expected output, server-log shape, and the remaining unsupported Set File Information write semantics.

Tests: git diff --check; gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_set_file_info_smoke.c; cmake --build build-off --target nwconn with ENABLE_NETATALK_LIBATALK=OFF; cmake --build build-on --target nwconn with ENABLE_NETATALK_LIBATALK=ON against Netatalk-4.4.3 headers and local link stubs.
2026-05-30 11:29:33 +02:00
ChatGPT
ca610c1100 nwatalk: probe mars_nwe AFP entry ids from xattrs
All checks were successful
Source release / source-package (push) Successful in 48s
Add the first mars_nwe-owned AFP metadata xattr reader before expanding the AFP write surface.  The new versioned org.mars-nwe.afp.entry-id payload gives the compatibility layer a stable, project-owned namespace for persistent AFP entry ids without reusing the unreleased user.mars_nwe.* test names or pretending that Netatalk-owned org.netatalk.* keys are ours to mutate.

The lookup order remains conservative: an existing mars_nwe entry-id xattr wins, then the optional Netatalk/libatalk AppleDouble/CNID helper is consulted, and the AFP handlers continue to fall back to their stat-derived temporary id when no persistent metadata exists.  No Set File Information, CNID allocation, Finder Info write, or resource-fork write path is introduced here.

This keeps the WebSDK/NWAFP read-only endpoint semantics intact while preparing the metadata storage boundary needed by later AFP Set File Information and CNID work.  ENABLE_NETATALK_LIBATALK=OFF still rejects AFP calls at the handler guard, and the xattr reader has an XATTR_SUPPORT-disabled stub so non-xattr builds keep compiling.

Tests:

- git diff --check

- cmake --build build-xattr-off --target nwconn

- cmake -S . -B build-afp-on -DENABLE_NETATALK_LIBATALK=ON -DCMAKE_PREFIX_PATH=/mnt/data/afp_build_prefix

- cmake --build build-afp-on --target nwconn

TODO:

- Add a deliberate write-safe AFP metadata writer/allocator before enabling AFP 2.0 Set File Information.

- Decide whether future mars_nwe AFP metadata stays split across org.mars-nwe.afp.* keys or moves into a compact org.mars-nwe.afp.metadata record.
2026-05-30 11:11:15 +02:00
ChatGPT
a586e52b25 nwarchive: move private xattrs to org namespace
All checks were successful
Source release / source-package (push) Successful in 49s
Rename the unreleased mars_nwe private archive and file-info extended-attribute keys from the Linux user.mars_nwe.* spelling to the Netatalk-style org.mars-nwe.* namespace.

This keeps the mars_nwe metadata namespace aligned with the AFP/libatalk backend direction, where Netatalk owns org.netatalk.* keys and mars_nwe-owned metadata should live under org.mars-nwe.* instead of looking like ordinary user application attributes.

No legacy read fallback is added because the user.mars_nwe.* names have only existed in local test builds and have not shipped in a release. New writes therefore use only org.mars-nwe.archive and org.mars-nwe.fileinfo, avoiding migration complexity before AFP metadata persistence is introduced.

Document the namespace decision in TODO.md so future AFP xattr work can build on org.mars-nwe.afp.* or a compact org.mars-nwe.afp.metadata record rather than adding new user.mars_nwe.* keys.

Tests: cmake --build build-xattr-off --target nwserv; cmake --build build-xattr-off --target all reaches the existing missing gdbm.h dependency while nwconn has already been built in this tree.
2026-05-30 11:04:03 +02:00
Mario Fetka
8e739a1ac2 nwconn: route AFP scan file information
All checks were successful
Source release / source-package (push) Successful in 49s
Add the older WebSDK/NWAFP AFP Scan File Information subfunction 0x0a to the AFP dispatcher and route it through the existing conservative directory-scan implementation used by AFP 2.0 Scan File Information 0x11.

The Micro Focus NCP documentation describes both scan variants as read-only directory/file information scans with a Mac base Entry ID, Mac last-seen ID, DesiredResponseCount, SearchBitMap, RequestBitMap, and path modifier.  The mars_nwe compatibility subset still requires a raw path-backed VOL:-style request because persistent CNID/base-ID lookup is not available yet, but accepting 0x0a lets older AFP callers probe the same read-only semantics instead of receiving Invalid Namespace for an otherwise implemented scan shape.

Teach the scan parser to accept the documented DesiredResponseCount word while keeping compatibility with the earlier compact smoke-test layout that omitted it.  For now DesiredResponseCount is logged and constrained by the smoke helper, while the server still returns one conservative file-info record plus the next-last-seen entry id per request.  This avoids pretending to implement full multi-response AFP directory scans before CNID-backed ordering, response-count batching, and AppleDouble metadata are available.

Extend afp_scan_info_smoke with --afp10/--afp20 selection and a documented --desired-count argument.  The helper now sends the WebSDK-style request layout by default, uses 0x11 unless --afp10 is requested, and keeps the existing next_last_seen output used for iterative Linux smoke tests.

Tests:

- git diff --check

- gcc -fsyntax-only tests/linux/afp_scan_info_smoke.c with local ncpfs header stubs

- cmake --build build-off --target nwconn with ENABLE_NETATALK_LIBATALK=OFF

- cmake --build build-on --target nwconn with ENABLE_NETATALK_LIBATALK=ON against Netatalk 4.4.3 headers and local link stubs

TODO:

- Implement persistent CNID/base-ID lookup so entry-id-only scans can work without a raw path.

- Replace the one-record smoke response with true DesiredResponseCount batching once stable CNID ordering and full AFP scan filtering are available.

- Fill richer AppleDouble/Finder/ProDOS/resource-fork metadata when the libatalk backend grows write-safe metadata support.
2026-05-30 10:39:02 +02:00
OpenAI
00060e0e93 nwconn: resolve AFP smoke path volumes
All checks were successful
Source release / source-package (push) Successful in 47s
Resolve the effective NetWare volume for path-backed AFP compatibility requests from the raw VOL: path prefix before opening data forks or allocating temporary directory handles.

The WebSDK/nwafp.h request layouts for AFP 0x08 Open File Fork and AFP 0x0b Alloc Temporary Directory Handle both carry a volume byte plus base AFP Entry ID.  The current mars_nwe smoke subset deliberately keeps Entry-ID-relative lookup disabled, but it accepts raw NetWare-style paths such as SYS:PUBLIC and HOME:LOGIN.  In that path-backed mode, treating dir_handle 0 as volume 0 in diagnostics is too narrow: build_path() already extracts the real volume from the VOL: prefix, and the lower NetWare open/dir-handle helpers use that same resolver internally.

Add a small AFP path-volume resolver wrapper around conn_get_kpl_unxname() and use it in the 0x08 and 0x0b handlers before delegating to nw_creat_open_file() or nw_alloc_dir_handle().  Successful diagnostics now report the resolved effective volume and keep the incoming request volume separately as request_vol, which preserves the header-level request shape without implying that non-SYS paths are opened on volume 0.

This does not add CNID/base-ID lookup, resource-fork handling, or write semantics.  Entry-ID-only requests remain Invalid Path until persistent AFP identity mapping is implemented.  The optional Netatalk/libatalk backend guard remains unchanged; ENABLE_NETATALK_LIBATALK=OFF still rejects these AFP calls with Invalid Namespace before any path-backed work is attempted.

Tests:

- git diff --check

- cmake --build build-off --target nwconn with ENABLE_NETATALK_LIBATALK=OFF

- cmake --build build-on --target nwconn with ENABLE_NETATALK_LIBATALK=ON requested; local tree reports backend disabled because libatalk headers/library are not installed

TODO:

- Runtime-smoke a non-SYS volume such as HOME: to confirm the diagnostic shows the resolved non-zero volume id.

- Replace path-backed smoke lookup with persistent CNID/base-ID lookup when the AFP metadata backend grows that support.
2026-05-30 10:19:18 +02:00
Mario Fetka
db9283a410 nwconn: implement AFP open file fork smoke path
All checks were successful
Source release / source-package (push) Successful in 46s
Implement the WebSDK/nwafp.h NCP 0x2222/35 AFP subfunction 0x08, Open File Fork, for the same conservative path-backed subset that the current AFP smoke endpoints use.

The request is decoded as volume number, AFP Entry ID, fork selector, access mode, path length, and AFP path.  Until persistent CNID/base-ID lookup exists, empty path / Entry-ID-only opens continue to fail with Invalid Path rather than pretending that the temporary stat-derived AFP Entry IDs are a durable namespace.  The handler also keeps resource forks and write access negative for now, because those require AppleDouble/resource-fork and write-safe Finder metadata semantics that are not implemented yet.

For the supported data-fork read-only case, delegate to the existing NetWare open-file path via nw_creat_open_file().  The reply returns the normal six-byte NetWare file handle shape used by the AFP handle APIs followed by the current data-fork length.  That lets follow-up smoke tests verify handle interoperability with AFP Get Entry ID From NetWare Handle and with the ordinary NetWare close path while keeping write/resource semantics conservative.

Add afp_open_file_fork_smoke so Linux ncpfs/libncp tests can exercise the endpoint through the same requester path as the other AFP probes.  The helper closes the returned handle in the same connection and documents the expected data-fork-only coverage in tests/linux/README.md and TODO.md.

Tests: git diff --check

Tests: cmake --build build-off --target nwconn with ENABLE_NETATALK_LIBATALK=OFF

Tests: cmake --build build-on --target nwconn with ENABLE_NETATALK_LIBATALK=ON requested; local environment lacks libatalk headers/library so CMake reports the metadata backend disabled, but the target still builds and the new handler has no direct libatalk symbol references

Tests: gcc -fsyntax-only tests/linux/afp_open_file_fork_smoke.c with local ncpfs header stubs

TODO: add persistent CNID/base-ID lookup, AppleDouble/resource-fork open support, and write-safe AFP fork semantics before accepting resource-fork or write-mode opens.
2026-05-30 10:04:26 +02:00
OpenAI
f6bda83f67 tests: record AFP temporary directory handle smoke results
All checks were successful
Source release / source-package (push) Successful in 47s
Record the runtime Linux smoke coverage for the WebSDK/NWAFP NCP 0x2222/35/11 AFP Alloc Temporary Directory Handle request.

The implementation already returned the AFP reply as a temporary NetWare directory handle plus the one-byte AFP access-rights field. The real server diagnostic, however, logs the wider internal NetWare effective-rights mask from nw_alloc_dir_handle(), which can report 0x1ff for a privileged directory while the client-visible AFP field prints as 0xff. Document that distinction so the README matches the tested server log instead of implying a logging or protocol mismatch.

Also widen the diagnostic printf field width to 0x%03x to make the 9-bit NetWare rights mask intentional in future logs. This is only a diagnostic formatting change; the wire reply remains the AFP byte-sized rights field used by the smoke helper.

Tests:

- Runtime smoke reported green for SYS:, SYS:PUBLIC, SYS:SYSTEM, and SYS:BURST

- git diff --check

TODO:

- Entry-ID-only temporary handle allocation still waits for persistent CNID/base-ID lookup.
2026-05-30 09:50:48 +02:00
Mario Fetka
162ff2b10f nwconn: implement AFP temporary directory handles
All checks were successful
Source release / source-package (push) Successful in 49s
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.
2026-05-30 09:27:51 +02:00
Mario Fetka
a10f256b77 nwconn: implement AFP entry id from NetWare handle
All checks were successful
Source release / source-package (push) Successful in 49s
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.
2026-05-30 09:08:25 +02:00
Mario Fetka
3f2493ef25 nwconn: implement AFP Get Entry ID From Name
All checks were successful
Source release / source-package (push) Successful in 45s
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.
2026-05-30 08:42:17 +02:00
Mario Fetka
800c7a6f26 nwconn: implement AFP scan file information
All checks were successful
Source release / source-package (push) Successful in 52s
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.
2026-05-30 08:26:35 +02:00
Mario Fetka
8e885bb16d nwconn: implement AFP 2.0 Get File Information
All checks were successful
Source release / source-package (push) Successful in 46s
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.
2026-05-30 08:05:46 +02:00
Mario Fetka
03a5d69dc4 nwconn: implement AFP Get File Information
All checks were successful
Source release / source-package (push) Successful in 48s
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.
2026-05-30 03:59:50 +02:00
Mario Fetka
069bbba88c tests: resolve AFP smoke volume paths
All checks were successful
Source release / source-package (push) Successful in 47s
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.
2026-05-30 02:42:08 +02:00