1+ #![ allow( clippy:: print_stdout) ]
2+
13use anyhow:: Context as _;
24use win_api_wrappers:: identity:: account:: { enumerate_account_rights, get_username, lookup_account_by_name} ;
35use win_api_wrappers:: identity:: sid:: { Sid , SidAndAttributes } ;
@@ -59,8 +61,7 @@ pub(super) fn main() -> anyhow::Result<()> {
5961 . context ( "list token privileges" ) ?
6062 . as_slice ( )
6163 . iter ( )
62- . find ( |privilege| privilege. Luid == se_create_token_name_luid)
63- . is_some ( ) ;
64+ . any ( |privilege| privilege. Luid == se_create_token_name_luid) ;
6465
6566 assert ! ( se_create_token_name_is_enabled) ;
6667 }
@@ -73,6 +74,7 @@ pub(super) fn main() -> anyhow::Result<()> {
7374 // - This context may not be able to see the same network resources or DC that the interactive user.
7475 // Causing LookupAccountNameW to fail with a "no mapping" error.
7576 // Let’s just go ahead with the elevation in this case, assuming LocalSystem is enough for all intents and purposes at this point.
77+ #[ allow( clippy:: cast_possible_wrap) ]
7678 if e. code ( ) == HRESULT ( 0x80070534u32 as i32 ) {
7779 println ! ( "Got the 'no mapping' error; continuing..." )
7880 } else {
@@ -95,15 +97,13 @@ pub(super) fn main() -> anyhow::Result<()> {
9597
9698 groups. push ( SidAndAttributes {
9799 sid : Sid :: from_well_known ( Security :: WinLocalAccountAndAdministratorSid , None ) ?,
98- #[ expect( clippy:: cast_sign_loss) ]
99100 attributes : ( SystemServices :: SE_GROUP_ENABLED
100101 | SystemServices :: SE_GROUP_ENABLED_BY_DEFAULT
101102 | SystemServices :: SE_GROUP_MANDATORY ) as u32 ,
102103 } ) ;
103104
104105 groups. push ( SidAndAttributes {
105106 sid : owner_sid. clone ( ) ,
106- #[ expect( clippy:: cast_sign_loss) ]
107107 attributes : ( SystemServices :: SE_GROUP_ENABLED
108108 | SystemServices :: SE_GROUP_ENABLED_BY_DEFAULT
109109 | SystemServices :: SE_GROUP_MANDATORY
@@ -112,7 +112,6 @@ pub(super) fn main() -> anyhow::Result<()> {
112112
113113 groups. push ( SidAndAttributes {
114114 sid : Sid :: from_well_known ( Security :: WinHighLabelSid , None ) ?,
115- #[ expect( clippy:: cast_sign_loss) ]
116115 attributes : ( SystemServices :: SE_GROUP_ENABLED
117116 | SystemServices :: SE_GROUP_ENABLED_BY_DEFAULT
118117 | SystemServices :: SE_GROUP_MANDATORY ) as u32 ,
0 commit comments