libnet: Fix Coverity ID 1634803 Dereference after null check
[samba4-gss.git] / nsswitch / winbind_nss_hpux.h
blobdba70a7657a5a6b60ca2df31b7773231137ea569
1 /*
2 Unix SMB/CIFS implementation.
4 Donated by HP to enable Winbindd to build on HPUX 11.x.
5 Copyright (C) Jeremy Allison 2002.
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 3 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef _WINBIND_NSS_HPUX_H
22 #define _WINBIND_NSS_HPUX_H
24 #include <nsswitch.h>
26 #define NSS_STATUS_SUCCESS NSS_SUCCESS
27 #define NSS_STATUS_NOTFOUND NSS_NOTFOUND
28 #define NSS_STATUS_UNAVAIL NSS_UNAVAIL
29 #define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN
31 #ifdef HAVE_SYNCH_H
32 #include <synch.h>
33 #endif
34 #ifdef HAVE_PTHREAD_H
35 #include <pthread.h>
36 #endif
38 typedef enum {
39 NSS_SUCCESS,
40 NSS_NOTFOUND,
41 NSS_UNAVAIL,
42 NSS_TRYAGAIN
43 } nss_status_t;
45 typedef nss_status_t NSS_STATUS;
47 struct nss_backend;
49 typedef nss_status_t (*nss_backend_op_t)(struct nss_backend *, void *args);
51 struct nss_backend {
52 nss_backend_op_t *ops;
53 int n_ops;
55 typedef struct nss_backend nss_backend_t;
56 typedef int nss_dbop_t;
58 #include <errno.h>
59 #include <netdb.h>
60 #include <limits.h>
62 #ifndef NSS_INCLUDE_UNSAFE
63 #define NSS_INCLUDE_UNSAFE 1 /* Build old, MT-unsafe interfaces, */
64 #endif /* NSS_INCLUDE_UNSAFE */
66 enum nss_netgr_argn {
67 NSS_NETGR_MACHINE,
68 NSS_NETGR_USER,
69 NSS_NETGR_DOMAIN,
70 NSS_NETGR_N
73 enum nss_netgr_status {
74 NSS_NETGR_FOUND,
75 NSS_NETGR_NO,
76 NSS_NETGR_NOMEM
79 typedef unsigned nss_innetgr_argc;
80 typedef char **nss_innetgr_argv;
82 struct nss_innetgr_1arg {
83 nss_innetgr_argc argc;
84 nss_innetgr_argv argv;
87 typedef struct {
88 void *result; /* "result" parameter to getXbyY_r() */
89 char *buffer; /* "buffer" " " */
90 int buflen; /* "buflen" " " */
91 } nss_XbyY_buf_t;
93 extern nss_XbyY_buf_t *_nss_XbyY_buf_alloc(int struct_size, int buffer_size);
94 extern void _nss_XbyY_buf_free(nss_XbyY_buf_t *);
96 union nss_XbyY_key {
97 uid_t uid;
98 gid_t gid;
99 const char *name;
100 int number;
101 struct {
102 long net;
103 int type;
104 } netaddr;
105 struct {
106 const char *addr;
107 int len;
108 int type;
109 } hostaddr;
110 struct {
111 union {
112 const char *name;
113 int port;
114 } serv;
115 const char *proto;
116 } serv;
117 void *ether;
120 typedef struct nss_XbyY_args {
121 nss_XbyY_buf_t buf;
122 int stayopen;
124 * Support for setXXXent(stayopen)
125 * Used only in hosts, protocols,
126 * networks, rpc, and services.
128 int (*str2ent)(const char *instr, int instr_len, void *ent, char *buffer, int buflen);
129 union nss_XbyY_key key;
131 void *returnval;
132 int erange;
134 * h_errno is defined as function call macro for multithreaded applications
135 * in HP-UX. *this* h_errno is not used in the HP-UX codepath of our nss
136 * modules, so let's simply rename it:
138 int h_errno_unused;
139 nss_status_t status;
140 } nss_XbyY_args_t;
142 #endif /* _WINBIND_NSS_HPUX_H */