This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RFC: NSS prototypes



Thanks Uli for spotting the extra parameter.  I've fixed this and a
number of other problems now.

But I need some comments on a few other topics:

nis/nss_nis/nis-netgrp.c uses:
enum nss_status
_nss_nis_setnetgrent (const char *group)

but nss/nss_files/files-netgrp.c has:
enum nss_status
_nss_files_setnetgrent (const char *group, struct __netgrent *result)

Which one is right?  AFAIK these should be exactly the same, shouldn't
they?

nis/nss_nis/nis-network.c was using herrnop in a number of place, I
removed them (see appended patch).  Is the patch ok?

FYI I'm appending also my current patch for include/netdb.h - I've
fixed already a number of smaller problems in the nss files.  I'll
send the complete patch later,

Andreas

============================================================
Index: nis/nss_nis/nis-network.c
--- nis/nss_nis/nis-network.c	2000/04/01 22:26:20	1.12
+++ nis/nss_nis/nis-network.c	2000/12/18 09:15:44
@@ -43,7 +43,7 @@
 static int oldkeylen = 0;
 
 enum nss_status
-_nss_nis_setnetent (void)
+_nss_nis_setnetent (int stayopen)
 {
   __libc_lock_lock (lock);
 
@@ -80,7 +80,7 @@
 
 static enum nss_status
 internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
-			  int *errnop, int *herrnop)
+			  int *errnop)
 {
   struct parser_data *data = (void *) buffer;
   char *domain, *result, *outkey;
@@ -108,10 +108,7 @@
 	  if (retval == NSS_STATUS_NOTFOUND)
 	    *errnop = ENOENT;
           else if (retval == NSS_STATUS_TRYAGAIN)
-	    {
-	      *herrnop = NETDB_INTERNAL;
-	      *errnop = errno;
-	    }
+	    *errnop = errno;
           return retval;
         }
 
@@ -119,7 +116,6 @@
         {
           free (result);
 	  *errnop = ERANGE;
-	  *herrnop = NETDB_INTERNAL;
           return NSS_STATUS_TRYAGAIN;
         }
 
@@ -133,7 +129,6 @@
       if (parse_res == -1)
 	{
 	  free (outkey);
-	  *herrnop = NETDB_INTERNAL;
 	  *errnop = ERANGE;
 	  return NSS_STATUS_TRYAGAIN;
 	}
@@ -150,13 +145,13 @@
 
 enum nss_status
 _nss_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
