PERFORCE change 84608 for review
soc-bushman
soc-bushman at FreeBSD.org
Sat Oct 1 08:52:46 PDT 2005
http://perforce.freebsd.org/chv.cgi?CH=84608
Change 84608 by soc-bushman at soc-bushman_stinger on 2005/10/01 15:51:55
lookups work for passwd and groups, services and hosts are 2 go
bug fixed in passwd_marshal_func
Affected files ...
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/Makefile#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/Makefile.inc#2 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/hosts.c#2 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/hosts.h#2 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/passwd.c#2 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/passwd.h#2 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/services.c#2 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/services.h#2 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.8#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.conf#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.conf.5#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cachelib.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cachelib.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cacheplcs.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cacheplcs.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/config.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/config.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/debug.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/debug.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/hashtable.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/log.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/log.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_rs_query.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_rs_query.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_ws_query.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_ws_query.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/parser.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/parser.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/protocol.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/protocol.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/query.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/query.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/singletons.c#6 edit
.. //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/singletons.h#6 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/gen/getpwent.c#10 edit
.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/nsdispatch.c#10 edit
.. //depot/projects/soc2005/nsswitch_cached/tests/nsdispatch_test/Makefile#7 edit
.. //depot/projects/soc2005/nsswitch_cached/tests/nsdispatch_test/nsdispatch.c#10 edit
Differences ...
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/Makefile#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/Makefile.inc#2 (text+ko) ====
@@ -1,3 +1,3 @@
# $FreeBSD
-SRCS += passwd.c hosts.c services.c
+SRCS += passwd.c group.c hosts.c services.c
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/hosts.c#2 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/hosts.h#2 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/passwd.c#2 (text+ko) ====
@@ -42,7 +42,8 @@
size_t desired_size, size;
TRACE_IN(passwd_marshal_func);
- desired_size = sizeof(struct passwd) + strlen(pwd->pw_name) + 1;
+ desired_size = sizeof(struct passwd) + sizeof(char *) +
+ strlen(pwd->pw_name) + 1;
if (pwd->pw_passwd != NULL)
desired_size += strlen(pwd->pw_passwd) + 1;
if (pwd->pw_class != NULL)
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/passwd.h#2 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/services.c#2 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/agents/services.h#2 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.8#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.c#6 (text+ko) ====
@@ -40,6 +40,9 @@
#include <unistd.h>
#include "agents/passwd.h"
+#include "agents/group.h"
+#include "agents/services.h"
+#include "agents/hosts.h"
#include "cachelib.h"
#include "config.h"
#include "debug.h"
@@ -273,9 +276,9 @@
struct query_state *qstate;
struct sockaddr addr;
- socklen_t addr_len;
- int fd;
- int res;
+ socklen_t addr_len;
+ int fd;
+ int res;
uid_t euid;
gid_t egid;
@@ -652,6 +655,11 @@
s_agent_table = init_agent_table();
register_agent(s_agent_table, init_passwd_agent());
register_agent(s_agent_table, init_passwd_mp_agent());
+ register_agent(s_agent_table, init_group_agent());
+ register_agent(s_agent_table, init_group_mp_agent());
+ register_agent(s_agent_table, init_services_agent());
+ register_agent(s_agent_table, init_services_mp_agent());
+ register_agent(s_agent_table, init_hosts_agent());
/* configuration initialization */
s_configuration = init_configuration();
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.conf#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cached.conf.5#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cachelib.c#6 (text+ko) ====
@@ -96,6 +96,7 @@
retval = (127 * retval + (unsigned char)hp->key[i]) %
cache_entries_size;
+ TRACE_INT(retval);
return retval;
}
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cachelib.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cacheplcs.c#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/cacheplcs.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/config.c#6 (text+ko) ====
@@ -47,6 +47,7 @@
};
static int configuration_entry_cmp(const void *, const void *);
+static int configuration_entry_sort_cmp(const void *, const void *);
static struct configuration_entry *create_configuration_entry(const char *,
struct timeval const *, struct timeval const *,
struct common_cache_entry_params const *,
@@ -54,6 +55,14 @@
struct mp_cache_entry_params const *);
static int
+configuration_entry_sort_cmp(const void *e1, const void *e2)
+{
+ return (strcmp((*((struct configuration_entry **)e1))->name,
+ (*((struct configuration_entry **)e2))->name
+ ));
+}
+
+static int
configuration_entry_cmp(const void *e1, const void *e2)
{
/* struct configuration_entry *entry1;
@@ -334,7 +343,8 @@
config->entries[config->entries_size++] = entry;
qsort(config->entries, config->entries_size,
- sizeof(struct configuration_entry *), configuration_entry_cmp);
+ sizeof(struct configuration_entry *),
+ configuration_entry_sort_cmp);
TRACE_OUT(add_configuration_entry);
return (0);
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/config.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/debug.c#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/debug.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/hashtable.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/log.c#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/log.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_rs_query.c#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_rs_query.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_ws_query.c#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/mp_ws_query.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/parser.c#6 (text+ko) ====
@@ -293,13 +293,15 @@
static int
check_cachename(const char *str)
{
- size_t i;
- for (i = 0; i < sizeof(c_default_entries) / sizeof(char *); ++i)
- if (strcmp(str, c_default_entries[i]) == 0)
- return (0);
-
- TRACE_POINT();
- return (-1);
+// size_t i;
+// for (i = 0; i < sizeof(c_default_entries) / sizeof(char *); ++i)
+// if (strcmp(str, c_default_entries[i]) == 0)
+// return (0);
+//
+// TRACE_POINT();
+// return (-1);
+ assert(str != NULL);
+ return ((strlen(str) > 0) ? 0 : -1);
}
int
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/parser.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/protocol.c#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/protocol.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/query.c#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/query.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/singletons.c#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/release/cached-0.2/cached/singletons.h#6 (text+ko) ====
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/gen/getpwent.c#10 (text+ko) ====
@@ -281,7 +281,8 @@
orig_buf = va_arg(ap, char *);
orig_buf_size = va_arg(ap, size_t);
- desired_size = sizeof(struct passwd) + strlen(pwd->pw_name) + 1;
+ desired_size = sizeof(struct passwd) + sizeof(char *) +
+ strlen(pwd->pw_name) + 1;
if (pwd->pw_passwd != NULL)
desired_size += strlen(pwd->pw_passwd) + 1;
if (pwd->pw_class != NULL)
==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/nsdispatch.c#10 (text+ko) ====
@@ -322,6 +322,9 @@
struct stat statbuf;
int result, isthreaded;
const char *path;
+#ifdef NS_CACHING
+ void *handle;
+#endif
result = 0;
isthreaded = __isthreaded;
@@ -362,8 +365,12 @@
confmod = statbuf.st_mtime;
#ifdef NS_CACHING
- nss_cache_cycle_prevention_func = dlsym(NULL,
- "_nss_cache_cycle_prevention_function");
+ handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
+ if (handle != NULL) {
+ nss_cache_cycle_prevention_func = dlsym(handle,
+ "_nss_cache_cycle_prevention_function");
+ dlclose(handle);
+ }
#endif
fin:
if (isthreaded) {
==== //depot/projects/soc2005/nsswitch_cached/tests/nsdispatch_test/Makefile#7 (text+ko) ====
@@ -15,6 +15,7 @@
WARNS?=2
LDADD+=${.CURDIR}/../common/libtest.a
CFLAGS+= -DNS_CACHING -I./
+LDFLAGS+= -Xlinker --export-dynamic
STRIP=
.include <bsd.prog.mk>
==== //depot/projects/soc2005/nsswitch_cached/tests/nsdispatch_test/nsdispatch.c#10 (text+ko) ====
@@ -330,6 +330,7 @@
struct stat statbuf;
int result, isthreaded;
const char *path;
+ void *handle;
result = 0;
isthreaded = __isthreaded;
@@ -369,8 +370,12 @@
(void)atexit(nss_atexit);
confmod = statbuf.st_mtime;
- nss_cache_cycle_prevention_func = dlsym(NULL,
+ handle = dlopen(NULL, RTLD_GLOBAL | RTLD_LAZY);
+ nss_cache_cycle_prevention_func = dlsym(handle,
"_nss_cache_cycle_prevention_function");
+ dlclose(handle);
+ TRACE_PTR(nss_cache_cycle_prevention_func);
+ TRACE_STR((char *)dlerror());
fin:
if (isthreaded) {
(void)_pthread_rwlock_unlock(&nss_lock);
More information about the p4-projects
mailing list