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
This commit is contained in:
OpenAI
2026-05-30 12:26:21 +00:00
committed by Mario Fetka
parent 6bcf93fc5d
commit 63f5fa699a
5 changed files with 176 additions and 25 deletions

View File

@@ -489,13 +489,14 @@ NCP 0x2222/35/16 AFP 2.0 Set File Information
```
The helper exercises two deliberately narrow write-safe AFP metadata subsets:
the file FinderInfo bitmap (`0x0020`) and the file Attributes bitmap (`0x0001`)
restricted to metadata-only file flags: Finder Invisible, System, and Backup.
It sends path-backed raw `VOL:`-style requests, writes the 32-byte FinderInfo
block to mars_nwe's private
`org.mars-nwe.afp.finder-info` metadata key, writes the narrow AFP attribute word
to `org.mars-nwe.afp.attributes`, and immediately verifies the updates through
AFP 2.0 Get File Information. On Linux the source-level `org.mars-nwe.afp.*` name is stored via the
the file FinderInfo bitmap (`0x0020`), the file Attributes bitmap (`0x0001`)
restricted to metadata-only file flags: Finder Invisible, System, and Backup,
and the file modification timestamp bitmap (`0x0010`). It sends path-backed
raw `VOL:`-style requests, writes the 32-byte FinderInfo block to mars_nwe's
private `org.mars-nwe.afp.finder-info` metadata key, writes the narrow AFP
attribute word to `org.mars-nwe.afp.attributes`, routes modification timestamp
writes through the existing NetWare timestamp helper, and immediately verifies
the updates through AFP 2.0 Get File Information. On Linux the source-level `org.mars-nwe.afp.*` name is stored via the
portable `user.` xattr namespace by mars_nwe's local xattr wrapper, the same
pattern Netatalk uses for its `org.netatalk.*` metadata names.
@@ -614,15 +615,36 @@ AFP 2.0 Set File Information: vol=0 request_vol=0 entry=0x00000000 mask=0x0001 p
AFP 2.0 Set File Information: vol=0 request_vol=0 entry=0x00000000 mask=0x0001 path='SYS:PUBLIC/pmdflts.ini' attributes attrs=0x0004
AFP 2.0 Set File Information: vol=0 request_vol=0 entry=0x00000000 mask=0x0001 path='SYS:PUBLIC/pmdflts.ini' attributes attrs=0x8040
```
Modification timestamp writes are deliberately routed through the existing
NetWare `nw_utime_node()` path so trustee Modify rights and the established
`utime(2)` fallback behavior stay shared with classic NCP timestamp updates.
The first timestamp smoke uses a fixed Unix epoch that the helper converts into
the AFP/NW DOS date+time fields and verifies through the follow-up Get File
Information response:
```sh
./tests/linux/afp_set_file_info_smoke \
-S MARS -U SUPERVISOR -P secret \
--timestamp-only --mtime-epoch 1700000000 \
SYS:PUBLIC/pmdflts.ini
stat -c 'mtime_epoch=%Y mtime=%y' /var/mars_nwe/SYS/public/pmdflts.ini
```
This currently remains file-only and path-backed, just like the FinderInfo and
metadata-attribute Set File Information probes; directory timestamps and
Entry-ID-only Set File Information are left for later resolver work.
The legacy `0x09` endpoint is deliberately routed through the same narrow
metadata-only implementation as AFP 2.0 `0x10`; it does not add create, rename,
delete, timestamp, or fork-write semantics.
implementation as AFP 2.0 `0x10`; it does not add create, rename, delete,
directory timestamp, or fork-write semantics.
All other Set File Information bitmap bits and AFP attribute bits, including
NoWrite, NoRename, NoDelete, NoCopy, and the computed data/resource-fork-open
flags, are intentionally rejected for now. That keeps timestamp,
DOS/NetWare mode-bit mapping, enforcement, resource-fork, and Entry-ID-only
write semantics out of this metadata-only smoke path.
flags, are intentionally rejected for now. That keeps create/access/backup
timestamps, DOS/NetWare mode-bit mapping, enforcement, resource-fork, and
Entry-ID-only write semantics out of this conservative smoke path.
If the server was built without the optional Netatalk/libatalk backend, use
`--allow-invalid-namespace` for the expected negative test. Use