Struct Passwd

Synopsis

#include <src/uvw/util.h>

struct Passwd

Description

Utility class.

This class can be used to query the subset of the password file entry for the current effective uid (not the real uid).

See
Utilities::passwd

Methods

Passwd
gidGets the gid.
homedirGets the homedir.
operator boolChecks if the instance contains valid data.
shellGets the shell.
uidGets the uid.
usernameGets the username.

Source

Lines 217-258 in src/uvw/util.h.

struct Passwd {
    Passwd(std::shared_ptr<uv_passwd_t> pwd);

    /**
     * @brief Gets the username.
     * @return The username of the current effective uid (not the real uid).
     */
    std::string username() const noexcept;

    /**
     * @brief Gets the uid.
     * @return The current effective uid (not the real uid).
     */
    decltype(uv_passwd_t::uid) uid() const noexcept;

    /**
     * @brief Gets the gid.
     * @return The gid of the current effective uid (not the real uid).
     */
    decltype(uv_passwd_t::gid) gid() const noexcept;

    /**
     * @brief Gets the shell.
     * @return The shell of the current effective uid (not the real uid).
     */
    std::string shell() const noexcept;

    /**
     * @brief Gets the homedir.
     * @return The homedir of the current effective uid (not the real uid).
     */
    std::string homedir() const noexcept;

    /**
     * @brief Checks if the instance contains valid data.
     * @return True if data are all valid, false otherwise.
     */
    operator bool() const noexcept;

private:
    std::shared_ptr<uv_passwd_t> passwd;
};





Add Discussion as Guest

Log in