22#include <gnunet_private_config.h>
28#include <sys/socket.h>
39#define ALIGN(idx) do { \
40 if (idx % sizeof(void*)) \
41 idx += (sizeof(void*) - idx % sizeof(void*)); \
75 enum nss_status
status = NSS_STATUS_UNAVAIL;
77 size_t address_length;
94 if ((af != AF_INET) &&
99 *h_errnop = NO_RECOVERY;
111 *h_errnop = NO_RECOVERY;
112 status = NSS_STATUS_TRYAGAIN;
124 status = NSS_STATUS_UNAVAIL;
125 *h_errnop = NO_RECOVERY;
131 *h_errnop = NO_RECOVERY;
132 status = NSS_STATUS_UNAVAIL;
138 *h_errnop = HOST_NOT_FOUND;
139 status = NSS_STATUS_NOTFOUND;
146 status = NSS_STATUS_NOTFOUND;
150 *((
char **) buffer) = NULL;
151 result->h_aliases = (
char **) buffer;
155 strcpy (buffer + idx,
157 result->h_name = buffer + idx;
158 idx += strlen (
name) + 1;
163 result->h_length = address_length;
166 if (buflen < idx +
u.data_len +
sizeof(
char*) * (
u.count + 1))
169 *h_errnop = NO_RECOVERY;
170 status = NSS_STATUS_TRYAGAIN;
175 l =
u.count * address_length;
177 memcpy (buffer + astart,
185 for (i = 0; i <
u.count; i++)
186 ((
char **) (buffer + idx))[i] = buffer + astart + address_length * i;
187 ((
char **) (buffer + idx))[i] = NULL;
188 result->h_addr_list = (
char **) (buffer + idx);
190 status = NSS_STATUS_SUCCESS;
271 *h_errnop = NO_RECOVERY;
273 return NSS_STATUS_UNAVAIL;
static mp_limb_t u[(((256)+GMP_NUMB_BITS - 1)/GMP_NUMB_BITS)]
static char * name
Name (label) of the records to list.
static int status
The program status; 0 for success.
static int result
Global testing status.
enum nss_status _nss_gns_gethostbyname_r(const char *name, struct hostent *result, char *buffer, size_t buflen, int *errnop, int *h_errnop)
The gethostbyname hook executed by nsswitch.
enum nss_status _nss_gns_gethostbyname2_r(const char *name, int af, struct hostent *result, char *buffer, size_t buflen, int *errnop, int *h_errnop)
The gethostbyname hook executed by nsswitch.
#define ALIGN(idx)
macro to align idx to 32bit boundary
enum nss_status _nss_gns_gethostbyaddr_r(const void *addr, int len, int af, struct hostent *result, char *buffer, size_t buflen, int *errnop, int *h_errnop)
The gethostbyaddr hook executed by nsswitch We can't do this so we always return NSS_STATUS_UNAVAIL.
int gns_resolve_name(int af, const char *name, struct userdata *u)
Wrapper function that uses gnunet-gns cli tool to resolve an IPv4/6 address.