From 04e098efef73944a7359e1b58dd6443d088166d0 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sat, 30 May 2026 01:30:59 +0000 Subject: [PATCH] tests: require login for AFP smoke test 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. --- tests/linux/afp_entry_id_smoke.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/linux/afp_entry_id_smoke.c b/tests/linux/afp_entry_id_smoke.c index 1ba5512..405ba78 100644 --- a/tests/linux/afp_entry_id_smoke.c +++ b/tests/linux/afp_entry_id_smoke.c @@ -177,9 +177,17 @@ int main(int argc, char **argv) return 2; } - conn = ncp_initialize(&argc, argv, 0, &init_err); + /* + * The smoke test needs normal file-service path access before it can send + * AFP 0x0c: it has to allocate/use a directory handle for the supplied + * VOL:PATH. ncp_initialize(..., 0, ...) intentionally clears the user + * name even if -U/-P were supplied, so mars_nwe treats the connection as + * unauthenticated and rejects non-login paths before the AFP request is + * reached. Require a login here; no-password users can still use -n. + */ + conn = ncp_initialize(&argc, argv, 1, &init_err); if (!conn) { - fprintf(stderr, "ncp_initialize failed: %ld\n", init_err); + fprintf(stderr, "ncp_initialize/login failed: %ld\n", init_err); usage(argv[0]); return 2; }