diff options
| -rw-r--r-- | win32/mingw.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 06da37040..f34ea1102 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
| @@ -488,9 +488,14 @@ static uid_t file_owner(HANDLE fh) | |||
| 488 | uid_t uid = 0; | 488 | uid_t uid = 0; |
| 489 | DWORD *ptr; | 489 | DWORD *ptr; |
| 490 | unsigned char prefix[] = { | 490 | unsigned char prefix[] = { |
| 491 | 0x01, 0x05, 0x00, 0x00, | 491 | 0x01, 0x05, 0x00, 0x00, |
| 492 | 0x00, 0x00, 0x00, 0x05, | 492 | 0x00, 0x00, 0x00, 0x05, |
| 493 | 0x15, 0x00, 0x00, 0x00 | 493 | 0x15, 0x00, 0x00, 0x00 |
| 494 | }; | ||
| 495 | unsigned char nullsid[] = { | ||
| 496 | 0x01, 0x01, 0x00, 0x00, | ||
| 497 | 0x00, 0x00, 0x00, 0x01, | ||
| 498 | 0x00, 0x00, 0x00, 0x00 | ||
| 494 | }; | 499 | }; |
| 495 | 500 | ||
| 496 | /* get SID of current user */ | 501 | /* get SID of current user */ |
| @@ -520,8 +525,9 @@ static uid_t file_owner(HANDLE fh) | |||
| 520 | 525 | ||
| 521 | if (EqualSid(pSidOwner, user->User.Sid)) { | 526 | if (EqualSid(pSidOwner, user->User.Sid)) { |
| 522 | uid = DEFAULT_UID; | 527 | uid = DEFAULT_UID; |
| 523 | } | 528 | } else if (memcmp(pSidOwner, nullsid, sizeof(nullsid)) == 0) { |
| 524 | else if (memcmp(pSidOwner, prefix, sizeof(prefix)) == 0) { | 529 | uid = DEFAULT_UID; |
| 530 | } else if (memcmp(pSidOwner, prefix, sizeof(prefix)) == 0) { | ||
| 525 | /* for local or domain users use the RID as uid */ | 531 | /* for local or domain users use the RID as uid */ |
| 526 | ptr = (DWORD *)pSidOwner; | 532 | ptr = (DWORD *)pSidOwner; |
| 527 | if (ptr[6] >= 500 && ptr[6] < DEFAULT_UID) | 533 | if (ptr[6] >= 500 && ptr[6] < DEFAULT_UID) |
