[]Struct gio::Credentials

pub struct Credentials(_, _);

The Credentials type is a reference-counted wrapper for native credentials. This information is typically used for identifying, authenticating and authorizing other processes.

Some operating systems supports looking up the credentials of the remote peer of a communication endpoint - see e.g. SocketExt::get_credentials.

Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see UnixCredentialsMessage, UnixConnection::send_credentials and UnixConnection::receive_credentials for details.

On Linux, the native credential type is a struct ucred - see the unix(7) man page for details. This corresponds to CredentialsType::LinuxUcred.

On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native credential type is a struct cmsgcred. This corresponds to CredentialsType::FreebsdCmsgcred.

On NetBSD, the native credential type is a struct unpcbid. This corresponds to CredentialsType::NetbsdUnpcbid.

On OpenBSD, the native credential type is a struct sockpeercred. This corresponds to CredentialsType::OpenbsdSockpeercred.

On Solaris (including OpenSolaris and its derivatives), the native credential type is a ucred_t. This corresponds to CredentialsType::SolarisUcred.

Implements

glib::object::ObjectExt

Methods

impl Credentials[src]

pub fn new() -> Credentials[src]

Creates a new Credentials object with credentials matching the the current process.

Returns

A Credentials. Free with gobject::ObjectExt::unref.

pub fn get_unix_pid(&self) -> Result<i32, Error>[src]

Tries to get the UNIX process identifier from self. This method is only available on UNIX platforms.

This operation can fail if Credentials is not supported on the OS or if the native credentials type does not contain information about the UNIX process ID.

Returns

The UNIX process ID, or -1 if error is set.

pub fn get_unix_user(&self) -> Result<(), Error>[src]

Tries to get the UNIX user identifier from self. This method is only available on UNIX platforms.

This operation can fail if Credentials is not supported on the OS or if the native credentials type does not contain information about the UNIX user.

Returns

The UNIX user identifier or -1 if error is set.

pub fn is_same_user(&self, other_credentials: &Credentials) -> Result<(), Error>[src]

Checks if self and other_credentials is the same user.

This operation can fail if Credentials is not supported on the the OS.

other_credentials

A Credentials.

Returns

true if self and other_credentials has the same user, false otherwise or if error is set.

pub fn set_unix_user(&self, uid: u32) -> Result<(), Error>[src]

Tries to set the UNIX user identifier on self. This method is only available on UNIX platforms.

This operation can fail if Credentials is not supported on the OS or if the native credentials type does not contain information about the UNIX user. It can also fail if the OS does not allow the use of "spoofed" credentials.

uid

The UNIX user identifier to set.

Returns

true if uid was set, false if error is set.

pub fn to_string(&self) -> GString[src]

Creates a human-readable textual representation of self that can be used in logging and debug messages. The format of the returned string may change in future GLib release.

Returns

A string that should be freed with g_free.

Trait Implementations

impl Clone for Credentials

impl Debug for Credentials

impl Default for Credentials[src]

impl Display for Credentials[src]

impl Eq for Credentials

impl Hash for Credentials

impl Ord for Credentials

impl<T: ObjectType> PartialEq<T> for Credentials

impl<T: ObjectType> PartialOrd<T> for Credentials

impl StaticType for Credentials

Auto Trait Implementations

impl RefUnwindSafe for Credentials

impl !Send for Credentials

impl !Sync for Credentials

impl Unpin for Credentials

impl UnwindSafe for Credentials

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.