bzero (&entry, sizeof (entry));
__bzero (&entry, sizeof (entry));
weak_alias (__getnetgrent_r, getnetgrent_r)/* Test whether given (host,user,domain) triple is in NETGROUP.  */intinnetgr (const char *netgroup, const char *host, const char *user,	 const char *domain){  int (*setfct) (const char *, struct __netgrent *);  void (*endfct) (struct __netgrent *);  int (*getfct) (struct __netgrent *, char *, size_t);  struct name_list *known = NULL;  struct name_list *needed = NULL;  int result = 0;  int no_more;  const char *current_group = netgroup;  int real_entry = 0;  /* Walk through the services until we found an answer or we shall     not work further.  We can do some optimization here.  Since all     services must provide the `setnetgrent' function we can do all     the work during one walk through the service list.  */  while (1)    {      no_more = setup ((void **) &setfct, "setnetgrent", 1);      while (! no_more)	{	  enum nss_status status;	  struct __netgrent entry;	  /* Clear the space for the netgroup data.  */	  bzero (&entry, sizeof (entry));	  /* Open netgroup.  */	  status = (*setfct) (current_group, &entry);	  if (status == NSS_STATUS_SUCCESS	      && __nss_lookup (&nip, "getnetgrent_r", (void **) &getfct) == 0)	    {	      char buffer[1024];	      while ((*getfct) (&entry, buffer, sizeof buffer)		     == NSS_STATUS_SUCCESS)		{		  if (entry.type == group_val)		    {		      /* Make sure we haven't seen the name before.  */		      struct name_list *namep;		      for (namep = known; namep != NULL; namep = namep->next)			if (strcmp (entry.val.group, namep->name) == 0)			  break;		      if (namep == NULL			  && strcmp (netgroup, entry.val.group) != 0)			{			  namep =			    (struct name_list *) malloc (sizeof (*namep));			  if (namep == NULL			      || ((namep->name = __strdup (entry.val.group))				  == NULL))			    {			      /* Out of memory, simply return.  */			      if (namep != NULL)				free (namep);			      result = -1;			      break;			    }			  namep->next = needed;			  needed = namep;			}		    }		  else		    {		      real_entry = 1;		      if ((entry.val.triple.host == NULL || host == NULL			   || strcmp (entry.val.triple.host, host) == 0)			  && (entry.val.triple.user == NULL || user == NULL			      || strcmp (entry.val.triple.user, user) == 0)			  && (entry.val.triple.domain == NULL || domain == NULL			      || strcmp (entry.val.triple.domain, domain) == 0))			{			  result = 1;			  break;			}		    }		}	      if (result != 0)		break;	      /* If we found one service which does know the given		 netgroup we don't try further.  */	      status = NSS_STATUS_RETURN;	    }	  /* Free all resources of the service.  */	  if (__nss_lookup (&nip, "endnetgrent", (void **) &endfct) == 0)	    (*endfct) (&entry);	  /* Look for the next service.  */	  no_more = __nss_next (&nip, "setnetgrent",				(void **) &setfct, status, 0);	}      if (result == 0 && needed != NULL)	{	  struct name_list *tmp = needed;	  needed = tmp->next;	  tmp->next = known;	  known = tmp;	  current_group = known->name;	  continue;	}      /* No way out.  */      break;    }  /* Free the memory.  */  while (known != NULL)    {      struct name_list *tmp = known;      known = known->next;      free ((void *) tmp->name);      free (tmp);    }  while (needed != NULL)    {      struct name_list *tmp = needed;      needed = needed->next;      free ((void *) tmp->name);      free (tmp);    }  return result == 1;}