aboutsummaryrefslogtreecommitdiff
path: root/nis
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-06-14 23:17:05 +0000
committerUlrich Drepper <drepper@redhat.com>1997-06-14 23:17:05 +0000
commit900bec852d0bd53eb27b8b2193899f5cf470b38f (patch)
treecb4504e7abecc289fcdd2fb43efad14ec6302d8e /nis
parentce37fa887b0ea89614d9538e90ade7356b80f48c (diff)
downloadglibc-900bec852d0bd53eb27b8b2193899f5cf470b38f.zip
glibc-900bec852d0bd53eb27b8b2193899f5cf470b38f.tar.gz
glibc-900bec852d0bd53eb27b8b2193899f5cf470b38f.tar.bz2
1997-06-15 00:43 Ulrich Drepper <drepper@cygnus.com> * Makeconfig: Define libc-map here. * Makefile: And remove definition here. * Makerules (load-map-file): Handle case where map file is in other directory. (build-shlib): Likewise. * libc.map: Add more symbols. * resolv/libresolv.map: Likewise. * db/libdb.map: Add __dbopen. Patch by HJ Lu. * libio/stdio.h: Remove "optmizations" for vfscanf and vsscanf. * locale/programs/localedef.c: Add normalize_codeset function. We don't want to use the _nl_normalize_codeset functions from libc. * sysdeps/libm-i387/s_asinh.S: Handle +-Inf and NaN correctly. * sysdeps/libm-i387/s_asinhf.S: Likewise. * sysdeps/libm-i387/s_asinhl.S: Likewise. * sysdeps/libm-i387/s_nearbyint.S: Correctly leave function. * sysdeps/libm-i387/s_nearbyintf.S: Likewise. * sysdeps/libm-i387/s_nearbyintl.S: Likewise. 1997-06-14 12:45 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nss_nis/nis-ethers.c: Add static to internal_nis_setetherent. * nis/nss_nis/nis-proto.c: Add static to internal_nis_setprotoent. * nis/nss_nisplus/nisplus-hosts.c: Rewrite parser and fix _nss_nisplus_gethostbyaddr_r interface. * nis/libnsl.map: Add all GLOBAL functions. 1997-06-13 18:32 Andreas Jaeger <aj@arthur.rhein-neckar.de> * libm-test.c (main): Call new tests, reorder tests. (fmod_test): Test function fmod. (nearbyint_test): Test function nearbyint. (acos_test): Add more test cases. (signbit_test): Test macro signbit. (output_result_bool): Output result if test fails. (asin_test): Add another test case. (atan2_test): Add more tests. (asinh_test): Add more tests. (atanh_test): Add more tests. (hypot_test): Add more tests. (isfinite_test): Test macro isfinite. (isnormal_test): Test macro isnormal. (sincos_test): Tests for sincos. (main): Enable remquo_test since the tests are correct (according to ANSI/IEEE 754-1985). (remquo_test): Corrected tests cases and added more tests. (remainder_test): Tests for remainder. (check_int): New Function to compare int values. (check_isnan_exc_ext): New function. (sqrt_test): Add some extra tests for sqrt. (erf_test): Tests for erf. (erfc_test): Tests for erfc. (gamma_test): Tests for gamma. (lgamma_test): Tests for lgamma. 1997-06-08 10:54 H.J. Lu <hjl@gnu.ai.mit.edu> * sysdeps/unix/sysv/linux/configure.in: Try to generate stdio_lim.h using the target C preprocessor and mk-stdiolim.c. * sysdeps/unix/sysv/linux/stdio_lim.h.in: New, template for stdio_lim.h. * sysdeps/unix/sysv/linux/mk-stdiolim.c: New, used by the target C preprocessor to extract OPEN_MAX and PATH_MAX. 1997-06-14 17:32 Andreas Jaeger <aj@arthur.rhein-neckar.de> * math/libm.map: Add inline functions, global variables.
Diffstat (limited to 'nis')
-rw-r--r--nis/libnsl.map64
-rw-r--r--nis/nss_nis/nis-ethers.c2
-rw-r--r--nis/nss_nis/nis-proto.c2
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c197
4 files changed, 168 insertions, 97 deletions
diff --git a/nis/libnsl.map b/nis/libnsl.map
index ab88de6..36bb857 100644
--- a/nis/libnsl.map
+++ b/nis/libnsl.map
@@ -1,13 +1,61 @@
GLIBC_2.0 {
global:
- nis_add; nis_add_entry; nis_addmember; nis_checkpoint; nis_clone_directory;
- nis_clone_entry; nis_clone_group; nis_clone_link; nis_clone_nis_attr;
- nis_clone_objdata; nis_clone_object; nis_clone_result; nis_clone_table;
- nis_creategroup; nis_destroy_object; nis_destroygroup; nis_dir_cmp;
- nis_domain_of; nis_domain_of_r; nis_first_entry; nis_free_attr;
- nis_free_directory; nis_free_endpoints; nis_free_entry; nis_free_group;
- nis_free_link; nis_free_object; nis_free_request; nis_free_servers;
- nis_free_table;
+ __nis_default_access; __nis_default_group; __nis_default_owner;
+ __nis_default_ttl; __yp_check; nis_add;
+ nis_add_entry; nis_addmember; nis_checkpoint;
+ nis_clone_directory; nis_clone_entry; nis_clone_group;
+ nis_clone_link; nis_clone_nis_attr; nis_clone_objdata;
+ nis_clone_object; nis_clone_result; nis_clone_table;
+ nis_creategroup; nis_destroy_object; nis_destroygroup;
+ nis_dir_cmp; nis_domain_of; nis_domain_of_r;
+ nis_first_entry; nis_free_attr; nis_free_directory;
+ nis_free_endpoints; nis_free_entry; nis_free_group;
+ nis_free_link; nis_free_object; nis_free_request;
+ nis_free_servers; nis_free_table; nis_freenames;
+ nis_freeresult; nis_freeservlist; nis_freetags;
+ nis_getnames; nis_getservlist; nis_ismember;
+ nis_leaf_of; nis_leaf_of_r; nis_lerror;
+ nis_list; nis_local_directory; nis_local_group;
+ nis_local_host; nis_local_principal; nis_lookup;
+ nis_mkdir; nis_modify; nis_modify_entry;
+ nis_name_of; nis_name_of_r; nis_next_entry;
+ nis_perror; nis_ping; nis_print_directory;
+ nis_print_entry; nis_print_group; nis_print_group_entry;
+ nis_print_link; nis_print_object; nis_print_result;
+ nis_print_rights; nis_print_table; nis_read_obj;
+ nis_remove; nis_remove_entry; nis_removemember;
+ nis_rmdir; nis_servstate; nis_sperrno;
+ nis_sperror; nis_sperror_r; nis_stats;
+ nis_verifygroup; nis_write_obj;
+
+ readColdStartFile; writeColdStartFile;
+
+ xdr_cp_result; xdr_directory_obj; xdr_domainname;
+ xdr_dump_args; xdr_endpoint; xdr_entry_col;
+ xdr_entry_obj; xdr_fd_args; xdr_fd_result;
+ xdr_group_obj; xdr_ib_request; xdr_keydat;
+ xdr_link_obj; xdr_log_entry; xdr_log_entry_t;
+ xdr_log_result; xdr_mapname; xdr_nis_attr;
+ xdr_nis_error; xdr_nis_name; xdr_nis_object;
+ xdr_nis_oid; xdr_nis_result; xdr_nis_server;
+ xdr_nis_tag; xdr_nis_taglist; xdr_ns_request;
+ xdr_nstype; xdr_oar_mask; xdr_objdata;
+ xdr_peername; xdr_ping_args; xdr_table_col;
+ xdr_table_obj; xdr_valdat; xdr_yp_buf;
+ xdr_ypbind_binding; xdr_ypbind_resp; xdr_ypbind_resptype;
+ xdr_ypbind_setdom; xdr_ypdelete_args; xdr_ypmap_parms;
+ xdr_ypmaplist; xdr_yppush_status; xdr_yppushresp_xfr;
+ xdr_ypreq_key; xdr_ypreq_nokey; xdr_ypreq_xfr;
+ xdr_ypresp_all; xdr_ypresp_key_val; xdr_ypresp_maplist;
+ xdr_ypresp_master; xdr_ypresp_order; xdr_ypresp_val;
+ xdr_ypresp_xfr; xdr_ypstat; xdr_ypupdate_args;
+ xdr_ypxfrstat; xdr_zotypes;
+
+ yp_all; yp_bind; yp_first;
+ yp_get_default_domain; yp_maplist; yp_master;
+ yp_match; yp_next; yp_order;
+ yp_unbind; yp_update; ypbinderr_string;
+ yperr_string; ypprot_err;
local:
*;
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index a9730a3..32c6834 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -80,7 +80,7 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval,
return 0;
}
-enum nss_status
+static enum nss_status
internal_nis_setetherent (void)
{
char *domainname;
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index d939c9d..3df9919 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -72,7 +72,7 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval,
return 0;
}
-enum nss_status
+static enum nss_status
internal_nis_setprotoent (void)
{
char *domainname;
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index e6d584d..0fdeb8f 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -44,72 +44,14 @@ static nis_name *names = NULL;
/* Get implementation for some internal functions. */
#include "../../resolv/mapv4v6addr.h"
-#define ENTNAME hostent
-#define DATABASE "hosts"
-#define NEED_H_ERRNO
-
-#define ENTDATA hostent_data
-struct hostent_data
- {
- unsigned char host_addr[16]; /* IPv4 or IPv6 address. */
- char *h_addr_ptrs[2]; /* Points to that and null terminator. */
- };
-
-#define TRAILING_LIST_MEMBER h_aliases
-#define TRAILING_LIST_SEPARATOR_P isspace
-#include "../../nss/nss_files/files-parse.c"
-LINE_PARSER
-("#",
- {
- char *addr;
-
- STRING_FIELD (addr, isspace, 1);
-
- /* Parse address. */
- if (inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
- {
- result->h_addrtype = AF_INET6;
- result->h_length = IN6ADDRSZ;
- }
- else
- if (inet_pton (AF_INET, addr, entdata->host_addr) > 0)
- {
- if (_res.options & RES_USE_INET6)
- {
- map_v4v6_address ((char *) entdata->host_addr,
- (char *) entdata->host_addr);
- result->h_addrtype = AF_INET6;
- result->h_length = IN6ADDRSZ;
- }
- else
- {
- result->h_addrtype = AF_INET;
- result->h_length = INADDRSZ;
- }
- }
- else
- /* Illegal address: ignore line. */
- return 0;
-
- /* Store a pointer to the address in the expected form. */
- entdata->h_addr_ptrs[0] = entdata->host_addr;
- entdata->h_addr_ptrs[1] = NULL;
- result->h_addr_list = entdata->h_addr_ptrs;
-
- STRING_FIELD (result->h_name, isspace, 1);
- }
-)
-
-
static int
-_nss_nisplus_parse_hostent (nis_result *result, struct hostent *host,
+_nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
char *buffer, size_t buflen)
{
- char *p = buffer;
- size_t room_left = buflen;
- int parse_res;
unsigned int i;
- struct parser_data *data = (void *) buffer;
+ char *first_unused = buffer;
+ size_t room_left = buflen;
+ char *data, *p, *line;
if (result == NULL)
return 0;
@@ -121,43 +63,117 @@ _nss_nisplus_parse_hostent (nis_result *result, struct hostent *host,
result->objects.objects_val[0].zo_data.objdata_u.en_data.en_cols.en_cols_len < 4)
return 0;
- memset (p, '\0', room_left);
-
- /* Generate the hosts entry format and use the normal parser */
- if (NISENTRYLEN (0, 2, result) + 1 > room_left)
+ if (room_left < NISENTRYLEN (0, 2, result) + 1)
{
__set_errno (ERANGE);
return 0;
}
- strncpy (p, NISENTRYVAL (0, 2, result),
- NISENTRYLEN (0, 2, result));
- room_left -= (NISENTRYLEN (0, 2, result) + 1);
+
+ data = first_unused;
+ if (inet_pton (af, NISENTRYVAL (0, 2, result), data) < 1)
+ /* Illegal address: ignore line. */
+ return 0;
+
+ host->h_addrtype = af;
+ if (af == AF_INET6)
+ host->h_length = IN6ADDRSZ;
+ else
+ {
+ if (_res.options & RES_USE_INET6)
+ {
+ map_v4v6_address (data, data);
+ host->h_addrtype = AF_INET6;
+ host->h_length = IN6ADDRSZ;
+ }
+ else
+ {
+ host->h_addrtype = AF_INET;
+ host->h_length = INADDRSZ;
+ }
+ }
+ first_unused+=host->h_length;
+ room_left-=host->h_length;
if (NISENTRYLEN (0, 0, result) + 1 > room_left)
{
__set_errno (ERANGE);
return 0;
}
- strcat (p, "\t");
- strncat (p, NISENTRYVAL (0, 0, result), NISENTRYLEN (0, 0, result));
+ p = stpncpy (first_unused, NISENTRYVAL (0, 0, result),
+ NISENTRYLEN (0, 0, result));
+ *p = '\0';
room_left -= (NISENTRYLEN (0, 0, result) + 1);
- /* + 1: We overwrite the last \0 */
+ host->h_name = first_unused;
+ first_unused += NISENTRYLEN (0, 0, result) +1;
+ p = first_unused;
- for (i = 1; i < result->objects.objects_len; i++)
+ line = p;
+ for (i = 0; i < result->objects.objects_len; i++)
{
- if (NISENTRYLEN (i, 1, result) + 1 > room_left)
+ if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0)
+ {
+ if (NISENTRYLEN (i, 1, result) + 2 > room_left)
+ {
+ __set_errno (ERANGE);
+ return 0;
+ }
+ p = stpcpy(p, " ");
+ p = stpncpy (p, NISENTRYVAL (i, 1, result),
+ NISENTRYLEN (i, 1, result));
+ *p = '\0';
+ room_left -= (NISENTRYLEN (i, 1, result) + 1);
+ }
+ }
+ ++p;
+ first_unused = p;
+ /* Adjust the pointer so it is aligned for
+ storing pointers. */
+ first_unused += __alignof__ (char *) - 1;
+ first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
+ host->h_addr_list = (char **) first_unused;
+ if (room_left < 2 * sizeof (char *))
+ {
+ __set_errno (ERANGE);
+ return 0;
+ }
+ room_left -= (2 * sizeof (char *));
+ host->h_addr_list[0] = data;
+ host->h_addr_list[1] = NULL;
+ host->h_aliases = &host->h_addr_list[2];
+ host->h_aliases[0] = NULL;
+
+ i = 0;
+ while (*line != '\0')
+ {
+ /* Skip leading blanks. */
+ while (isspace (*line))
+ line++;
+
+ if (*line == '\0')
+ break;
+
+ if (room_left < sizeof (char *))
{
__set_errno (ERANGE);
return 0;
}
- strcat (p, " ");
- strcat (p, NISENTRYVAL (i, 1, result));
- room_left -= (NISENTRYLEN (i, 1, result) + 1);
+
+ room_left -= sizeof (char *);
+ host->h_aliases[i] = line;
+
+ while (*line != '\0' && *line != ' ')
+ line++;
+
+ if (line != host->h_aliases[i])
+ {
+ *line = '\0';
+ line++;
+ i++;
+ }
}
- parse_res = parse_line (p, host, data, buflen);
+ return 1;
- return parse_res;
}
enum nss_status
@@ -249,7 +265,11 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
}
}
- parse_res = _nss_nisplus_parse_hostent (result, host, buffer, buflen);
+ parse_res = _nss_nisplus_parse_hostent (result, AF_INET6,
+ host, buffer, buflen);
+ if (!parse_res && errno != ERANGE)
+ parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host,
+ buffer, buflen);
if (!parse_res && errno == ERANGE)
{
*herrnop = NETDB_INTERNAL;
@@ -326,7 +346,8 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
return retval;
}
- parse_res = _nss_nisplus_parse_hostent (result, host, buffer, buflen);
+ parse_res =
+ _nss_nisplus_parse_hostent (result, af, host, buffer, buflen);
nis_freeresult (result);
@@ -360,19 +381,20 @@ _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host,
}
enum nss_status
-_nss_nisplus_gethostbyaddr_r (const char *addr, struct hostent *host,
- char *buffer, size_t buflen, int *herrnop)
+_nss_nisplus_gethostbyaddr_r (const char *addr, int addrlen, int type,
+ struct hostent *host, char *buffer,
+ size_t buflen, int *herrnop)
{
if (addr == NULL)
return NSS_STATUS_NOTFOUND;
else
{
nis_result *result;
- char buf[24 + strlen (addr)];
+ char buf[1025];
int retval, parse_res;
- sprintf(buf, "[addr=%s],hosts.org_dir", addr);
-
+ snprintf(buf, sizeof (buf) -1, "[addr=%s],hosts.org_dir",
+ inet_ntoa (*(struct in_addr *)addr));
result = nis_list(buf, EXPAND_NAME, NULL, NULL);
retval = niserr2nss (result->status);
@@ -387,7 +409,8 @@ _nss_nisplus_gethostbyaddr_r (const char *addr, struct hostent *host,
return retval;
}
- parse_res = _nss_nisplus_parse_hostent (result, host, buffer, buflen);
+ parse_res = _nss_nisplus_parse_hostent (result, type, host,
+ buffer, buflen);
nis_freeresult (result);