-		      int *errnop, int *herrnop)
+		      int *errnop)
 {
   enum nss_status status;
 
   __libc_lock_lock (lock);
 
-  status = internal_nis_getnetent_r (net, buffer, buflen, errnop, herrnop);
+  status = internal_nis_getnetent_r (net, buffer, buflen, errnop);
 
   __libc_lock_unlock (lock);
 
@@ -165,7 +160,7 @@
 
 enum nss_status
 _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
-			 size_t buflen, int *errnop, int *herrnop)
+			 size_t buflen, int *errnop)
 {
   enum nss_status retval;
   struct parser_data *data = (void *) buffer;
@@ -175,7 +170,6 @@
   if (name == NULL)
     {
       *errnop = EINVAL;
-      *herrnop = NETDB_INTERNAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -184,7 +178,6 @@
 
   if (buflen < sizeof *data + 1)
     {
-      *herrnop = NETDB_INTERNAL;
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
@@ -209,10 +202,8 @@
       if (retval == NSS_STATUS_NOTFOUND)
 	*errnop = ENOENT;
       else if (retval == NSS_STATUS_TRYAGAIN)
-	{
-	  *errnop = errno;
-	  *herrnop = NETDB_INTERNAL;
-	}
+	*errnop = errno;
+
       return retval;
     }
 
@@ -220,7 +211,6 @@
     {
       free (result);
       *errnop = ERANGE;
-      *herrnop = NETDB_INTERNAL;
       return NSS_STATUS_TRYAGAIN;
     }
 
@@ -234,7 +224,6 @@
 
   if (parse_res < 1)
     {
-      *herrnop = NETDB_INTERNAL;
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
@@ -249,8 +238,7 @@
 
 enum nss_status
 _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
-			 char *buffer, size_t buflen, int *errnop,
-			 int *herrnop)
+			 char *buffer, size_t buflen, int *errnop)
 {
   struct parser_data *data = (void *) buffer;
   char *domain;
@@ -306,7 +294,6 @@
 	{
 	  free (result);
 	  *errnop = ERANGE;
-	  *herrnop = NETDB_INTERNAL;
 	  return NSS_STATUS_TRYAGAIN;
 	}
 
@@ -320,7 +307,6 @@
 
 	if (parse_res < 1)
 	  {
-	    *herrnop = NETDB_INTERNAL;
 	    if (parse_res == -1)
 	      return NSS_STATUS_TRYAGAIN;
 	    else
============================================================
Index: include/netdb.h
--- include/netdb.h	2000/11/26 09:43:11	1.11
+++ include/netdb.h	2000/12/18 09:15:47
@@ -143,10 +143,84 @@
 /* The following declarations and definitions have been removed from
    the public header since we don't want people to use them.  */
 
-#define AI_V4MAPPED	0x0008  /* IPv4-mapped addresses are acceptable.  */
-#define AI_ALL		0x0010  /* Return both IPv4 and IPv6 addresses.  */
-#define AI_ADDRCONFIG	0x0020  /* Use configuration of this host to choose
-                                  returned address type.  */
+#define AI_V4MAPPED	0x0008	/* IPv4-mapped addresses are acceptable.  */
+#define AI_ALL		0x0010	/* Return both IPv4 and IPv6 addresses.	 */
+#define AI_ADDRCONFIG	0x0020	/* Use configuration of this host to choose
+				  returned address type.  */
 #define AI_DEFAULT    (AI_V4MAPPED | AI_ADDRCONFIG)
+
+#include <inet/netgroup.h>
+
+#define DECLARE_NSS_PROTOTYPES(service)						\
+extern enum nss_status _nss_ ## service ## _setprotoent (int);			\
+extern enum nss_status _nss_ ## service ## _endprotoent (void);			\
+extern enum nss_status _nss_ ## service ## _getprotoent_r			\
+		       (struct protoent *proto, char *buffer, size_t buflen,	\
+			int *errnop);						\
+extern enum nss_status _nss_ ## service ## _getprotobyname_r			\
+		       (const char *name, struct protoent *proto,		\
+			char *buffer, size_t buflen, int *errnop);		\
+extern enum nss_status _nss_ ## service ## _getprotobynumber_r			\
+		       (int number, struct protoent *proto,			\
+			char *buffer, size_t buflen, int *errnop);		\
+extern enum nss_status _nss_ ## service ## _sethostent (int);			\
+extern enum nss_status _nss_ ## service ## _endhostent (void);			\
+extern enum nss_status _nss_ ## service ## _gethostent_r			\
+		       (struct hostent *host, char *buffer, size_t buflen,	\
+			int *errnop, int *h_errnop);				\
+extern enum nss_status _nss_ ## service ## _gethostbyname2_r			\
+		       (const char *name, int af, struct hostent *host,		\
+			char *buffer, size_t buflen, int *errnop,		\
+			int *h_errnop);						\
+extern enum nss_status _nss_ ## service ## _gethostbyname_r			\
+		       (const char *name, struct hostent *host, char *buffer,	\
+			size_t buflen, int *errnop, int *h_errnop);		\
+extern enum nss_status _nss_ ## service ## _gethostbyaddr_r			\
+		       (const void *addr, socklen_t addrlen, int af,		\
+			struct hostent *host, char *buffer, size_t buflen,	\
+			int *errnop, int *h_errnop);				\
+extern enum nss_status _nss_ ## service ## _setservent (int);			\
+extern enum nss_status _nss_ ## service ## _endservent (void);			\
+extern enum nss_status _nss_ ## service ## _getservent_r			\
+		       (struct servent *serv, char *buffer, size_t buflen,	\
+			int *errnop);						\
+extern enum nss_status _nss_ ## service ## _getservbyname_r			\
+		       (const char *name, const char *protocol,			\
+			struct servent *serv, char *buffer, size_t buflen,	\
+			int *errnop);						\
+extern enum nss_status _nss_ ## service ## _getservbyport_r			\
+		       (int port, const char *protocol, struct servent *serv,	\
+			char *buffer, size_t buflen, int *errnop);		\
+extern enum nss_status _nss_ ## service ## _setnetgrent				\
+                       (const char *group, struct __netgrent *result);		\
+extern enum nss_status _nss_ ## service ## _endnetgrent				\
+		       (struct __netgrent *result);				\
+extern enum nss_status _nss_ ## service ##_getnetgrent_r			\
+		       (struct __netgrent *result, char *buffer, size_t buflen,	\
+			int *errnop);						\
+extern enum nss_status _nss_## service ##_setnetent (int stayopen);		\
+extern enum nss_status _nss_ ## service ## _endnetent (void);			\
+extern enum nss_status _nss_## service ##_getnetent_r				\
+			(struct netent *net, char *buffer, size_t buflen,	\
+			 int *errnop);						\
+extern enum nss_status _nss_## service ##_getnetbyname_r			\
+			(const char *name, struct netent *net, char *buffer,	\
+			 size_t buflen, int *errnop);				\
+extern enum nss_status _nss_## service ##_getnetbyaddr_r			\
+		       (uint32_t addr, int type, struct netent *net,		\
+			char *buffer, size_t buflen, int *errnop);
+
+
+
+
+
+
+
+DECLARE_NSS_PROTOTYPES (nis)
+DECLARE_NSS_PROTOTYPES (nisplus)
+DECLARE_NSS_PROTOTYPES (hesiod)
+DECLARE_NSS_PROTOTYPES (files)
+
+#undef DECLARE_NSS_PROTOTYPES
 
 #endif /* !_NETDB_H */


-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]