iAdd __nscd_getai prototype.

This commit is contained in:
Ulrich Drepper 2004-09-16 22:54:54 +00:00
parent 40a8d825af
commit 62417d7ee8
7 changed files with 74 additions and 66 deletions

View File

@ -82,6 +82,7 @@ CFLAGS-xmalloc.c = -fpie
CFLAGS-xstrdup.c = -fpie
CFLAGS-mem.c = -fpie
CFLAGS-nscd_setup_thread.c = -fpie
CFLAGS-aicache.c = -fpie
$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
$(LINK.o) -pie -Wl,-O1 \

View File

@ -294,8 +294,4 @@ extern const struct datahead *__nscd_cache_search (request_type type,
size_t keylen,
const struct mapped_database *mapped);
/* Look up in addrinfo cache. */
extern int __nscd_getai (const char *key, struct nscd_ai_result **result,
int *h_errnop);
#endif /* nscd.h */

View File

@ -27,6 +27,7 @@
#include <not-cancel.h>
#include "nscd-client.h"
#include "nscd_proto.h"
/* Define in nscd_gethst_r.c. */

View File

@ -72,7 +72,7 @@ void
__nscd_unmap (struct mapped_database *mapped)
{
assert (mapped->counter == 0);
munmap ((void *) mapped->head, mapped->mapsize);
__munmap ((void *) mapped->head, mapped->mapsize);
free (mapped);
}
@ -180,7 +180,7 @@ get_mapping (request_type type, const char *key,
if (newp == NULL)
{
/* Ugh, after all we went through the memory allocation failed. */
munmap (result, size);
__munmap (result, size);
goto out_close;
}

View File

@ -24,6 +24,9 @@
#include <netdb.h>
#include <pwd.h>
/* Interval in which we transfer retry to contact the NSCD. */
#define NSS_NSCD_RETRY 100
/* Variables for communication between NSCD handler functions and NSS. */
extern int __nss_not_use_nscd_passwd attribute_hidden;
extern int __nss_not_use_nscd_group attribute_hidden;
@ -53,5 +56,7 @@ extern int __nscd_gethostbyaddr_r (const void *addr, socklen_t len, int type,
struct hostent *resultbuf,
char *buffer, size_t buflen,
struct hostent **result, int *h_errnop);
extern int __nscd_getai (const char *key, struct nscd_ai_result **result,
int *h_errnop);
#endif /* _NSCD_PROTO_H */

View File

@ -114,9 +114,6 @@ extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp)
internal_function;
libc_hidden_proto (DB_LOOKUP_FCT)
/* Interval in which we transfer retry to contact the NSCD. */
#define NSS_NSCD_RETRY 100
int
INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,

View File

@ -55,6 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <nsswitch.h>
#include <not-cancel.h>
#include <nscd/nscd-client.h>
#include <nscd/nscd_proto.h>
#ifdef HAVE_LIBIDN
extern int __idna_to_ascii_lz (const char *input, char **output, int flags);
@ -672,6 +673,12 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
#ifdef USE_NSCD
if (__nss_not_use_nscd_hosts > 0
&& ++__nss_not_use_nscd_hosts > NSS_NSCD_RETRY)
__nss_not_use_nscd_hosts = 0;
if (!__nss_not_use_nscd_hosts)
{
/* Try to use nscd. */
struct nscd_ai_result *air = NULL;
int herrno;
@ -728,7 +735,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
goto process_list;
}
else if (err != 0)
else if (err != 0 && __nss_not_use_nscd_hosts == 0)
{
if (herrno == NETDB_INTERNAL && errno == ENOMEM)
return -EAI_MEMORY;
@ -736,6 +743,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
return -EAI_AGAIN;
return -EAI_SYSTEM;
}
}
#endif
if (__nss_hosts_database != NULL)