arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh677316-hesiod.patch

147e83
This backports the hesiod subdirectory up to and including these
147e83
upstream commits:
147e83
147e83
commit bfff8b1becd7d01c074177df7196ab327cd8c844
147e83
Author: Joseph Myers <joseph@codesourcery.com>
147e83
Date:   Sun Jan 1 00:14:16 2017 +0000
147e83
147e83
    Update copyright dates with scripts/update-copyrights.
147e83
147e83
commit 8a03ccbb77f52ec4b55062eeedddb8daec1a33e4
147e83
Author: Florian Weimer <fweimer@redhat.com>
147e83
Date:   Mon May 2 16:04:32 2016 +0200
147e83
147e83
    hesiod: Avoid heap overflow in get_txt_records [BZ #20031]
147e83
147e83
It is required to eliminate a dependency on resolver internals.
147e83
147e83
diff --git a/hesiod/Makefile b/hesiod/Makefile
147e83
index 5aeb86eaf8971535..3c967441e17240b4 100644
147e83
--- a/hesiod/Makefile
147e83
+++ b/hesiod/Makefile
147e83
@@ -1,4 +1,4 @@
147e83
-# Copyright (C) 1997, 1998, 2000, 2001, 2012 Free Software Foundation, Inc.
147e83
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
147e83
 # This file is part of the GNU C Library.
147e83
 
147e83
 # The GNU C Library is free software; you can redistribute it and/or
147e83
@@ -20,13 +20,15 @@
147e83
 #
147e83
 subdir	:= hesiod
147e83
 
147e83
+include ../Makeconfig
147e83
+
147e83
 extra-libs := libnss_hesiod
147e83
 extra-libs-others = $(extra-libs)
147e83
 
147e83
 subdir-dirs = nss_hesiod
147e83
 vpath %.c nss_hesiod
147e83
 
147e83
-libnss_hesiod-routines	:= hesiod hesiod-grp hesiod-init hesiod-proto \
147e83
+libnss_hesiod-routines	:= hesiod hesiod-grp hesiod-proto \
147e83
 			   hesiod-pwd hesiod-service
147e83
 # Build only shared library
147e83
 libnss_hesiod-inhibit-o	= $(filter-out .os,$(object-suffixes))
147e83
diff --git a/hesiod/hesiod.c b/hesiod/hesiod.c
147e83
index 657dabebc144db7d..9b54d1cb6b18f0e5 100644
147e83
--- a/hesiod/hesiod.c
147e83
+++ b/hesiod/hesiod.c
147e83
@@ -1,6 +1,19 @@
147e83
-#if defined(LIBC_SCCS) && !defined(lint)
147e83
-static const char rcsid[] = "$BINDId: hesiod.c,v 1.21 2000/02/28 14:51:08 vixie Exp $";
147e83
-#endif
147e83
+/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
147e83
+   This file is part of the GNU C Library.
147e83
+
147e83
+   The GNU C Library is free software; you can redistribute it and/or
147e83
+   modify it under the terms of the GNU Lesser General Public
147e83
+   License as published by the Free Software Foundation; either
147e83
+   version 2.1 of the License, or (at your option) any later version.
147e83
+
147e83
+   The GNU C Library is distributed in the hope that it will be useful,
147e83
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
+   Lesser General Public License for more details.
147e83
+
147e83
+   You should have received a copy of the GNU Lesser General Public
147e83
+   License along with the GNU C Library; if not, see
147e83
+   <http://www.gnu.org/licenses/>.  */
147e83
 
147e83
 /*
147e83
  * Copyright (c) 1996,1999 by Internet Software Consortium.
147e83
@@ -46,24 +59,14 @@ static const char rcsid[] = "$BINDId: hesiod.c,v 1.21 2000/02/28 14:51:08 vixie
147e83
 
147e83
 #include "hesiod.h"
147e83
 #include "hesiod_p.h"
147e83
-#undef DEF_RHS
147e83
 
147e83
 #define _PATH_HESIOD_CONF "/etc/hesiod.conf"
147e83
 
147e83
 /* Forward */
147e83
 
147e83
-int		hesiod_init(void **context);
147e83
-void		hesiod_end(void *context);
147e83
-char *		hesiod_to_bind(void *context, const char *name,
147e83
-			       const char *type);
147e83
-char **		hesiod_resolve(void *context, const char *name,
147e83
-			       const char *type);
147e83
-void		hesiod_free_list(void *context, char **list);
147e83
-
147e83
 static int	parse_config_file(struct hesiod_p *ctx, const char *filename);
147e83
 static char **	get_txt_records(struct hesiod_p *ctx, int class,
147e83
 				const char *name);
147e83
-static int	init(struct hesiod_p *ctx);
147e83
 
147e83
 /* Public */
147e83
 
147e83
@@ -82,7 +85,6 @@ hesiod_init(void **context) {
147e83
 
147e83
 	ctx->LHS = NULL;
147e83
 	ctx->RHS = NULL;
147e83
-	ctx->res = NULL;
147e83
 	/* Set default query classes. */
147e83
 	ctx->classes[0] = C_IN;
147e83
 	ctx->classes[1] = C_HS;
147e83
@@ -91,19 +93,7 @@ hesiod_init(void **context) {
147e83
 	if (!configname)
147e83
 	  configname = _PATH_HESIOD_CONF;
147e83
 	if (parse_config_file(ctx, configname) < 0) {
147e83
-#ifdef DEF_RHS
147e83
-		/*
147e83
-		 * Use compiled in defaults.
147e83
-		 */
147e83
-		ctx->LHS = malloc(strlen(DEF_LHS)+1);
147e83
-		ctx->RHS = malloc(strlen(DEF_RHS)+1);
147e83
-		if (ctx->LHS == 0 || ctx->RHS == 0)
147e83
-			goto cleanup;
147e83
-		strcpy(ctx->LHS, DEF_LHS);
147e83
-		strcpy(ctx->RHS, DEF_RHS);
147e83
-#else
147e83
 		goto cleanup;
147e83
-#endif
147e83
 	}
147e83
 	/*
147e83
 	 * The default RHS can be overridden by an environment
147e83
@@ -131,11 +121,6 @@ hesiod_init(void **context) {
147e83
 		goto cleanup;
147e83
 	}
147e83
 
147e83
-#if 0
147e83
-	if (res_ninit(ctx->res) < 0)
147e83
-		goto cleanup;
147e83
-#endif
147e83
-
147e83
 	*context = ctx;
147e83
 	return (0);
147e83
 
147e83
@@ -152,12 +137,8 @@ hesiod_end(void *context) {
147e83
 	struct hesiod_p *ctx = (struct hesiod_p *) context;
147e83
 	int save_errno = errno;
147e83
 
147e83
-	if (ctx->res)
147e83
-		res_nclose(ctx->res);
147e83
 	free(ctx->RHS);
147e83
 	free(ctx->LHS);
147e83
-	if (ctx->res && ctx->free_res)
147e83
-		(*ctx->free_res)(ctx->res);
147e83
 	free(ctx);
147e83
 	__set_errno(save_errno);
147e83
 }
147e83
@@ -232,10 +213,6 @@ hesiod_resolve(void *context, const char *name, const char *type) {
147e83
 
147e83
 	if (bindname == NULL)
147e83
 		return (NULL);
147e83
-	if (init(ctx) == -1) {
147e83
-		free(bindname);
147e83
-		return (NULL);
147e83
-	}
147e83
 
147e83
 	retvec = get_txt_records(ctx, ctx->classes[0], bindname);
147e83
 
147e83
@@ -365,13 +342,13 @@ get_txt_records(struct hesiod_p *ctx, int class, const char *name) {
147e83
 	/*
147e83
 	 * Construct the query and send it.
147e83
 	 */
147e83
-	n = res_nmkquery(ctx->res, QUERY, name, class, T_TXT, NULL, 0,
147e83
+	n = res_mkquery(QUERY, name, class, T_TXT, NULL, 0,
147e83
 			 NULL, qbuf, MAX_HESRESP);
147e83
 	if (n < 0) {
147e83
 		__set_errno(EMSGSIZE);
147e83
 		return (NULL);
147e83
 	}
147e83
-	n = res_nsend(ctx->res, qbuf, n, abuf, MAX_HESRESP);
147e83
+	n = res_send(qbuf, n, abuf, MAX_HESRESP);
147e83
 	if (n < 0) {
147e83
 		__set_errno(ECONNREFUSED);
147e83
 		return (NULL);
147e83
@@ -421,7 +398,7 @@ get_txt_records(struct hesiod_p *ctx, int class, const char *name) {
147e83
 		cp += INT16SZ + INT32SZ;	/* skip the ttl, too */
147e83
 		rr.dlen = ns_get16(cp);
147e83
 		cp += INT16SZ;
147e83
-		if (cp + rr.dlen > eom) {
147e83
+		if (rr.dlen == 0 || cp + rr.dlen > eom) {
147e83
 			__set_errno(EMSGSIZE);
147e83
 			goto cleanup;
147e83
 		}
147e83
@@ -464,44 +441,3 @@ get_txt_records(struct hesiod_p *ctx, int class, const char *name) {
147e83
 	free(list);
147e83
 	return (NULL);
147e83
 }
147e83
-
147e83
-struct __res_state *
147e83
-__hesiod_res_get(void *context) {
147e83
-	struct hesiod_p *ctx = context;
147e83
-
147e83
-	if (!ctx->res) {
147e83
-		struct __res_state *res;
147e83
-		res = (struct __res_state *)calloc(1, sizeof *res);
147e83
-		if (res == NULL)
147e83
-			return (NULL);
147e83
-		__hesiod_res_set(ctx, res, free);
147e83
-	}
147e83
-
147e83
-	return (ctx->res);
147e83
-}
147e83
-
147e83
-void
147e83
-__hesiod_res_set(void *context, struct __res_state *res,
147e83
-		 void (*free_res)(void *)) {
147e83
-	struct hesiod_p *ctx = context;
147e83
-
147e83
-	if (ctx->res && ctx->free_res) {
147e83
-		res_nclose(ctx->res);
147e83
-		(*ctx->free_res)(ctx->res);
147e83
-	}
147e83
-
147e83
-	ctx->res = res;
147e83
-	ctx->free_res = free_res;
147e83
-}
147e83
-
147e83
-static int
147e83
-init(struct hesiod_p *ctx) {
147e83
-
147e83
-	if (!ctx->res && !__hesiod_res_get(ctx))
147e83
-		return (-1);
147e83
-
147e83
-	if (__res_maybe_init (ctx->res, 0) == -1)
147e83
-		return (-1);
147e83
-
147e83
-	return (0);
147e83
-}
147e83
diff --git a/hesiod/hesiod.h b/hesiod/hesiod.h
147e83
index 82fce30764e15071..2cb640a7df668cab 100644
147e83
--- a/hesiod/hesiod.h
147e83
+++ b/hesiod/hesiod.h
147e83
@@ -1,3 +1,20 @@
147e83
+/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
147e83
+   This file is part of the GNU C Library.
147e83
+
147e83
+   The GNU C Library is free software; you can redistribute it and/or
147e83
+   modify it under the terms of the GNU Lesser General Public
147e83
+   License as published by the Free Software Foundation; either
147e83
+   version 2.1 of the License, or (at your option) any later version.
147e83
+
147e83
+   The GNU C Library is distributed in the hope that it will be useful,
147e83
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
+   Lesser General Public License for more details.
147e83
+
147e83
+   You should have received a copy of the GNU Lesser General Public
147e83
+   License along with the GNU C Library; if not, see
147e83
+   <http://www.gnu.org/licenses/>.  */
147e83
+
147e83
 /*
147e83
  * Copyright (c) 1996,1999 by Internet Software Consortium.
147e83
  *
147e83
@@ -19,22 +36,15 @@
147e83
  * This file is primarily maintained by <tytso@mit.edu> and <ghudson@mit.edu>.
147e83
  */
147e83
 
147e83
-/*
147e83
- * $BINDId: hesiod.h,v 1.7 1999/01/08 19:22:45 vixie Exp $
147e83
- */
147e83
-
147e83
 #ifndef _HESIOD_H_INCLUDED
147e83
 #define _HESIOD_H_INCLUDED
147e83
 
147e83
-int		hesiod_init (void **context);
147e83
-void		hesiod_end (void *context);
147e83
+int		hesiod_init (void **context) attribute_hidden;
147e83
+void		hesiod_end (void *context) attribute_hidden;
147e83
 char *		hesiod_to_bind (void *context, const char *name,
147e83
-				const char *type);
147e83
+				const char *type) attribute_hidden;
147e83
 char **		hesiod_resolve (void *context, const char *name,
147e83
-				const char *type);
147e83
-void		hesiod_free_list (void *context, char **list);
147e83
-struct __res_state * __hesiod_res_get (void *context);
147e83
-void		__hesiod_res_set (void *context, struct __res_state *,
147e83
-				  void (*)(void *));
147e83
+				const char *type) attribute_hidden;
147e83
+void		hesiod_free_list (void *context, char **list) attribute_hidden;
147e83
 
147e83
 #endif /*_HESIOD_H_INCLUDED*/
147e83
diff --git a/hesiod/hesiod_p.h b/hesiod/hesiod_p.h
147e83
index 5010d71bc91879c4..7ed70158d9ffc5cc 100644
147e83
--- a/hesiod/hesiod_p.h
147e83
+++ b/hesiod/hesiod_p.h
147e83
@@ -1,3 +1,20 @@
147e83
+/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
147e83
+   This file is part of the GNU C Library.
147e83
+
147e83
+   The GNU C Library is free software; you can redistribute it and/or
147e83
+   modify it under the terms of the GNU Lesser General Public
147e83
+   License as published by the Free Software Foundation; either
147e83
+   version 2.1 of the License, or (at your option) any later version.
147e83
+
147e83
+   The GNU C Library is distributed in the hope that it will be useful,
147e83
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
+   Lesser General Public License for more details.
147e83
+
147e83
+   You should have received a copy of the GNU Lesser General Public
147e83
+   License along with the GNU C Library; if not, see
147e83
+   <http://www.gnu.org/licenses/>.  */
147e83
+
147e83
 /*
147e83
  * Copyright (c) 1996,1999 by Internet Software Consortium.
147e83
  *
147e83
@@ -20,27 +37,17 @@
147e83
  */
147e83
 
147e83
 /*
147e83
- * $BINDId: hesiod_p.h,v 1.9 1999/01/08 19:24:39 vixie Exp $
147e83
- */
147e83
-
147e83
-/*
147e83
  * hesiod_p.h -- private definitions for the hesiod library
147e83
  */
147e83
 
147e83
 #ifndef _HESIOD_P_H_INCLUDED
147e83
 #define _HESIOD_P_H_INCLUDED
147e83
 
147e83
-#define DEF_RHS		".Athena.MIT.EDU"	/* Defaults if HESIOD_CONF */
147e83
 #define DEF_LHS		".ns"			/*    file is not */
147e83
 						/*    present. */
147e83
 struct hesiod_p {
147e83
 	char *		LHS;		/* normally ".ns" */
147e83
 	char *		RHS;		/* AKA the default hesiod domain */
147e83
-	struct __res_state * res;	/* resolver context */
147e83
-	void		(*free_res)(void *);
147e83
-	void		(*res_set)(struct hesiod_p *, struct __res_state *,
147e83
-				   void (*)(void *));
147e83
-	struct __res_state * (*res_get)(struct hesiod_p *);
147e83
 	int		classes[2];	/* The class search order. */
147e83
 };
147e83
 
147e83
diff --git a/hesiod/nss_hesiod/hesiod-grp.c b/hesiod/nss_hesiod/hesiod-grp.c
147e83
index 5c14554ce9fd647e..a04f5309453047e2 100644
147e83
--- a/hesiod/nss_hesiod/hesiod-grp.c
147e83
+++ b/hesiod/nss_hesiod/hesiod-grp.c
147e83
@@ -1,4 +1,4 @@
147e83
-/* Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
147e83
+/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
147e83
    This file is part of the GNU C Library.
147e83
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
147e83
 
147e83
@@ -26,8 +26,6 @@
147e83
 #include <string.h>
147e83
 #include <sys/param.h>
147e83
 
147e83
-#include "nss_hesiod.h"
147e83
-
147e83
 /* Get the declaration of the parser function.  */
147e83
 #define ENTNAME grent
147e83
 #define STRUCTURE group
147e83
@@ -58,8 +56,7 @@ lookup (const char *name, const char *type, struct group *grp,
147e83
   size_t len;
147e83
   int olderr = errno;
147e83
 
147e83
-  context = _nss_hesiod_init ();
147e83
-  if (context == NULL)
147e83
+  if (hesiod_init (&context) < 0)
147e83
     return NSS_STATUS_UNAVAIL;
147e83
 
147e83
   list = hesiod_resolve (context, name, type);
147e83
@@ -179,8 +176,7 @@ _nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
147e83
   gid_t *groups = *groupsp;
147e83
   int save_errno;
147e83
 
147e83
-  context = _nss_hesiod_init ();
147e83
-  if (context == NULL)
147e83
+  if (hesiod_init (&context) < 0)
147e83
     return NSS_STATUS_UNAVAIL;
147e83
 
147e83
   list = hesiod_resolve (context, user, "grplist");
147e83
@@ -191,33 +187,6 @@ _nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
147e83
       return errno == ENOENT ? NSS_STATUS_NOTFOUND : NSS_STATUS_UNAVAIL;
147e83
     }
147e83
 
147e83
-  if (!internal_gid_in_list (groups, group, *start))
147e83
-    {
147e83
-      if (__builtin_expect (*start == *size, 0))
147e83
-	{
147e83
-	  /* Need a bigger buffer.  */
147e83
-	  gid_t *newgroups;
147e83
-	  long int newsize;
147e83
-
147e83
-	  if (limit > 0 && *size == limit)
147e83
-	    /* We reached the maximum.  */
147e83
-	    goto done;
147e83
-
147e83
-	  if (limit <= 0)
147e83
-	    newsize = 2 * *size;
147e83
-	  else
147e83
-	    newsize = MIN (limit, 2 * *size);
147e83
-
147e83
-	  newgroups = realloc (groups, newsize * sizeof (*groups));
147e83
-	  if (newgroups == NULL)
147e83
-	    goto done;
147e83
-	  *groupsp = groups = newgroups;
147e83
-	  *size = newsize;
147e83
-	}
147e83
-
147e83
-      groups[(*start)++] = group;
147e83
-    }
147e83
-
147e83
   save_errno = errno;
147e83
 
147e83
   p = *list;
147e83
@@ -254,7 +223,7 @@ _nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
147e83
 	  if (status == NSS_STATUS_SUCCESS
147e83
 	      && !internal_gid_in_list (groups, group, *start))
147e83
 	    {
147e83
-	      if (__builtin_expect (*start == *size, 0))
147e83
+	      if (__glibc_unlikely (*start == *size))
147e83
 		{
147e83
 		  /* Need a bigger buffer.  */
147e83
 		  gid_t *newgroups;
147e83
diff --git a/hesiod/nss_hesiod/hesiod-init.c b/hesiod/nss_hesiod/hesiod-init.c
147e83
deleted file mode 100644
147e83
index 964987d0755425b5..0000000000000000
147e83
--- a/hesiod/nss_hesiod/hesiod-init.c
147e83
+++ /dev/null
147e83
@@ -1,38 +0,0 @@
147e83
-/* Copyright (C) 2000 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 2000.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library; if not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-#include <sys/cdefs.h>		/* Needs to come before <hesiod.h>.  */
147e83
-#include <hesiod.h>
147e83
-#include <resolv.h>
147e83
-#include <stddef.h>
147e83
-
147e83
-#include "nss_hesiod.h"
147e83
-
147e83
-void *
147e83
-_nss_hesiod_init (void)
147e83
-{
147e83
-  void *context;
147e83
-
147e83
-  if (hesiod_init (&context) == -1)
147e83
-    return NULL;
147e83
-
147e83
-  /* Use the default (per-thread) resolver state.  */
147e83
-  __hesiod_res_set (context, &_res, NULL);
147e83
-
147e83
-  return context;
147e83
-}
147e83
diff --git a/hesiod/nss_hesiod/hesiod-proto.c b/hesiod/nss_hesiod/hesiod-proto.c
147e83
index 7ea38bc24fbff3ca..6af32aad35edfc0a 100644
147e83
--- a/hesiod/nss_hesiod/hesiod-proto.c
147e83
+++ b/hesiod/nss_hesiod/hesiod-proto.c
147e83
@@ -1,4 +1,4 @@
147e83
-/* Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
147e83
+/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
147e83
    This file is part of the GNU C Library.
147e83
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
147e83
 
147e83
@@ -25,8 +25,6 @@
147e83
 #include <stdlib.h>
147e83
 #include <string.h>
147e83
 
147e83
-#include "nss_hesiod.h"
147e83
-
147e83
 /* Declare a parser for Hesiod protocol entries.  Although the format
147e83
    of the entries is identical to those in /etc/protocols, here is no
147e83
    predefined parser for us to use.  */
147e83
@@ -68,8 +66,7 @@ lookup (const char *name, const char *type, struct protoent *proto,
147e83
   int found;
147e83
   int olderr = errno;
147e83
 
147e83
-  context = _nss_hesiod_init ();
147e83
-  if (context == NULL)
147e83
+  if (hesiod_init (&context) < 0)
147e83
     return NSS_STATUS_UNAVAIL;
147e83
 
147e83
   list = hesiod_resolve (context, name, type);
147e83
diff --git a/hesiod/nss_hesiod/hesiod-pwd.c b/hesiod/nss_hesiod/hesiod-pwd.c
147e83
index 929cbce80e238a67..8309af245d3f0268 100644
147e83
--- a/hesiod/nss_hesiod/hesiod-pwd.c
147e83
+++ b/hesiod/nss_hesiod/hesiod-pwd.c
147e83
@@ -1,4 +1,4 @@
147e83
-/* Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
147e83
+/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
147e83
    This file is part of the GNU C Library.
147e83
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
147e83
 
147e83
@@ -24,8 +24,6 @@
147e83
 #include <stdlib.h>
147e83
 #include <string.h>
147e83
 
147e83
-#include "nss_hesiod.h"
147e83
-
147e83
 /* Get the declaration of the parser function.  */
147e83
 #define ENTNAME pwent
147e83
 #define STRUCTURE passwd
147e83
@@ -56,8 +54,7 @@ lookup (const char *name, const char *type, struct passwd *pwd,
147e83
   size_t len;
147e83
   int olderr = errno;
147e83
 
147e83
-  context = _nss_hesiod_init ();
147e83
-  if (context == NULL)
147e83
+  if (hesiod_init (&context) < 0)
147e83
     return NSS_STATUS_UNAVAIL;
147e83
 
147e83
   list = hesiod_resolve (context, name, type);
147e83
diff --git a/hesiod/nss_hesiod/hesiod-service.c b/hesiod/nss_hesiod/hesiod-service.c
147e83
index 28bd31a70f31c89c..1942188517d94508 100644
147e83
--- a/hesiod/nss_hesiod/hesiod-service.c
147e83
+++ b/hesiod/nss_hesiod/hesiod-service.c
147e83
@@ -1,4 +1,4 @@
147e83
-/* Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
147e83
+/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
147e83
    This file is part of the GNU C Library.
147e83
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
147e83
 
147e83
@@ -25,8 +25,6 @@
147e83
 #include <stdlib.h>
147e83
 #include <string.h>
147e83
 
147e83
-#include "nss_hesiod.h"
147e83
-
147e83
 /* Hesiod uses a format for service entries that differs from the
147e83
    traditional format.  We therefore declare our own parser.  */
147e83
 
147e83
@@ -69,8 +67,7 @@ lookup (const char *name, const char *type, const char *protocol,
147e83
   int found;
147e83
   int olderr = errno;
147e83
 
147e83
-  context = _nss_hesiod_init ();
147e83
-  if (context == NULL)
147e83
+  if (hesiod_init (&context) < 0)
147e83
     return NSS_STATUS_UNAVAIL;
147e83
 
147e83
   list = hesiod_resolve (context, name, type);
147e83
diff --git a/hesiod/nss_hesiod/nss_hesiod.h b/hesiod/nss_hesiod/nss_hesiod.h
147e83
deleted file mode 100644
147e83
index fdf0241860b7e825..0000000000000000
147e83
--- a/hesiod/nss_hesiod/nss_hesiod.h
147e83
+++ /dev/null
147e83
@@ -1,20 +0,0 @@
147e83
-/* Copyright (C) 2000 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 2000.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library; if not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-/* Initialize a Hesiod context.  */
147e83
-extern void *_nss_hesiod_init (void);