File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ default-features = false
118118
119119[target .'cfg(target_os = "linux")' .dependencies ]
120120proc-mounts = " 0.3"
121+ capctl = " 0.2.4"
121122
122123[target .'cfg(unix)' .dependencies ]
123124uzers = " 0.12.1"
Original file line number Diff line number Diff line change @@ -588,7 +588,13 @@ const ATTRIBUTE_DISPLAYS: &[AttributeDisplay] = &[
588588 } ,
589589] ;
590590
591- #[ cfg( not( target_os = "macos" ) ) ]
591+ #[ cfg( target_os = "linux" ) ]
592+ const ATTRIBUTE_DISPLAYS : & [ AttributeDisplay ] = & [ AttributeDisplay {
593+ attribute : "security.capability" ,
594+ display : display_capability,
595+ } ] ;
596+
597+ #[ cfg( not( any( target_os = "linux" , target_os = "macos" ) ) ) ]
592598const ATTRIBUTE_DISPLAYS : & [ AttributeDisplay ] = & [ ] ;
593599
594600// com.apple.lastuseddate is two 64-bit values representing the seconds and nano seconds
@@ -665,6 +671,17 @@ fn display_macl(attribute: &Attribute) -> Option<String> {
665671 } )
666672}
667673
674+ // "security.capability" attribute represents capabilities in a binary format.
675+ // See "capabilities(7)"
676+ #[ cfg( target_os = "linux" ) ]
677+ fn display_capability ( attribute : & Attribute ) -> Option < String > {
678+ attribute
679+ . value
680+ . as_ref ( )
681+ . and_then ( |v| capctl:: FileCaps :: unpack_attrs ( v) . ok ( ) )
682+ . map ( |caps| format ! ( "{caps}" ) )
683+ }
684+
668685// plist::XmlWriter takes the writer instead of borrowing it. This is a
669686// wrapper around a borrowed vector that just forwards the Write trait
670687// calls to the borrowed vector.
You can’t perform that action at this time.
0 commit comments