Fix NCP22 trustee rights mapping for Modify
All checks were successful
Source release / source-package (push) Successful in 40s

NCP22 uses bit 0x80 for Modify. MARS internally uses the same bit for
TRUSTEE_M, while Supervisor is represented internally as TRUSTEE_S at 0x100.
Only the Supervisor/Open bit needs translation.

The previous conversion mapped NCP22 0x80 incorrectly, causing GRANT M from
Novell tools to be stored without TRUSTEE_M internally. As a result, users with
directory Modify rights could not rename files even though NDIR/RIGHTS displayed
the rights as expected.
This commit is contained in:
Mario Fetka
2026-05-26 15:24:04 +02:00
parent 2bc211cd4a
commit 48624d2776

View File

@@ -82,20 +82,22 @@ static int trustee_v3_to_ncp22_rights(int rights)
int ncp22 = 0;
/*
* NCP22 trustee/access masks use the classic Novell order observed
* with NPUBLIC\GRANT/RIGHTS:
* NCP22 trustee/access masks use the classic Novell order used by
* NPUBLIC\GRANT/RIGHTS:
* R=0x0001 W=0x0002 S=0x0004 C=0x0008
* E=0x0010 M=0x0020 F=0x0040 A=0x0080
* MARS internally keeps S at 0x0100 and A/M swapped relative to NCP22.
* E=0x0010 A=0x0020 F=0x0040 M=0x0080
*
* MARS internal masks use the same A/F/M bit positions, except that
* Supervisor is kept at 0x0100 internally.
*/
if (rights & TRUSTEE_R) ncp22 |= 0x0001; /* Read */
if (rights & TRUSTEE_W) ncp22 |= 0x0002; /* Write */
if (rights & TRUSTEE_S) ncp22 |= 0x0004; /* Supervisor */
if (rights & TRUSTEE_C) ncp22 |= 0x0008; /* Create */
if (rights & TRUSTEE_E) ncp22 |= 0x0010; /* Erase */
if (rights & TRUSTEE_M) ncp22 |= 0x0020; /* Modify */
if (rights & TRUSTEE_A) ncp22 |= 0x0020; /* Access Control */
if (rights & TRUSTEE_F) ncp22 |= 0x0040; /* File Scan */
if (rights & TRUSTEE_A) ncp22 |= 0x0080; /* Access Control */
if (rights & TRUSTEE_M) ncp22 |= 0x0080; /* Modify */
return(ncp22);
}
@@ -109,9 +111,9 @@ static int trustee_ncp22_to_v3_rights(int ncp22)
if (ncp22 & 0x0004) rights |= TRUSTEE_S; /* Supervisor */
if (ncp22 & 0x0008) rights |= TRUSTEE_C; /* Create */
if (ncp22 & 0x0010) rights |= TRUSTEE_E; /* Erase */
if (ncp22 & 0x0020) rights |= TRUSTEE_M; /* Modify */
if (ncp22 & 0x0020) rights |= TRUSTEE_A; /* Access Control */
if (ncp22 & 0x0040) rights |= TRUSTEE_F; /* File Scan */
if (ncp22 & 0x0080) rights |= TRUSTEE_A; /* Access Control */
if (ncp22 & 0x0080) rights |= TRUSTEE_M; /* Modify */
return(rights);
}