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>
👎Deprecated since 3.13.0: Use unix_user_id method
§unix_group_ids: Option<Vec<u32>>
👎Deprecated since 3.13.0: Use unix_group_ids method
§process_id: Option<u32>
👎Deprecated since 3.13.0: Use process_id method
§windows_sid: Option<String>
👎Deprecated since 3.13.0: Use windows_sid method
§linux_security_label: Option<Vec<u8>>
👎Deprecated since 3.13.0: Use linux_security_label method

Implementations§

source§

impl ConnectionCredentials

source

pub fn unix_user_id(&self) -> Option<u32>

The numeric Unix user ID, as defined by POSIX.

source

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.

source

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.

source

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.

source

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.

source

pub fn into_windows_sid(self) -> Option<String>

Same as ConnectionCredentials::windows_sid, but consumes self and returns the SID string.

source

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).

source

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.

source

pub fn set_unix_user_id(self, unix_user_id: u32) -> Self

Set the numeric Unix user ID, as defined by POSIX.

source

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.

source

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.

source

pub fn set_windows_sid(self, windows_sid: String) -> Self

Set the Windows security identifier in its string form.

source

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.

Trait Implementations§

source§

impl Debug for ConnectionCredentials

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ConnectionCredentials

source§

fn default() -> ConnectionCredentials

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for ConnectionCredentials

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for ConnectionCredentials

source§

fn eq(&self, other: &ConnectionCredentials) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for ConnectionCredentials

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Type for ConnectionCredentials

source§

fn signature() -> Signature<'static>

Get the signature for the implementing type. Read more
source§

impl Eq for ConnectionCredentials

source§

impl StructuralPartialEq for ConnectionCredentials

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<'de, T> DynamicDeserialize<'de> for T
where T: Type + Deserialize<'de> + ?Sized,

source§

type Deserializer = PhantomData<T>

A DeserializeSeed implementation for this type.
source§

fn deserializer_for_signature<S>( signature: S, ) -> Result<<T as DynamicDeserialize<'de>>::Deserializer, Error>
where S: TryInto<Signature<'de>>, <S as TryInto<Signature<'de>>>::Error: Into<Error>,

Get a deserializer compatible with this signature.
source§

impl<T> DynamicType for T
where T: Type + ?Sized,

source§

fn dynamic_signature(&self) -> Signature<'_>

Get the signature for the implementing type. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> NoneValue for T
where T: Default,

source§

type NoneType = T

source§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,