UNISTDX_SYSTEM_NSS
using group_iterator = groupstream::iterator

Iterator for groupstream.

using user_iterator = userstream::iterator

Iterator for userstream.

using passwd_type = struct ::passwd

Alias to passwd system type.

using group_type = struct ::group

Alias to group system type.

class sys::group

System user group.

  • Wraps group system type.
  • The size of this wrapper is larger than group, because it contains byte buffer that stores all the fields.

Base classes
  • public group_type
Types
Methods
  • operator!=(const group & rhs) const -> bool

    Compare group IDs.

  • operator==(const group & rhs) const -> bool

    Compare group IDs.

  • size() const -> size_t

    Count group members.

  • end() const -> iterator

    Get iterator to the end of group members.

  • begin() const -> iterator

    Get iterator to the beginning of group members.

  • id() const -> gid_type

    Get group ID.

  • password() const -> const char *

    Get group password.

  • name() const -> const char *

    Get group name.

  • operator=(const group_type & rhs) -> group &

    Assignment.

  • operator=(const group &) -> group &

    Assignment.

  • ~group()
  • group(group &&)

    Move-constructor.

  • group(const group &)

    Copy-constructor.

  • group()
Friends
  • find_group

    Find group in system database by name name and store in result.

    See
    getgrnam(3)
  • find_group

    Find group in system database by id id and store in result.

    See
    getgruid(3)
  • operator<<

    Print group in /etc/group format.

class sys::user

System user.

  • Wraps passwd system type.
  • The size of this wrapper is larger than passwd, because it contains byte buffer that stores all the fields.

Base classes
  • public passwd_type
Methods
  • operator!=(const user & rhs) const -> bool

    Compare user IDs.

  • operator==(const user & rhs) const -> bool

    Compare user IDs.

  • shell() const -> const char *

    Get user shell.

  • home() const -> const char *

    Get user home directory.

  • real_name() const -> const char *

    Get user real name.

  • group_id() const -> gid_type

    Get user primary group ID.

  • id() const -> uid_type

    Get user ID.

  • password() const -> const char *

    Get user password.

  • name() const -> const char *

    Get user name.

  • operator=(const passwd_type & rhs) -> user &

    Assignment.

  • operator=(const user & rhs) -> user &

    Assignment.

  • ~user()
  • user(const user &)

    Copy-constructor.

  • user(user &&)

    Move-constructor.

  • user()
Friends
  • find_user

    Find user in system database by name name and store in result.

    bad_call

    See
    getpwnam(3)
  • find_user

    Find user in system database by id id and store in result.

    bad_call

    See
    getpwuid(3)
  • operator<<

    Print user in /etc/passwd format.

class sys::userstream

Input stream of system users. Useful to traverse all system users in conjunction with user_iterator.

Types
Methods
  • close() -> void
  • open() -> void
  • end() -> iterator
  • begin() -> iterator
  • operator>>(reference rhs) -> userstream &

    Read the next user from the stream.

  • operator!() const -> bool

    Returns true if the end of stream is reached.

  • operator bool() constexplicit

    Returns true if the end of stream is not reached.

  • ~userstream()
  • userstream()
class sys::groupstream

Input stream of system groups. Useful to traverse all system groups in conjunction with group_iterator.

Types
Methods
  • close() -> void
  • open() -> void
  • end() -> iterator
  • begin() -> iterator
  • operator>>(reference rhs) -> groupstream &

    Read the next group from the stream.

  • operator!() const -> bool

    Returns true if the end of stream is reached.

  • operator bool() constexplicit

    Returns true if the end of stream is not reached.

  • ~groupstream()
  • groupstream()
find_group(gid_type id, group & result) -> bool

Find group in system database by id id and store in result.

operator<<(std::ostream & out, const user & rhs) -> std::ostream &

Print user in /etc/passwd format.

find_user(uid_type id, user & result) -> bool

Find user in system database by id id and store in result.

bad_call

find_user(const char * name, user & result) -> bool

Find user in system database by name name and store in result.

bad_call

find_group(const char * name, group & result) -> bool

Find group in system database by name name and store in result.

operator<<(std::ostream & out, const group & rhs) -> std::ostream &

Print group in /etc/group format.