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