Fixed typo in #ifndef at head of file.
[tprouty/samba.git] / source / nsswitch / winbind_nss_config.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 2.0
4
5    Winbind daemon for ntdom nss module
6
7    Copyright (C) Tim Potter 2000
8    
9    This library is free software; you can redistribute it and/or
10    modify it under the terms of the GNU Library General Public
11    License as published by the Free Software Foundation; either
12    version 2 of the License, or (at your option) any later version.
13    
14    This library is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17    Library General Public License for more details.
18    
19    You should have received a copy of the GNU Library General Public
20    License along with this library; if not, write to the
21    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22    Boston, MA  02111-1307, USA.   
23 */
24
25 #ifndef _WINBIND_NSS_CONFIG_H
26 #define _WINBIND_NSS_CONFIG_H
27
28 /* Include header files from data in config.h file */
29
30 #include <config.h>
31
32 #include <stdio.h>
33
34 #ifdef HAVE_STDLIB_H
35 #include <stdlib.h>
36 #endif
37
38 #ifdef HAVE_UNISTD_H
39 #include <unistd.h>
40 #endif
41
42 #ifdef HAVE_SYS_SOCKET_H
43 #include <sys/socket.h>
44 #endif
45
46 #ifdef HAVE_SYS_UN_H
47 #include <sys/un.h>
48 #endif
49
50 #ifdef HAVE_SYS_TIME_H
51 #include <sys/time.h>
52 #endif
53
54 #ifdef HAVE_GRP_H
55 #include <grp.h>
56 #endif
57
58 #include <sys/types.h>
59 #include <sys/stat.h>
60 #include <errno.h>
61 #include <pwd.h>
62
63 #ifdef HAVE_NSS_COMMON_H
64 /* Sun Solaris */
65
66 #include <nss_common.h>
67 #include <nss_dbdefs.h>
68 #include <nsswitch.h>
69
70 typedef nss_status_t NSS_STATUS;
71
72 #define NSS_STATUS_SUCCESS     NSS_SUCCESS
73 #define NSS_STATUS_NOTFOUND    NSS_NOTFOUND
74 #define NSS_STATUS_UNAVAIL     NSS_UNAVAIL
75 #define NSS_STATUS_TRYAGAIN    NSS_TRYAGAIN
76
77 #elif HAVE_NSS_H
78 /* GNU */
79
80 #include <nss.h>
81
82 typedef enum nss_status NSS_STATUS;
83
84 #else /* Nothing's defined. Neither gnu nor sun */
85
86 typedef enum
87 {
88   NSS_STATUS_SUCCESS,
89   NSS_STATUS_NOTFOUND,
90   NSS_STATUS_UNAVAIL,
91   NSS_STATUS_TRYAGAIN
92 } NSS_STATUS;
93
94 #endif
95
96 /* Declarations for functions in winbind_nss.c
97    needed in winbind_nss_solaris.c (solaris wrapper to nss) */
98
99 NSS_STATUS _nss_winbind_setpwent(void);
100 NSS_STATUS _nss_winbind_endpwent(void);
101 NSS_STATUS _nss_winbind_getpwent_r(struct passwd* result, char* buffer,
102                                    size_t buflen, int* errnop);
103 NSS_STATUS _nss_winbind_getpwuid_r(uid_t, struct passwd*, char* buffer,
104                                    size_t buflen, int* errnop);
105 NSS_STATUS _nss_winbind_getpwnam_r(const char* name, struct passwd* result,
106                                    char* buffer, size_t buflen, int* errnop);
107
108 NSS_STATUS _nss_winbind_setgrent(void);
109 NSS_STATUS _nss_winbind_endgrent(void);
110 NSS_STATUS _nss_winbind_getgrent_r(struct group* result, char* buffer,
111                                    size_t buflen, int* errnop);
112 NSS_STATUS _nss_winbind_getgrnam_r(const char *name,
113                                    struct group *result, char *buffer,
114                                    size_t buflen, int *errnop);
115 NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid,
116                                    struct group *result, char *buffer,
117                                    size_t buflen, int *errnop);
118
119 /* I'm trying really hard not to include anything from smb.h with the
120    result of some silly looking redeclaration of structures. */
121
122 #ifndef _PSTRING
123 #define _PSTRING
124 #define PSTRING_LEN 1024
125 #define FSTRING_LEN 256
126 typedef char pstring[PSTRING_LEN];
127 typedef char fstring[FSTRING_LEN];
128 #endif
129
130 #ifndef _BOOL
131 #define _BOOL                   /* So we don't typedef BOOL again in vfs.h */
132 #define False (0)
133 #define True (1)
134 #define Auto (2)
135 typedef int BOOL;
136 #endif
137
138 #if !defined(uint32)
139 #if (SIZEOF_INT == 4)
140 #define uint32 unsigned int
141 #elif (SIZEOF_LONG == 4)
142 #define uint32 unsigned long
143 #elif (SIZEOF_SHORT == 4)
144 #define uint32 unsigned short
145 #endif
146 #endif
147
148 #if !defined(uint16)
149 #if (SIZEOF_SHORT == 4)
150 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
151 #else /* SIZEOF_SHORT != 4 */
152 #define uint16 unsigned short
153 #endif /* SIZEOF_SHORT != 4 */
154 #endif
155
156 #ifndef uint8
157 #define uint8 unsigned char
158 #endif
159
160 /* zero a structure */
161 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
162
163 /* zero a structure given a pointer to the structure */
164 #define ZERO_STRUCTP(x) { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); }
165     
166 /* Some systems (SCO) treat UNIX domain sockets as FIFOs */
167
168 #ifndef S_IFSOCK
169 #define S_IFSOCK S_IFIFO
170 #endif
171
172 #ifndef S_ISSOCK
173 #define S_ISSOCK(mode)  ((mode & S_IFSOCK) == S_IFSOCK)
174 #endif
175
176 #endif