nwconn: preserve Supervisor right in NCP22 conversions
All checks were successful
Source release / source-package (push) Successful in 47s

Keep the Supervisor trustee bit when converting rights between the
internal v3 representation and the NCP22 wire format.

Mars calculated effective rights with the Supervisor bit set, for
example 0x01ff, but the NCP22 conversion collapsed the result to
0x00ff before returning it to DOS clients. As a result Novell RIGHTS
showed only:

  [ RWCEMFA]

instead of the expected:

  [SRWCEMFA]

Map the old Open right to bit 0x0004 and keep Supervisor on bit 0x0100
in both conversion directions so NCP22/3 and NCP22/42 preserve the full
effective rights mask.
This commit is contained in:
Mario Fetka
2026-05-27 15:39:18 +02:00
parent 3fbd29adb9
commit 7d96d0b253

View File

@@ -82,22 +82,23 @@ static int trustee_v3_to_ncp22_rights(int rights)
int ncp22 = 0;
/*
* NCP22 trustee/access masks use the classic Novell order used by
* NPUBLIC\GRANT/RIGHTS:
* R=0x0001 W=0x0002 S=0x0004 C=0x0008
* E=0x0010 A=0x0020 F=0x0040 M=0x0080
* NetWare trustee/access masks use bit 0x0100 for Supervisor.
* Bit 0x0004 is the old Open right, not Supervisor.
*
* MARS internal masks use the same A/F/M bit positions, except that
* Supervisor is kept at 0x0100 internally.
* MARS keeps the same bit positions internally, including TRUSTEE_O
* at 0x0004. Do not translate TRUSTEE_S down to 0x0004 here; doing
* so makes clients see Open instead of Supervisor and RIGHTS prints
* [ RWCEMFA] instead of [SRWCEMFA].
*/
if (rights & TRUSTEE_R) ncp22 |= 0x0001; /* Read */
if (rights & TRUSTEE_W) ncp22 |= 0x0002; /* Write */
if (rights & TRUSTEE_S) ncp22 |= 0x0004; /* Supervisor */
if (rights & TRUSTEE_O) ncp22 |= 0x0004; /* Open */
if (rights & TRUSTEE_C) ncp22 |= 0x0008; /* Create */
if (rights & TRUSTEE_E) ncp22 |= 0x0010; /* Erase */
if (rights & TRUSTEE_A) ncp22 |= 0x0020; /* Access Control */
if (rights & TRUSTEE_F) ncp22 |= 0x0040; /* File Scan */
if (rights & TRUSTEE_M) ncp22 |= 0x0080; /* Modify */
if (rights & TRUSTEE_S) ncp22 |= 0x0100; /* Supervisor */
return(ncp22);
}
@@ -108,12 +109,13 @@ static int trustee_ncp22_to_v3_rights(int ncp22)
if (ncp22 & 0x0001) rights |= TRUSTEE_R; /* Read */
if (ncp22 & 0x0002) rights |= TRUSTEE_W; /* Write */
if (ncp22 & 0x0004) rights |= TRUSTEE_S; /* Supervisor */
if (ncp22 & 0x0004) rights |= TRUSTEE_O; /* Open */
if (ncp22 & 0x0008) rights |= TRUSTEE_C; /* Create */
if (ncp22 & 0x0010) rights |= TRUSTEE_E; /* Erase */
if (ncp22 & 0x0020) rights |= TRUSTEE_A; /* Access Control */
if (ncp22 & 0x0040) rights |= TRUSTEE_F; /* File Scan */
if (ncp22 & 0x0080) rights |= TRUSTEE_M; /* Modify */
if (ncp22 & 0x0100) rights |= TRUSTEE_S; /* Supervisor */
return(rights);
}