.TH "FBB::User" "3bobcat" "2005\-2023" "libbobcat\-dev_6\&.04\&.00" "/etc/passwd user info" .PP .SH "NAME" FBB::User \- Provides the \fI/etc/passwd\fP info of the current user .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" This class retrieves the information of the current user from the information in \fI/etc/passwd\fP\&. The class is a simple wrapper class around the \fBgetpwent\fP(3) function\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \- .PP .SH "CONSTRUCTORS" .IP o \fBUser()\fP: .br The default constructor determines the current user\(cq\&s data\&. This constructor throws an \fIException\fP exception if it did not properly complete because the current user name could not be found in \fI/etc/passwd\fP\&. .IP .IP o \fBUser(size_t uid)\fP: .br The data of the user whose user\-id is \fIuid\fP are determined\&. If the data could not be found an \fIException\fP is thrown\&. .IP .IP o \fBUser(std::string const &name)\fP: .br The data of the user whose user\-name is \fIname\fP are determined\&. If the data could not be found an \fIException\fP is thrown\&. .PP Copy and move constructors (and assignment operators) are available\&. .PP .SH "MEMBER FUNCTIONS" .IP o \fBsize_t eGroupid() const\fP: .br Returns the user\(cq\&s \fIeffective\fP group\-id\&. .IP o \fBsize_t eUserid() const\fP: .br Returns the user\(cq\&s \fIeffective\fP user\-id\&. .IP o \fBsize_t groupid() const\fP: .br Returns the user\(cq\&s group\-id\&. .IP o \fBstd::string homedir() const\fP: .br Returns the user\(cq\&s home directory (including a trailing \fI/\fP)\&. .IP o \fBbool inGroup(size_t gid, bool useEffective = true) const\fP: .br Returns \fItrue\fP if the current user is a member of group \fIgid\fP, otherwise \fIfalse\fP is returned\&. The user\(cq\&s effective group id is also checked if \fIuseEffective\fP is specified as \fItrue\fP (which is provided as default function argument)\&. .IP o \fBstd::string name() const\fP: .br Returns the user\(cq\&s user\-name\&. .IP o \fBstd::string password() const\fP: .br Returns the user\(cq\&s encrypted password\&. But see also the \fBBUGS\fP section\&. .IP o \fBstd::string realname() const\fP: .br Returns the user\(cq\&s real name, as listed in the \fI/etc/passwd\fP\(cq\&s \fIgecos\fP field\&. .IP o \fBstd::string shell() const\fP: .br Returns the user\(cq\&s shell\&. .IP o \fBsize_t userid() const\fP: .br Returns the user\(cq\&s user\-id\&. .PP .SH "EXAMPLE" .nf #include #include using namespace std; using namespace FBB; int main() { User user; cout << \(dq\&\en\(dq\& \(dq\&name : \(dq\& << user\&.name() << \(dq\&\en\(dq\& << \(dq\&password : \(dq\& << user\&.password() << \(dq\&\en\(dq\& << \(dq\&user id : \(dq\& << user\&.userid() << \(dq\&\en\(dq\& << \(dq\&group id : \(dq\& << user\&.groupid() << \(dq\&\en\(dq\& << \(dq\&real name : \(dq\& << user\&.realname() << \(dq\&\en\(dq\& << \(dq\&home dir : \(dq\& << user\&.homedir() << \(dq\&\en\(dq\& << \(dq\&shell : \(dq\& << user\&.shell() << \(dq\&\en\(dq\& << endl; } .fi .PP .SH "FILES" \fIbobcat/user\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBgetpwent\fP(3) .PP .SH "BUGS" If the user is a member of multiple groups, only the group id listed in \fI/etc/passwd\fP is returned by \fBgroupid()\fP\&. .PP If shadow passwording is used, the string returned by \fBpassword()\fP will probably not contain the encrypted password\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_6\&.04\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_6\&.04\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_6\&.04\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP