Date: Sun, 18 Jun 2006 14:34:49 GMT From: Michael Bushkov <bushman@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99525 for review Message-ID: <200606181434.k5IEYnSp020461@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99525 Change 99525 by bushman@bushman_nss_ldap_cached on 2006/06/18 14:33:56 nss_files module now properly support "networks" source Affected files ... .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_files/files_net.c#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_files/files_net.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_files/nss_files.c#5 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_files/nss_files.h#3 edit Differences ... ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_files/files_net.c#2 (text+ko) ==== @@ -56,9 +56,31 @@ #include <stdarg.h> #include <nsswitch.h> #include "netdb_private.h" +#include "reentrant.h" +#include "copynetent.h" +#include "nss_files.h" + +static void _setnethtent(int, struct files_netent_data *); +static void _endnethtent(struct files_netent_data *); +static int getnetent_p(struct netent *, struct files_netent_data *); +static void files_netent_data_free(void *); + +NETDB_THREAD_ALLOC(files_netent_data) + +static void +files_netent_data_free(void *ptr) +{ + struct files_netent_data *ned = ptr; + + if (ned == NULL) + return; + ned->stayopen = 0; + _endnethtent(ned); + free(ned); +} static void -_setnethtent(int f, struct netent_data *ned) +_setnethtent(int f, struct files_netent_data *ned) { if (ned->netf == NULL) @@ -69,7 +91,7 @@ } static void -_endnethtent(struct netent_data *ned) +_endnethtent(struct files_netent_data *ned) { if (ned->netf) { @@ -80,7 +102,7 @@ } static int -getnetent_p(struct netent *ne, struct netent_data *ned) +getnetent_p(struct netent *ne, struct files_netent_data *ned) { char *p, *bp, *ep; char *cp, **q; @@ -153,7 +175,7 @@ size_t buflen; int *errnop, *h_errnop; - struct netent_data *ned; + struct files_netent_data *ned; struct netent ne, *nptr; res_state statp; int error; @@ -165,7 +187,7 @@ h_errnop = va_arg(ap, int *); statp = __res_state(); - if ((ned = __netent_data_init()) == NULL) { + if ((ned = __files_netent_data_init()) == NULL) { RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; return (NS_UNAVAIL); @@ -183,14 +205,14 @@ int __files_setnetent(void *rval, void *cb_data, va_list ap) { - struct netent_data *ned; + struct files_netent_data *ned; res_state statp; int f; f = va_arg(ap, int); statp = __res_state(); - if ((ned = __netent_data_init()) == NULL) { + if ((ned = __files_netent_data_init()) == NULL) { RES_SET_H_ERRNO(statp, NETDB_INTERNAL); return (NS_UNAVAIL); } @@ -203,11 +225,11 @@ int __files_endnetent(void *rval, void *cb_data, va_list ap) { - struct netent_data *ned; + struct files_netent_data *ned; res_state statp; statp = __res_state(); - if ((ned = __netent_data_init()) == NULL) { + if ((ned = __files_netent_data_init()) == NULL) { RES_SET_H_ERRNO(statp, NETDB_INTERNAL); return (NS_UNAVAIL); } @@ -225,7 +247,7 @@ size_t buflen; int *errnop, *h_errnop; struct netent *nptr, ne; - struct netent_data *ned; + struct files_netent_data *ned; char **cp; res_state statp; int error; @@ -238,7 +260,7 @@ h_errnop = va_arg(ap, int *); statp = __res_state(); - if ((ned = __netent_data_init()) == NULL) { + if ((ned = __files_netent_data_init()) == NULL) { RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; return (NS_UNAVAIL); @@ -276,7 +298,7 @@ size_t buflen; int *errnop, *h_errnop; struct netent *nptr, ne; - struct netent_data *ned; + struct files_netent_data *ned; res_state statp; int error; @@ -289,7 +311,7 @@ h_errnop = va_arg(ap, int *); statp = __res_state(); - if ((ned = __netent_data_init()) == NULL) { + if ((ned = __files_netent_data_init()) == NULL) { RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; return (NS_UNAVAIL); ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_files/files_net.h#2 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_files/nss_files.c#5 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_files/nss_files.h#3 (text+ko) ==== @@ -43,6 +43,9 @@ #ifndef _HOSTBUFSIZE #define _HOSTBUFSIZE (8 * 1024) #endif +#ifndef _NETBUFSIZE +#define _NETBUFSIZE 1025 +#endif struct files_hostent_data { uint32_t host_addr[4]; /* IPv4 or IPv6 */ @@ -52,3 +55,10 @@ FILE *hostf; int stayopen; }; + +struct files_netent_data { + char *net_aliases[_MAXALIASES]; + char netbuf[_NETBUFSIZE]; + FILE *netf; + int stayopen; +};
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606181434.k5IEYnSp020461>