From 797ad53addd892464a3f108df1a3744d514495bf Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 29 May 2026 18:48:51 +0200 Subject: [PATCH] nwbind: return proper console privilege status Replace the old Check Console Privileges TODO with the documented NCP 23/200 behavior. The call has no reply data and reports authorization solely through the completion code. Return success for supervisor-equivalent connections and 0xc6 for callers without console operator privileges instead of accepting all callers. MARS-NWE does not currently maintain a separate console-operator list, so map console privileges to the existing supervisor-equivalence flag computed at login time. No queue or file service behavior change. --- src/nwbind.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/nwbind.c b/src/nwbind.c index 28ea7ef..22be1fc 100644 --- a/src/nwbind.c +++ b/src/nwbind.c @@ -463,6 +463,18 @@ static void get_login_time(uint8 login_time[], CONNECTION *cx) login_time[6] = s_tm->tm_wday; } + +static int has_console_privileges(CONNECTION *c) +/* + * NCP 23/200 only tells the client whether the current connection has + * console operator privileges. MARS-NWE does not currently maintain a + * separate bindery/NDS console-operator list, so map this to the same + * supervisor-equivalence flag that is already computed at login time. + */ +{ + return(c && c->object_id && (c->id_flags & 1)); +} + static int build_login_response(uint8 *responsedata, uint32 obj_id) { uint8 pw_name[40]; @@ -1820,13 +1832,20 @@ static void handle_fxx(int gelen, int func) } }break; - case 0xc8 : { /* CHECK CONSOLE PRIVILEGES */ - /* to use fileserver service functions */ - XDPRINTF((1, 0, "MAKE BETTER: CHECK CONSOLE PRIV (M@K)")); - /* !!!!!! TODO completition=0xc6 (no rights) */ - if (!(act_c->id_flags&1)) - completition=0; /* no rights (M@K) */ -// completition=0xc6; /* no rights */ + case 0xc8 : { /* Check Console Privileges */ + /* + * NCP 23/200 has no reply data. It succeeds when the + * connection has console operator privileges and returns + * 0xc6 (No Console Rights) otherwise. + */ + if (has_console_privileges(act_c)) { + XDPRINTF((2, 0, "Check Console Privileges user=0x%x result=0x0", + act_c->object_id)); + } else { + XDPRINTF((1, 0, "Check Console Privileges user=0x%x result=0xc6", + act_c ? act_c->object_id : 0)); + completition=0xc6; + } } break; case 0xc9 : { /* GET FILE SERVER DESCRIPTION STRINGs */