Merge branch 'master' of ssh://git.samba.org/data/git/samba
[sfrench/samba-autobuild/.git] / nsswitch / nsstest.h
1 /*
2    Unix SMB/CIFS implementation.
3    nss includes for the nss tester
4    Copyright (C) Kai Blin 2007
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef _NSSTEST_H
21 #define _NSSTEST_H
22
23 #include <pwd.h>
24 #include <grp.h>
25
26 #ifdef HAVE_NSS_COMMON_H
27
28 /*
29  * Sun Solaris
30  */
31
32 #include <nss_common.h>
33 #include <nss_dbdefs.h>
34 #include <nsswitch.h>
35
36 typedef nss_status_t NSS_STATUS;
37
38 #define NSS_STATUS_SUCCESS     NSS_SUCCESS
39 #define NSS_STATUS_NOTFOUND    NSS_NOTFOUND
40 #define NSS_STATUS_UNAVAIL     NSS_UNAVAIL
41 #define NSS_STATUS_TRYAGAIN    NSS_TRYAGAIN
42
43 #elif HAVE_NSS_H
44
45 /*
46  * Linux (glibc)
47  */
48
49 #include <nss.h>
50 typedef enum nss_status NSS_STATUS;
51
52 #elif HAVE_NS_API_H
53
54 /*
55  * SGI IRIX
56  */
57
58 #ifdef DATUM
59 #define _DATUM_DEFINED
60 #endif
61
62 #include <ns_api.h>
63
64 typedef enum
65 {
66         NSS_STATUS_SUCCESS=NS_SUCCESS,
67                 NSS_STATUS_NOTFOUND=NS_NOTFOUND,
68                 NSS_STATUS_UNAVAIL=NS_UNAVAIL,
69                 NSS_STATUS_TRYAGAIN=NS_TRYAGAIN
70 } NSS_STATUS;
71
72 #define NSD_MEM_STATIC 0
73 #define NSD_MEM_VOLATILE 1
74 #define NSD_MEM_DYNAMIC 2
75
76 #elif defined(HPUX) && defined(HAVE_NSSWITCH_H)
77
78 /* HP-UX 11 */
79
80 #include <nsswitch.h>
81
82 #define NSS_STATUS_SUCCESS     NSS_SUCCESS
83 #define NSS_STATUS_NOTFOUND    NSS_NOTFOUND
84 #define NSS_STATUS_UNAVAIL     NSS_UNAVAIL
85 #define NSS_STATUS_TRYAGAIN    NSS_TRYAGAIN
86
87 #ifdef HAVE_SYNCH_H
88 #include <synch.h>
89 #endif
90 #ifdef HAVE_PTHREAD_H
91 #include <pthread.h>
92 #endif
93
94 typedef enum {
95         NSS_SUCCESS,
96         NSS_NOTFOUND,
97         NSS_UNAVAIL,
98         NSS_TRYAGAIN
99 } nss_status_t;
100
101 typedef nss_status_t NSS_STATUS;
102
103 #else /* Nothing's defined. Neither solaris nor gnu nor sun nor hp */
104
105 typedef enum
106 {
107         NSS_STATUS_SUCCESS=0,
108         NSS_STATUS_NOTFOUND=1,
109         NSS_STATUS_UNAVAIL=2,
110         NSS_STATUS_TRYAGAIN=3
111 } NSS_STATUS;
112
113 #endif
114
115 #endif /* _NSSTEST_H */