Struct zbus::fdo::ConnectionCredentials
source · pub struct ConnectionCredentials {
pub unix_user_id: Option<u32>,
pub unix_group_ids: Option<Vec<u32>>,
pub process_id: Option<u32>,
pub windows_sid: Option<String>,
pub linux_security_label: Option<Vec<u8>>,
}
Expand description
Credentials of a process connected to a bus server.
If unable to determine certain credentials (for instance, because the process is not on the same machine as the bus daemon, or because this version of the bus daemon does not support a particular security framework), or if the values of those credentials cannot be represented as documented here, then those credentials are omitted.
Note: unknown keys, in particular those with “.” that are not from the specification, will be ignored. Use your own implementation or contribute your keys here, or in the specification.
Fields§
§unix_user_id: Option<u32>
unix_user_id
methodunix_group_ids: Option<Vec<u32>>
unix_group_ids
methodprocess_id: Option<u32>
process_id
methodwindows_sid: Option<String>
windows_sid
methodlinux_security_label: Option<Vec<u8>>
linux_security_label
methodImplementations§
source§impl ConnectionCredentials
impl ConnectionCredentials
sourcepub fn unix_user_id(&self) -> Option<u32>
pub fn unix_user_id(&self) -> Option<u32>
The numeric Unix user ID, as defined by POSIX.
sourcepub fn unix_group_ids(&self) -> Option<&Vec<u32>>
pub fn unix_group_ids(&self) -> Option<&Vec<u32>>
The numeric Unix group IDs (including both the primary group and the supplementary groups), as defined by POSIX, in numerically sorted order. This array is either complete or absent: if the message bus is able to determine some but not all of the caller’s groups, or if one of the groups is not representable in a UINT32, it must not add this credential to the dictionary.
sourcepub fn into_unix_group_ids(self) -> Option<Vec<u32>>
pub fn into_unix_group_ids(self) -> Option<Vec<u32>>
Same as ConnectionCredentials::unix_group_ids
, but consumes self
and returns the group
IDs Vec.
sourcepub fn process_id(&self) -> Option<u32>
pub fn process_id(&self) -> Option<u32>
The numeric process ID, on platforms that have this concept. On Unix, this is the process ID defined by POSIX.
sourcepub fn windows_sid(&self) -> Option<&String>
pub fn windows_sid(&self) -> Option<&String>
The Windows security identifier in its string form, e.g.
S-1-5-21-3623811015-3361044348-30300820-1013
for a domain or local computer user or
“S-1-5-18` for the LOCAL_SYSTEM user.
sourcepub fn into_windows_sid(self) -> Option<String>
pub fn into_windows_sid(self) -> Option<String>
Same as ConnectionCredentials::windows_sid
, but consumes self
and returns the SID
string.
sourcepub fn linux_security_label(&self) -> Option<&Vec<u8>>
pub fn linux_security_label(&self) -> Option<&Vec<u8>>
On Linux systems, the security label that would result from the SO_PEERSEC getsockopt call. The array contains the non-zero bytes of the security label in an unspecified ASCII-compatible encoding, followed by a single zero byte.
For example, the SELinux context system_u:system_r:init_t:s0
(a string of length 27) would
be encoded as 28 bytes ending with ':', 's', '0', '\x00'
On SELinux systems this is the SELinux context, as output by ps -Z
or ls -Z
. Typical
values might include system_u:system_r:init_t:s0
,
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
, or
unconfined_u:unconfined_r:chrome_sandbox_t:s0-s0:c0.c1023
.
On Smack systems, this is the Smack label. Typical values might include _
, *
, User
,
System
or System::Shared
.
On AppArmor systems, this is the AppArmor context, a composite string encoding the AppArmor
label (one or more profiles) and the enforcement mode. Typical values might include
unconfined
, /usr/bin/firefox (enforce)
or user1 (complain)
.
sourcepub fn into_linux_security_label(self) -> Option<Vec<u8>>
pub fn into_linux_security_label(self) -> Option<Vec<u8>>
Same as ConnectionCredentials::linux_security_label
, but consumes self
and returns
the security label bytes.
sourcepub fn set_unix_user_id(self, unix_user_id: u32) -> Self
pub fn set_unix_user_id(self, unix_user_id: u32) -> Self
Set the numeric Unix user ID, as defined by POSIX.
sourcepub fn add_unix_group_id(self, unix_group_id: u32) -> Self
pub fn add_unix_group_id(self, unix_group_id: u32) -> Self
Add a numeric Unix group ID.
See ConnectionCredentials::unix_group_ids
for more information.
sourcepub fn set_process_id(self, process_id: u32) -> Self
pub fn set_process_id(self, process_id: u32) -> Self
Set the numeric process ID, on platforms that have this concept.
See ConnectionCredentials::process_id
for more information.
sourcepub fn set_windows_sid(self, windows_sid: String) -> Self
pub fn set_windows_sid(self, windows_sid: String) -> Self
Set the Windows security identifier in its string form.
sourcepub fn set_linux_security_label(self, linux_security_label: Vec<u8>) -> Self
pub fn set_linux_security_label(self, linux_security_label: Vec<u8>) -> Self
Set the Linux security label.
See ConnectionCredentials::linux_security_label
for more information.