Date: Fri, 30 Jun 2006 13:17:01 GMT From: Michael Bushkov <bushman@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100349 for review Message-ID: <200606301317.k5UDH1dg043234@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100349 Change 100349 by bushman@bushman_nss_ldap_cached on 2006/06/30 13:16:54 shells "dns" source error fixed; some minor bugs in getusershell.c fixed Affected files ... .. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/gen/getusershell.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_dns/dns_shells.c#2 edit .. //depot/projects/soc2006/nss_ldap_cached/tests/getusershell_test/Makefile#4 edit .. //depot/projects/soc2006/nss_ldap_cached/tests/getusershell_test/getusershell_test.c#4 edit Differences ... ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/gen/getusershell.c#3 (text+ko) ==== @@ -50,6 +50,8 @@ #include <string.h> #include <unistd.h> #include "un-namespace.h" +#include "nss_tls.h" +#include "reentrant.h" static const ns_src defaultsrc[] = { { NSSRC_FILES, NS_SUCCESS }, @@ -94,7 +96,7 @@ ret_errno = 0; *retval = NULL; - rv = nsdispatch(retval, dtab, NSDB_SHELLS, "getusershell_r", + rv = _nsdispatch(retval, dtab, NSDB_SHELLS, "getusershell_r", defaultsrc, buffer, bufsize, &ret_errno); if (rv == NS_SUCCESS) @@ -152,7 +154,7 @@ { NULL, NULL, NULL } }; - nsdispatch(NULL, dtab, NSDB_SHELLS, "setusershell"); + _nsdispatch(NULL, dtab, NSDB_SHELLS, "setusershell", defaultsrc); } void @@ -162,5 +164,5 @@ { NULL, NULL, NULL } }; - nsdispatch(NULL, dtab, NSDB_SHELLS, "setusershell"); + _nsdispatch(NULL, dtab, NSDB_SHELLS, "setusershell", defaultsrc); } ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_dns/dns_shells.c#2 (text+ko) ==== @@ -120,7 +120,10 @@ if (linesize >= buflen) { *errnop = ERANGE; r = NS_RETURN; - } + } else { + *((char **)rv) = buffer; + r = NS_SUCCESS; + } } hesiod_end(context); ==== //depot/projects/soc2006/nss_ldap_cached/tests/getusershell_test/Makefile#4 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/tests/getusershell_test/getusershell_test.c#4 (text+ko) ==== @@ -326,23 +326,23 @@ if ((_res.options & RES_INIT) == 0 && res_init() == -1) return NULL; - printf(":::: %d\n", __LINE__); + //printf(":::: %d %d %s\n", __LINE__, qclass, name); /* Construct the query. */ n = res_mkquery(QUERY, name, qclass, T_TXT, NULL, 0, NULL, qbuf, PACKETSZ); if (n < 0) return NULL; - printf(":::: %d\n", __LINE__); + //printf(":::: %d\n", __LINE__); /* Send the query. */ n = res_send(qbuf, n, abuf, MAX_HESRESP); if (n < 0 || n > MAX_HESRESP) { - printf("%s %d %d %d\n", name, errno, h_errno, n); + //printf("%s %d %d %d\n", name, errno, h_errno, n); errno = ECONNREFUSED; /* XXX */ return NULL; } - printf(":::: %d\n", __LINE__); + //printf(":::: %d\n", __LINE__); /* Parse the header of the result. */ hp = (HEADER *) (void *) abuf; ancount = ntohs(hp->ancount); @@ -350,7 +350,7 @@ p = abuf + sizeof(HEADER); eom = abuf + n; - printf(":::: %d\n", __LINE__); + //printf(":::: %d\n", __LINE__); /* * Skip questions, trying to get to the answer section * which follows. @@ -364,7 +364,7 @@ p += skip + QFIXEDSZ; } - printf(":::: %d\n", __LINE__); + //printf(":::: %d\n", __LINE__); /* Allocate space for the text record answers. */ list = malloc((ancount + 1) * sizeof(char *)); if (!list) { @@ -874,10 +874,10 @@ return (r); snprintf(shellname, sizeof(shellname)-1, "shells-%d", st->counter++); - printf("::%d %s\n", __LINE__, shellname); + //printf("::%d %s\n", __LINE__, shellname); hp = hesiod_resolve(context, shellname, "shells"); if (hp == NULL) { - printf("::%d %d\n", __LINE__, errno); + //printf("::%d %d\n", __LINE__, errno); st->counter = -1; if (errno == ENOENT) @@ -886,22 +886,23 @@ *errnop = errno; r = NS_UNAVAIL; } - printf("::%d\n", __LINE__); + //printf("::%d\n", __LINE__); } else { - printf("::%d\n", __LINE__); + //printf("::%d\n", __LINE__); linesize = strlcpy(buffer, hp[0], buflen); hesiod_free_list(context, hp); - printf("::%d\n", __LINE__); + //printf("::%d\n", __LINE__); if (linesize >= buflen) { *errnop = ERANGE; r = NS_RETURN; } - printf("::%d\n", __LINE__); + //printf("::%d\n", __LINE__); + *((char **)rv) = buffer; } hesiod_end(context); - printf("::%d\n", __LINE__); + //printf("::%d\n", __LINE__); return (r); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606301317.k5UDH1dg043234>