mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 08:53:01 -05:00
dll: posix: map unmapped UID to S-1-5-7 (Anonymous)
This commit is contained in:
parent
37b6936ad0
commit
7e8d9fb986
@ -40,18 +40,18 @@ union
|
|||||||
{
|
{
|
||||||
SID V;
|
SID V;
|
||||||
UINT8 B[sizeof(SID) - sizeof(DWORD) + (1 * sizeof(DWORD))];
|
UINT8 B[sizeof(SID) - sizeof(DWORD) + (1 * sizeof(DWORD))];
|
||||||
} FspNullSidBuf =
|
} FspUnmappedSidBuf =
|
||||||
{
|
{
|
||||||
/* S-1-0-0 */
|
/* S-1-5-7 (Anonymous) */
|
||||||
.V.Revision = SID_REVISION,
|
.V.Revision = SID_REVISION,
|
||||||
.V.SubAuthorityCount = 1,
|
.V.SubAuthorityCount = 1,
|
||||||
.V.IdentifierAuthority.Value[5] = 0,
|
.V.IdentifierAuthority.Value[5] = 5,
|
||||||
.V.SubAuthority[0] = 0,
|
.V.SubAuthority[0] = 7,
|
||||||
};
|
};
|
||||||
static PISID FspAccountDomainSid, FspPrimaryDomainSid;
|
static PISID FspAccountDomainSid, FspPrimaryDomainSid;
|
||||||
|
|
||||||
#define FspNullSid (&FspNullSidBuf.V)
|
#define FspUnmappedSid (&FspUnmappedSidBuf.V)
|
||||||
#define FspNullUid -1
|
#define FspUnmappedUid (7)
|
||||||
|
|
||||||
static BOOL WINAPI FspPosixInitialize(
|
static BOOL WINAPI FspPosixInitialize(
|
||||||
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
|
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
|
||||||
@ -227,7 +227,7 @@ FSP_API NTSTATUS FspPosixMapUidToSid(UINT32 Uid, PSID *PSid)
|
|||||||
*PSid = FspPosixCreateSid(5, 2, Uid >> 12, Uid & 0xfff);
|
*PSid = FspPosixCreateSid(5, 2, Uid >> 12, Uid & 0xfff);
|
||||||
|
|
||||||
if (0 == *PSid)
|
if (0 == *PSid)
|
||||||
*PSid = FspNullSid;
|
*PSid = FspUnmappedSid;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ FSP_API NTSTATUS FspPosixMapSidToUid(PSID Sid, PUINT32 PUid)
|
|||||||
*/
|
*/
|
||||||
*PUid = 0x60000 + Rid;
|
*PUid = 0x60000 + Rid;
|
||||||
}
|
}
|
||||||
else if (0 != Authority)
|
else
|
||||||
{
|
{
|
||||||
/* [IDMAP]
|
/* [IDMAP]
|
||||||
* Other well-known SIDs:
|
* Other well-known SIDs:
|
||||||
@ -335,7 +335,7 @@ FSP_API NTSTATUS FspPosixMapSidToUid(PSID Sid, PUINT32 PUid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (-1 == *PUid)
|
if (-1 == *PUid)
|
||||||
*PUid = FspNullUid;
|
*PUid = FspUnmappedUid;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ static PISID FspPosixCreateSid(BYTE Authority, ULONG Count, ...)
|
|||||||
|
|
||||||
FSP_API VOID FspDeleteSid(PSID Sid, NTSTATUS (*CreateFunc)())
|
FSP_API VOID FspDeleteSid(PSID Sid, NTSTATUS (*CreateFunc)())
|
||||||
{
|
{
|
||||||
if (FspNullSid == Sid)
|
if (FspUnmappedSid == Sid)
|
||||||
;
|
;
|
||||||
else if ((NTSTATUS (*)())FspPosixMapUidToSid == CreateFunc)
|
else if ((NTSTATUS (*)())FspPosixMapUidToSid == CreateFunc)
|
||||||
MemFree(Sid);
|
MemFree(Sid);
|
||||||
|
@ -10,7 +10,7 @@ void posix_map_sid_test(void)
|
|||||||
UINT32 Uid;
|
UINT32 Uid;
|
||||||
} map[] =
|
} map[] =
|
||||||
{
|
{
|
||||||
{ L"S-1-0-0", -1 },
|
{ L"S-1-0-0", 0x10000 },
|
||||||
{ L"S-1-1-0", 0x10100 },
|
{ L"S-1-1-0", 0x10100 },
|
||||||
{ L"S-1-2-0", 0x10200 },
|
{ L"S-1-2-0", 0x10200 },
|
||||||
{ L"S-1-2-1", 0x10201 },
|
{ L"S-1-2-1", 0x10201 },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user