@@ -396,8 +396,8 @@ impl Keyring {
396
396
///
397
397
/// Requires the `setattr` permission on the keyring and the SysAdmin capability if the current
398
398
/// user does not own the keyring.
399
- pub fn set_permissions ( & mut self , perms : KeyPermissions ) -> Result < ( ) > {
400
- check_call ( unsafe { keyctl_setperm ( self . id , perms) } , ( ) )
399
+ pub fn set_permissions ( & mut self , perms : Permission ) -> Result < ( ) > {
400
+ check_call ( unsafe { keyctl_setperm ( self . id , perms. bits ( ) ) } , ( ) )
401
401
}
402
402
403
403
fn description_raw ( & self ) -> Result < String > {
@@ -534,7 +534,7 @@ impl Key {
534
534
///
535
535
/// Requires the `setattr` permission on the key and the SysAdmin capability if the current
536
536
/// user does not own the key.
537
- pub fn set_permissions ( & mut self , perms : KeyPermissions ) -> Result < ( ) > {
537
+ pub fn set_permissions ( & mut self , perms : Permission ) -> Result < ( ) > {
538
538
Keyring :: new_impl ( self . id ) . set_permissions ( perms)
539
539
}
540
540
@@ -607,7 +607,7 @@ pub struct Description {
607
607
/// The group owner of the key.
608
608
pub gid : libc:: gid_t ,
609
609
/// The permissions of the key.
610
- pub perms : KeyPermissions ,
610
+ pub perms : Permission ,
611
611
/// The plaintext description of the key.
612
612
pub description : String ,
613
613
}
@@ -628,11 +628,12 @@ impl Description {
628
628
https://github.com/mathstuf/rust-keyutils: {}",
629
629
desc) ;
630
630
}
631
+ let bits = KeyPermissions :: from_str_radix ( pieces[ 1 ] , 16 ) . unwrap ( ) ;
631
632
Some ( Description {
632
633
type_ : pieces[ 4 ] . to_owned ( ) ,
633
634
uid : pieces[ 3 ] . parse :: < libc:: uid_t > ( ) . unwrap ( ) ,
634
635
gid : pieces[ 2 ] . parse :: < libc:: gid_t > ( ) . unwrap ( ) ,
635
- perms : KeyPermissions :: from_str_radix ( pieces [ 1 ] , 16 ) . unwrap ( ) ,
636
+ perms : Permission :: from_bits_truncate ( bits ) ,
636
637
description : pieces[ 0 ] . to_owned ( ) ,
637
638
} )
638
639
}
0 commit comments