desktop/debian: moved bsyncjail to pkglibexecdir
[barry/progweb.git] / src / getpwuid.h
blobe4c1397f6cdb97e7404d04fa6c2f795a8709f80f
1 ///
2 /// \file getpwuid.h
3 /// Header for getpwduid*() calls, for systems that don't have an equivalent.
4 ///
6 /*
7 Copyright (C) 2007-2012, Net Direct Inc. (http://www.netdirect.ca/)
8 Portions Copyright (C) 2011, RealVNC Ltd.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License in the COPYING file at the
20 root directory of this project for more details.
23 #ifndef __BARRY_GETPWUID_H__
24 #define __BARRY_GETPWUID_H__
26 #include "config.h" // getpwuid.h is not installed, so this is safe
27 #include <sys/types.h>
29 #ifdef HAVE_GETPWUID
30 // System supports pwd so just include the system headers
31 #include <pwd.h>
33 #else
35 // so define our own version...
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 struct barry_passwd {
40 char *pw_name; /* username */
41 char *pw_passwd; /* user password */
42 uid_t pw_uid; /* user ID */
43 gid_t pw_gid; /* group ID */
44 char *pw_gecos; /* real name */
45 char *pw_dir; /* home directory */
46 char *pw_shell; /* shell program */
49 struct barry_passwd *barry_getpwuid(uid_t uid);
50 int barry_getpwuid_r(uid_t uid, struct barry_passwd *pwd,
51 char *buf, size_t buflen, struct barry_passwd **result);
53 #ifdef __cplusplus
55 #endif
57 // and override the system's names so we call our own
58 #define passwd barry_passwd
59 #define getpwuid(u) barry_getpwuid(u)
60 #define getpwuid_r(u, p, b, l, r) barry_getpwuid_r(u, p, b, l, r)
62 #endif // !HAVE_GETPWDUID
64 #endif // __BARRY_GETPWUID_H__