PERFORCE change 96060 for review
soc-bushman
soc-bushman at FreeBSD.org
Tue Apr 25 13:32:54 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=96060
Change 96060 by soc-bushman at soc-bushman_stinger on 2006/04/25 13:32:06
several small fixes to make this code committable
Affected files ...
.. //depot/projects/soc2005/nsswitch_cached/src/etc/rc.d/cached#2 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/gen/getgrent.c#9 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/gen/getpwent.c#12 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/Makefile.inc#8 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getaddrinfo.c#13 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/gethostnamadr.c#11 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getnetnamadr.c#4 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getproto.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getprotoent.c#11 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getprotoname.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/name6.c#11 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/nsdispatch.c#17 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/rpc/getrpcent.c#11 edit
.. //depot/projects/soc2005/nsswitch_cached/src/usr.sbin/cached/agents/Makefile.inc#2 edit
.. //depot/projects/soc2005/nsswitch_cached/src/usr.sbin/cached/agents/hosts.c#2 delete
.. //depot/projects/soc2005/nsswitch_cached/src/usr.sbin/cached/agents/hosts.h#2 delete
.. //depot/projects/soc2005/nsswitch_cached/src/usr.sbin/cached/cached.c#3 edit
Differences ...
==== //depot/projects/soc2005/nsswitch_cached/src/etc/rc.d/cached#2 (text+ko) ====
@@ -4,9 +4,8 @@
#
# PROVIDE: cached
-# REQUIRE: mountcritlocal
+# REQUIRE: DAEMON
# BEFORE: LOGIN
-# KEYWORD: FreeBSD
#
# Add the following lines to /etc/rc.conf to enable cached:
@@ -29,4 +28,3 @@
load_rc_config $name
run_rc_command "$1"
-
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/gen/getgrent.c#9 (text+ko) ====
@@ -57,7 +57,9 @@
#include "un-namespace.h"
#include "libc_private.h"
#include "nss_tls.h"
+#ifdef NS_CACHING
#include "nscache.h"
+#endif
enum constants {
GRP_STORAGE_INITIAL = 1 << 10, /* 1 KByte */
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/gen/getpwent.c#12 (text+ko) ====
@@ -61,7 +61,9 @@
#include "libc_private.h"
#include "pw_scan.h"
#include "nss_tls.h"
+#ifdef NS_CACHING
#include "nscache.h"
+#endif
#ifndef CTASSERT
#define CTASSERT(x) _CTASSERT(x, __LINE__)
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/Makefile.inc#8 (text+ko) ====
@@ -13,10 +13,13 @@
getservbyport.c getservent.c \
if_indextoname.c if_nameindex.c if_nametoindex.c \
ip6opt.c linkaddr.c map_v4v6.c name6.c \
- nscache.c nscachedcli.c nsdispatch.c nslexer.c\
- nsparser.c nss_compat.c \
+ nsdispatch.c nslexer.c nsparser.c nss_compat.c \
rcmd.c rcmdsh.c recv.c rthdr.c send.c sockatmark.c vars.c
+.if !defined(NO_NS_CACHING)
+SRCS+= nscache.c nscachedcli.c
+.endif
+
# for binary backward compatibility against FreeBSD 6.X and earlier
SRCS+= res_mkupdate.c res_update.c
@@ -121,4 +124,3 @@
SRCS+= hesiod.c
MAN+= hesiod.3
.endif
-
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getaddrinfo.c#13 (text+ko) ====
@@ -103,7 +103,9 @@
#include <nsswitch.h>
#include "un-namespace.h"
#include "libc_private.h"
+#ifdef NS_CACHING
#include "nscache.h"
+#endif
#if defined(__KAME__) && defined(INET6)
# define FAITH
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/gethostnamadr.c#11 (text+ko) ====
@@ -44,7 +44,9 @@
#include <resolv.h> /* XXX hack for _res */
#include "un-namespace.h"
#include "netdb_private.h"
+#ifdef NS_CACHING
#include "nscache.h"
+#endif
extern int _ht_gethostbyname(void *, void *, va_list);
extern int _dns_gethostbyname(void *, void *, va_list);
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getnetnamadr.c#4 (text+ko) ====
@@ -42,6 +42,9 @@
#include <nsswitch.h>
#include "un-namespace.h"
#include "netdb_private.h"
+#ifdef NS_CACHING
+#include "nscache.h"
+#endif
extern int _ht_getnetbyname(void *, void *, va_list);
extern int _dns_getnetbyname(void *, void *, va_list);
@@ -60,6 +63,220 @@
NETDB_THREAD_ALLOC(netent_data)
NETDB_THREAD_ALLOC(netdata)
+#ifdef NS_CACHING
+static int
+net_id_func(char *buffer, size_t *buffer_size, va_list ap, void *cache_mdata)
+{
+ char *name;
+ uint32_t net;
+ int type;
+
+ size_t desired_size, size;
+ enum nss_lookup_type lookup_type;
+ int res = NS_UNAVAIL;
+
+ lookup_type = (enum nss_lookup_type)cache_mdata;
+ switch (lookup_type) {
+ case nss_lt_name:
+ name = va_arg(ap, char *);
+
+ size = strlen(name);
+ desired_size = sizeof(enum nss_lookup_type) + size + 1;
+ if (desired_size > *buffer_size) {
+ res = NS_RETURN;
+ goto fin;
+ }
+
+ memcpy(buffer, &lookup_type, sizeof(enum nss_lookup_type));
+ memcpy(buffer + sizeof(enum nss_lookup_type), name, size + 1);
+
+ res = NS_SUCCESS;
+ break;
+ case nss_lt_id:
+ net = va_arg(ap, uint32_t);
+ type = va_arg(ap, int);
+
+ desired_size = sizeof(enum nss_lookup_type) + sizeof(uint32_t) +
+ sizeof(int);
+ if (desired_size > *buffer_size) {
+ res = NS_RETURN;
+ goto fin;
+ }
+
+ memcpy(buffer, &lookup_type, sizeof(enum nss_lookup_type));
+ memcpy(buffer + sizeof(enum nss_lookup_type), &net,
+ sizeof(uint32_t));
+ memcpy(buffer + sizeof(enum nss_lookup_type) + sizeof(uint32_t),
+ &type, sizeof(int));
+
+ res = NS_SUCCESS;
+ break;
+ default:
+ /* should be unreachable */
+ return (NS_UNAVAIL);
+ }
+
+fin:
+ *buffer_size = desired_size;
+ return (res);
+}
+
+
+static int
+net_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
+ void *cache_mdata)
+{
+ char *name;
+ uint32_t net;
+ int type;
+ struct netent *ne;
+ char *orig_buf;
+ size_t orig_buf_size;
+
+ struct netent new_ne;
+ size_t desired_size, size, aliases_size;
+ char *p;
+ char **alias;
+
+ switch ((enum nss_lookup_type)cache_mdata) {
+ case nss_lt_name:
+ name = va_arg(ap, char *);
+ break;
+ case nss_lt_id:
+ net = va_arg(ap, uint32_t);
+ type = va_arg(ap, int);
+ break;
+ case nss_lt_all:
+ break;
+ default:
+ /* should be unreachable */
+ return (NS_UNAVAIL);
+ }
+
+ ne = va_arg(ap, struct netent *);
+ orig_buf = va_arg(ap, char *);
+ orig_buf_size = va_arg(ap, size_t);
+
+ desired_size = _ALIGNBYTES + sizeof(struct netent) + sizeof(char *);
+ if (ne->n_name != NULL)
+ desired_size += strlen(proto->n_name) + 1;
+
+ if (ne->n_aliases != NULL) {
+ aliases_size = 0;
+ for (alias = ne->n_aliases; *alias; ++alias) {
+ desired_size += strlen(*alias) + 1;
+ ++aliases_size;
+ }
+
+ desired_size += _ALIGNBYTES + (aliases_size + 1) *
+ sizeof(char *);
+ }
+
+ if (*buffer_size < desired_size) {
+ /* this assignment is here for future use */
+ *buffer_size = desired_size;
+ return (NS_RETURN);
+ }
+
+ memcpy(&new_ne, ne, sizeof(struct netent));
+
+ *buffer_size = desired_size;
+ memset(buffer, 0, desired_size);
+ p = buffer + sizeof(struct netent) + sizeof(char *);
+ memcpy(buffer + sizeof(struct netent), &p, sizeof(char *));
+ p = (char *)_ALIGN(p);
+
+ if (new_ne.n_name != NULL) {
+ size = strlen(new_ne.n_name);
+ memcpy(p, new_ne.n_name, size);
+ new_ne.n_name = p;
+ p += size + 1;
+ }
+
+ if (new_proto.p_aliases != NULL) {
+ p = (char *)_ALIGN(p);
+ memcpy(p, new_proto.p_aliases, sizeof(char *) * aliases_size);
+ new_proto.p_aliases = (char **)p;
+ p += sizeof(char *) * (aliases_size + 1);
+
+ for (alias = new_proto.p_aliases; *alias; ++alias) {
+ size = strlen(*alias);
+ memcpy(p, *alias, size);
+ *alias = p;
+ p += size + 1;
+ }
+ }
+
+ memcpy(buffer, &new_ne, sizeof(struct netent));
+ return (NS_SUCCESS);
+}
+
+static int
+proto_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
+ void *cache_mdata)
+{
+ char *name;
+ uint32_t net;
+ int type;
+ struct netent *ne;
+ char *orig_buf;
+ size_t orig_buf_size;
+ int *ret_errno;
+
+ char *p;
+ char **alias;
+
+ switch ((enum nss_lookup_type)cache_mdata) {
+ case nss_lt_name:
+ name = va_arg(ap, char *);
+ break;
+ case nss_lt_id:
+ net = va_arg(ap, uint32_t);
+ type = va_arg(ap, int);
+ break;
+ case nss_lt_all:
+ break;
+ default:
+ /* should be unreachable */
+ return (NS_UNAVAIL);
+ }
+
+ ne = va_arg(ap, struct netent *);
+ orig_buf = va_arg(ap, char *);
+ orig_buf_size = va_arg(ap, size_t);
+ ret_errno = va_arg(ap, int *);
+
+ if (orig_buf_size < buffer_size - sizeof(struct netent) -
+ sizeof(char *)) {
+ *ret_errno = ERANGE;
+ return (NS_RETURN);
+ }
+
+ memcpy(ne, buffer, sizeof(struct netent));
+ memcpy(&p, buffer + sizeof(struct netent), sizeof(char *));
+
+ orig_buf = (char *)_ALIGN(orig_buf);
+ memcpy(orig_buf, buffer + sizeof(struct netent) + sizeof(char *) +
+ _ALIGN(p) - (size_t)p,
+ buffer_size - sizeof(struct netent) - sizeof(char *) -
+ _ALIGN(p) + (size_t)p);
+ p = (char *)_ALIGN(p);
+
+ NS_APPLY_OFFSET(ne->n_name, orig_buf, p, char *);
+ if (ne->n_aliases != NULL) {
+ NS_APPLY_OFFSET(ne->n_aliases, orig_buf, p, char **);
+
+ for (alias = ne->n_aliases; *alias; ++alias)
+ NS_APPLY_OFFSET(*alias, orig_buf, p, char *);
+ }
+
+ if (retval != NULL)
+ *((struct netent **)retval) = ne;
+
+ return (NS_SUCCESS);
+}
+#endif /* NS_CACHING */
+
static void
netent_data_free(void *ptr)
{
@@ -128,14 +345,24 @@
getnetbyname_r(const char *name, struct netent *ne, char *buffer,
size_t buflen, struct netent **result, int *h_errorp)
{
- int rval, ret_errno;
-
+#ifdef NS_CACHING
+ static const nss_cache_info cache_info =
+ NS_COMMON_CACHE_INFO_INITIALIZER(
+ networks, (void *)nss_lt_name,
+ net_id_func, net_marshal_func, net_unmarshal_func);
+#endif
+
static const ns_dtab dtab[] = {
NS_FILES_CB(_ht_getnetbyname, NULL)
{ NSSRC_DNS, _dns_getnetbyname, NULL },
NS_NIS_CB(_nis_getnetbyname, NULL) /* force -DHESIOD */
+#ifdef NS_CACHING
+ NS_CACHE_CB(&cache_info)
+#endif
{ 0 }
- };
+ };
+
+ int rval, ret_errno;
rval = _nsdispatch((void *)result, dtab, NSDB_NETWORKS,
"getnetbyname_r", default_src, name, ne, buffer, buflen,
@@ -148,15 +375,25 @@
getnetbyaddr_r(uint32_t addr, int af, struct netent *ne, char *buffer,
size_t buflen, struct netent **result, int *h_errorp)
{
- int rval, ret_errno;
-
+#ifdef NS_CACHING
+ static const nss_cache_info cache_info =
+ NS_COMMON_CACHE_INFO_INITIALIZER(
+ networks, (void *)nss_lt_id,
+ net_id_func, net_marshal_func, net_unmarshal_func);
+#endif
+
static const ns_dtab dtab[] = {
NS_FILES_CB(_ht_getnetbyaddr, NULL)
{ NSSRC_DNS, _dns_getnetbyaddr, NULL },
NS_NIS_CB(_nis_getnetbyaddr, NULL) /* force -DHESIOD */
+#ifdef NS_CACHING
+ NS_CACHE_CB(&cache_info)
+#endif
{ 0 }
};
+ int rval, ret_errno;
+
rval = _nsdispatch((void *)result, dtab, NSDB_NETWORKS,
"getnetbyaddr_r", default_src, addr, af, ne, buffer, buflen,
&ret_errno, h_errorp);
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getproto.c#6 (text+ko) ====
@@ -56,8 +56,8 @@
extern int __proto_unmarshal_func(char *, size_t, void *, va_list, void *);
#endif
-int
-__files_getprotobynumber(void *retval, void *mdata, va_list ap)
+static int
+files_getprotobynumber(void *retval, void *mdata, va_list ap)
{
struct protoent pe;
struct protoent_data *ped;
@@ -111,7 +111,7 @@
#endif
static const ns_dtab dtab[] = {
- { NSSRC_FILES, __files_getprotobynumber, NULL },
+ { NSSRC_FILES, files_getprotobynumber, NULL },
#ifdef NS_CACHING
NS_CACHE_CB(&cache_info)
#endif
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getprotoent.c#11 (text+ko) ====
@@ -411,8 +411,8 @@
return (0);
}
-int
-__files_getprotoent_r(void *retval, void *mdata, va_list ap)
+static int
+files_getprotoent_r(void *retval, void *mdata, va_list ap)
{
struct protoent pe;
struct protoent_data *ped;
@@ -428,7 +428,7 @@
errnop = va_arg(ap, int *);
if ((ped = __protoent_data_init()) == NULL)
- return (-1);
+ return (-1);
if (__getprotoent_p(&pe, ped) != 0) {
*errnop = errno;
@@ -444,8 +444,8 @@
return (NS_SUCCESS);
}
-int
-__files_setprotoent(void *retval, void *mdata, va_list ap)
+static int
+files_setprotoent(void *retval, void *mdata, va_list ap)
{
struct protoent_data *ped;
int f;
@@ -458,8 +458,8 @@
return (NS_UNAVAIL);
}
-int
-__files_endprotoent(void *retval, void *mdata, va_list ap)
+static int
+files_endprotoent(void *retval, void *mdata, va_list ap)
{
struct protoent_data *ped;
@@ -481,7 +481,7 @@
#endif
static const ns_dtab dtab[] = {
- { NSSRC_FILES, __files_getprotoent_r, (void *)nss_lt_all },
+ { NSSRC_FILES, files_getprotoent_r, (void *)nss_lt_all },
#ifdef NS_CACHING
NS_CACHE_CB(&cache_info)
#endif
@@ -512,7 +512,7 @@
#endif
static const ns_dtab dtab[] = {
- { NSSRC_FILES, __files_setprotoent, NULL },
+ { NSSRC_FILES, files_setprotoent, NULL },
#ifdef NS_CACHING
NS_CACHE_CB(&cache_info)
#endif
@@ -533,7 +533,7 @@
#endif
static const ns_dtab dtab[] = {
- { NSSRC_FILES, __files_endprotoent, NULL },
+ { NSSRC_FILES, files_endprotoent, NULL },
#ifdef NS_CACHING
NS_CACHE_CB(&cache_info)
#endif
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getprotoname.c#6 (text+ko) ====
@@ -57,8 +57,8 @@
extern int __proto_unmarshal_func(char *, size_t, void *, va_list, void *);
#endif
-int
-__files_getprotobyname(void *retval, void *mdata, va_list ap)
+static int
+files_getprotobyname(void *retval, void *mdata, va_list ap)
{
struct protoent pe;
struct protoent_data *ped;
@@ -120,7 +120,7 @@
#endif
static const ns_dtab dtab[] = {
- { NSSRC_FILES, __files_getprotobyname, NULL },
+ { NSSRC_FILES, files_getprotobyname, NULL },
#ifdef NS_CACHING
NS_CACHE_CB(&cache_info)
#endif
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/name6.c#11 (text+ko) ====
@@ -123,7 +123,9 @@
#include "netdb_private.h"
#include "res_config.h"
#include "res_private.h"
+#ifdef NS_CACHING
#include "nscache.h"
+#endif
#ifndef _PATH_HOSTS
#define _PATH_HOSTS "/etc/hosts"
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/nsdispatch.c#17 (text+ko) ====
@@ -86,9 +86,10 @@
#include <syslog.h>
#include <unistd.h>
#include "un-namespace.h"
+#ifdef NS_CACHING
#include "nscache.h"
+#endif
-
enum _nss_constants {
/* Number of elements allocated when we grow a vector */
ELEMSPERCHUNK = 8
@@ -638,7 +639,7 @@
cache_flag = 0;
#endif
for (i = 0; i < srclistsize; i++) {
- result = NS_NOTFOUND;
+ result = NS_NOTFOUND;
method = nss_method_lookup(srclist[i].name, database,
method_name, disp_tab, &mdata);
@@ -676,7 +677,7 @@
#else /* NS_CACHING */
va_start(ap, defaults);
result = method(retval, mdata, ap);
- va_end(ap);
+ va_end(ap);
#endif /* NS_CACHING */
if (result & (srclist[i].flags))
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/rpc/getrpcent.c#11 (text+ko) ====
@@ -63,7 +63,9 @@
#include "un-namespace.h"
#include "libc_private.h"
#include "nss_tls.h"
+#ifdef NS_CACHING
#include "nscache.h"
+#endif
#define RPCDB "/etc/rpc"
@@ -127,20 +129,20 @@
int number;
};
-static int wrap_getrpcbyname_r(union key, struct rpcent *, char *,
+static int wrap_getrpcbyname_r(union key, struct rpcent *, char *,
size_t, struct rpcent **);
-static int wrap_getrpcbynumber_r(union key, struct rpcent *, char *,
+static int wrap_getrpcbynumber_r(union key, struct rpcent *, char *,
size_t, struct rpcent **);
-static int wrap_getrpcent_r(union key, struct rpcent *, char *,
+static int wrap_getrpcent_r(union key, struct rpcent *, char *,
size_t, struct rpcent **);
-static struct rpcent *getrpc(int (*fn)(union key, struct rpcent *, char *,
+static struct rpcent *getrpc(int (*fn)(union key, struct rpcent *, char *,
size_t, struct rpcent **), union key);
#ifdef NS_CACHING
-static int rpc_id_func(char *, size_t *, va_list, void *);
-static int rpc_marshal_func(char *, size_t *, void *, va_list, void *);
-static int rpc_unmarshal_func(char *, size_t, void *, va_list, void *);
-#endif /* NS_CACHING */
+static int rpc_id_func(char *, size_t *, va_list, void *);
+static int rpc_marshal_func(char *, size_t *, void *, va_list, void *);
+static int rpc_unmarshal_func(char *, size_t, void *, va_list, void *);
+#endif
static int
rpcent_unpack(char *p, struct rpcent *rpc, char **r_aliases,
@@ -797,7 +799,7 @@
/* get**_r functions implementation */
-int
+static int
getrpcbyname_r(const char *name, struct rpcent *rpc, char *buffer,
size_t bufsize, struct rpcent **result)
{
@@ -832,7 +834,7 @@
return (ret_errno);
}
-int
+static int
getrpcbynumber_r(int number, struct rpcent *rpc, char *buffer,
size_t bufsize, struct rpcent **result)
{
@@ -866,7 +868,7 @@
return (ret_errno);
}
-int
+static int
getrpcent_r(struct rpcent *rpc, char *buffer, size_t bufsize,
struct rpcent **result)
{
@@ -899,53 +901,6 @@
return (ret_errno);
}
-void
-setrpcent(int stayopen)
-{
-#ifdef NS_CACHING
- static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
- rpc, (void *)nss_lt_all,
- NULL, NULL);
-#endif
-
- static const ns_dtab dtab[] = {
- { NSSRC_FILES, files_setrpcent, (void *)SETRPCENT },
-#ifdef YP
- { NSSRC_NIS, nis_setrpcent, (void *)SETRPCENT },
-#endif
-#ifdef NS_CACHING
- NS_CACHE_CB(&cache_info)
-#endif
- { NULL, NULL, NULL }
- };
-
- (void)nsdispatch(NULL, dtab, NSDB_RPC, "setrpcent", defaultsrc,
- stayopen);
-}
-
-void
-endrpcent()
-{
-#ifdef NS_CACHING
- static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
- rpc, (void *)nss_lt_all,
- NULL, NULL);
-#endif
-
- static const ns_dtab dtab[] = {
- { NSSRC_FILES, files_setrpcent, (void *)ENDRPCENT },
-#ifdef YP
- { NSSRC_NIS, nis_setrpcent, (void *)ENDRPCENT },
-#endif
-#ifdef NS_CACHING
- NS_CACHE_CB(&cache_info)
-#endif
- { NULL, NULL, NULL }
- };
-
- (void)nsdispatch(NULL, dtab, NSDB_SERVICES, "endrpcent", defaultsrc);
-}
-
/* get** wrappers for get**_r functions implementation */
static void
rpcent_endstate(void *p)
@@ -1048,3 +1003,50 @@
return (getrpc(wrap_getrpcent_r, key));
}
+
+void
+setrpcent(int stayopen)
+{
+#ifdef NS_CACHING
+ static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+ rpc, (void *)nss_lt_all,
+ NULL, NULL);
+#endif
+
+ static const ns_dtab dtab[] = {
+ { NSSRC_FILES, files_setrpcent, (void *)SETRPCENT },
+#ifdef YP
+ { NSSRC_NIS, nis_setrpcent, (void *)SETRPCENT },
+#endif
+#ifdef NS_CACHING
+ NS_CACHE_CB(&cache_info)
+#endif
+ { NULL, NULL, NULL }
+ };
+
+ (void)nsdispatch(NULL, dtab, NSDB_RPC, "setrpcent", defaultsrc,
+ stayopen);
+}
+
+void
+endrpcent()
+{
+#ifdef NS_CACHING
+ static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
+ rpc, (void *)nss_lt_all,
+ NULL, NULL);
+#endif
+
+ static const ns_dtab dtab[] = {
+ { NSSRC_FILES, files_setrpcent, (void *)ENDRPCENT },
+#ifdef YP
+ { NSSRC_NIS, nis_setrpcent, (void *)ENDRPCENT },
+#endif
+#ifdef NS_CACHING
+ NS_CACHE_CB(&cache_info)
+#endif
+ { NULL, NULL, NULL }
+ };
+
+ (void)nsdispatch(NULL, dtab, NSDB_SERVICES, "endrpcent", defaultsrc);
+}
==== //depot/projects/soc2005/nsswitch_cached/src/usr.sbin/cached/agents/Makefile.inc#2 (text+ko) ====
@@ -1,3 +1,3 @@
# $FreeBSD
-SRCS += passwd.c group.c hosts.c services.c
+SRCS += passwd.c group.c services.c
==== //depot/projects/soc2005/nsswitch_cached/src/usr.sbin/cached/cached.c#3 (text+ko) ====
@@ -46,7 +46,6 @@
#include "agents/passwd.h"
#include "agents/group.h"
#include "agents/services.h"
-#include "agents/hosts.h"
#include "cachedcli.h"
#include "cachelib.h"
#include "config.h"
More information about the p4-projects
mailing list