File tree Expand file tree Collapse file tree
crates/tinysecurity-audit/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ use windows_permissions::{
1616 wrappers,
1717} ;
1818
19- const READ_CONTROL_ATTRIBUTES : u32 = 0x0002_0080 ;
19+ // Metadata-only opens do not participate in NTFS share-access accounting.
20+ // FILE_LIST_DIRECTORY makes the no-delete share mode an actual rename pin.
21+ const PIN_ACCESS : u32 = 0x0002_0081 ;
2022const PIN_DIRECTORY : u32 = 0x0220_0000 ;
2123const OPEN_REPARSE : u32 = 0x0020_0000 ;
2224const REPARSE : u32 = 0x400 ;
@@ -164,7 +166,7 @@ fn verify_volume(root: &str) -> Result<()> {
164166}
165167fn pin ( path : & Path ) -> Result < File > {
166168 let file = OpenOptions :: new ( )
167- . access_mode ( READ_CONTROL_ATTRIBUTES )
169+ . access_mode ( PIN_ACCESS )
168170 . share_mode ( 3 )
169171 . custom_flags ( PIN_DIRECTORY )
170172 . open ( path)
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ pub(crate) fn diagnose(path: &Path) {
2323 eprintln ! ( "audit-stage=volume result={:?}" , verify_volume( root) ) ;
2424 }
2525 let handle = match OpenOptions :: new ( )
26- . access_mode ( READ_CONTROL_ATTRIBUTES )
26+ . access_mode ( PIN_ACCESS )
2727 . share_mode ( 3 )
2828 . custom_flags ( PIN_DIRECTORY )
2929 . open ( & current)
@@ -56,7 +56,7 @@ pub(crate) fn diagnose(path: &Path) {
5656 ( "existing-journal" , "audit.journal" ) ,
5757 ] {
5858 match OpenOptions :: new ( )
59- . access_mode ( READ_CONTROL_ATTRIBUTES )
59+ . access_mode ( PIN_ACCESS )
6060 . share_mode ( 3 )
6161 . custom_flags ( OPEN_REPARSE )
6262 . open ( path. join ( name) )
You can’t perform that action at this time.
0 commit comments