Rudiments
passwdentry.h
1 // Copyright (c) 2002 David Muse
2 // See the COPYING file for more information.
3 
4 #ifndef RUDIMENTS_PASSWDENTRY_H
5 #define RUDIMENTS_PASSWDENTRY_H
6 
7 #include <rudiments/private/passwdentryincludes.h>
8 
9 #ifdef RUDIMENTS_NAMESPACE
10 namespace rudiments {
11 #endif
12 
13 class passwdentryprivate;
14 
17 class RUDIMENTS_DLLSPEC passwdentry {
18  public:
19 
25  static bool getName(uid_t userid, char **name);
26 
32  static bool getPassword(uid_t userid, char **password);
33 
38  static bool getPrimaryGroupId(uid_t userid, gid_t *groupid);
39 
45  static bool getRealName(uid_t userid, char **realname);
46 
53  static bool getHomeDirectory(uid_t userid, char **homedir);
54 
61  static bool getShell(uid_t userid, char **shell);
62 
63 
69  static bool getPassword(const char *username,
70  char **password);
71 
75  static bool getUserId(const char *username,
76  uid_t *userid);
77 
82  static bool getPrimaryGroupId(const char *username,
83  gid_t *groupid);
84 
90  static bool getRealName(const char *username,
91  char **realname);
92 
99  static bool getHomeDirectory(const char *username,
100  char **homedir);
101 
108  static bool getShell(const char *username,
109  char **shell);
110 
112  passwdentry();
113 
116  passwdentry(const passwdentry &p);
117 
120  passwdentry &operator=(const passwdentry &p);
121 
123  ~passwdentry();
124 
127  bool initialize(const char *username);
128 
131  bool initialize(uid_t userid);
132 
134  const char *getName() const;
135 
137  const char *getPassword() const;
138 
140  uid_t getUserId() const;
141 
143  gid_t getPrimaryGroupId() const;
144 
146  const char *getRealName() const;
147 
149  const char *getHomeDirectory() const;
150 
152  const char *getShell() const;
153 
155  void print() const;
156 
159  static bool needsMutex();
160 
164  static void setMutex(mutex *mtx);
165 
166  #include <rudiments/private/passwdentry.h>
167 };
168 
169 #ifdef RUDIMENTS_NAMESPACE
170 }
171 #endif
172 
173 #endif