Changeset 70734 in vbox for trunk/src/VBox/Additions/WINNT/SharedFolders
- Timestamp:
- Jan 25, 2018 9:13:05 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120490
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.c
r69500 r70734 1480 1480 } 1481 1481 1482 static NTSTATUS vbsfQuerySdInfo(PVOID pvBuffer, ULONG cbBuffer, SECURITY_INFORMATION SecurityInformation, ULONG *pcbOut) 1483 { 1484 /* What a public SMB share would return. */ 1485 static SID_IDENTIFIER_AUTHORITY sIA = SECURITY_NT_AUTHORITY; 1486 #define SUB_AUTHORITY_COUNT 2 1487 static const ULONG saSubAuthorityOwner[] = { SECURITY_NT_NON_UNIQUE, DOMAIN_USER_RID_GUEST }; 1488 static const ULONG saSubAuthorityGroup[] = { SECURITY_NT_NON_UNIQUE, DOMAIN_GROUP_RID_GUESTS }; 1489 1490 SECURITY_DESCRIPTOR_RELATIVE *pSD = (SECURITY_DESCRIPTOR_RELATIVE *)pvBuffer; 1491 ULONG cbSD = 0; /* Size of returned security descriptor. */ 1492 ULONG cbAdd; /* How many bytes to add to the buffer for each component of the security descriptor. */ 1493 1494 cbAdd = sizeof(SECURITY_DESCRIPTOR_RELATIVE); 1495 if (cbSD + cbAdd <= cbBuffer) 1496 { 1497 pSD->Revision = SECURITY_DESCRIPTOR_REVISION1; 1498 pSD->Sbz1 = 0; 1499 pSD->Control = SE_SELF_RELATIVE; 1500 pSD->Owner = 0; 1501 pSD->Group = 0; 1502 pSD->Sacl = 0; 1503 pSD->Dacl = 0; 1504 } 1505 cbSD += cbAdd; 1506 1507 if (SecurityInformation & OWNER_SECURITY_INFORMATION) 1508 { 1509 cbAdd = RT_UOFFSETOF(SID, SubAuthority) + SUB_AUTHORITY_COUNT * sizeof(ULONG); 1510 if (cbSD + cbAdd <= cbBuffer) 1511 { 1512 SID *pSID = (SID *)((uint8_t *)pSD + cbSD); 1513 pSID->Revision = 1; 1514 pSID->SubAuthorityCount = SUB_AUTHORITY_COUNT; 1515 pSID->IdentifierAuthority = sIA; 1516 memcpy(pSID->SubAuthority, saSubAuthorityOwner, SUB_AUTHORITY_COUNT * sizeof(ULONG)); 1517 1518 pSD->Owner = cbSD; 1519 } 1520 cbSD += cbAdd; 1521 } 1522 1523 if (SecurityInformation & GROUP_SECURITY_INFORMATION) 1524 { 1525 cbAdd = RT_UOFFSETOF(SID, SubAuthority) + SUB_AUTHORITY_COUNT * sizeof(ULONG); 1526 if (cbSD + cbAdd <= cbBuffer) 1527 { 1528 SID *pSID = (SID *)((uint8_t *)pSD + cbSD); 1529 pSID->Revision = 1; 1530 pSID->SubAuthorityCount = SUB_AUTHORITY_COUNT; 1531 pSID->IdentifierAuthority = sIA; 1532 memcpy(pSID->SubAuthority, saSubAuthorityGroup, SUB_AUTHORITY_COUNT * sizeof(ULONG)); 1533 1534 pSD->Group = cbSD; 1535 } 1536 cbSD += cbAdd; 1537 } 1538 1539 #undef SUB_AUTHORITY_COUNT 1540 1541 *pcbOut = cbSD; 1542 return STATUS_SUCCESS; 1543 } 1544 1482 1545 NTSTATUS VBoxMRxQuerySdInfo(IN OUT PRX_CONTEXT RxContext) 1483 1546 { 1484 RT_NOREF(RxContext); 1485 Log(("VBOXSF: MRxQuerySdInfo\n")); 1486 return STATUS_NOT_IMPLEMENTED; 1547 NTSTATUS Status; 1548 1549 PVOID pvBuffer = RxContext->Info.Buffer; 1550 ULONG cbBuffer = RxContext->Info.LengthRemaining; 1551 SECURITY_INFORMATION SecurityInformation = RxContext->QuerySecurity.SecurityInformation; 1552 1553 ULONG cbSD = 0; 1554 1555 Log(("VBOXSF: MRxQuerySdInfo: Buffer %p, Length %d, SecurityInformation 0x%x\n", 1556 pvBuffer, cbBuffer, SecurityInformation)); 1557 1558 Status = vbsfQuerySdInfo(pvBuffer, cbBuffer, SecurityInformation, &cbSD); 1559 if (NT_SUCCESS(Status)) 1560 { 1561 RxContext->InformationToReturn = cbSD; 1562 if (RxContext->InformationToReturn > cbBuffer) 1563 { 1564 Status = STATUS_BUFFER_OVERFLOW; 1565 } 1566 } 1567 1568 Log(("VBOXSF: MRxQuerySdInfo: Status 0x%08X, InformationToReturn %d\n", 1569 Status, RxContext->InformationToReturn)); 1570 return Status; 1487 1571 } 1488 1572
Note:
See TracChangeset
for help on using the changeset viewer.