From 36ecfe5690660610f27d839f3cae31f417b33a04 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 11 Jun 1998 11:32:21 +0000 Subject: Update. 1998-06-03 03:09 Geoff Keating * sysdeps/unix/sysv/linux/pread.c: Detect missing syscall, like poll(). * sysdeps/unix/sysv/linux/pread64.c: Likewise. * sysdeps/unix/sysv/linux/pwrite.c: Likewise. * sysdeps/unix/sysv/linux/pwrite64.c: Likewise. 1998-06-03 03:09 Geoff Keating * sysdeps/powerpc/Makefile: Use -G0 on the startup file; this makes it easier to undump emacs. * sysdeps/powerpc/bits/endian.h: Use more informative error message for when the endianness can't be determined. 1998-06-04 13:19 Geoff Keating * nss/Makefile: Add files publickey database support. * nss/libnss_files.map: Export the required functions. * nss/nss_files/files-key.c: Implement it. * sunrpc/rpc/auth_des.h: Correct typos in comments. --- ChangeLog | 21 +++++++ math/libm-test.c | 28 ++++++++- nss/Makefile | 2 +- nss/libnss_files.map | 3 + nss/nss_files/files-key.c | 115 +++++++++++++++++++++++++++++++++++++ sunrpc/rpc/auth_des.h | 6 +- sysdeps/powerpc/Makefile | 9 ++- sysdeps/powerpc/bits/endian.h | 6 +- sysdeps/unix/sysv/linux/pread.c | 6 +- sysdeps/unix/sysv/linux/pread64.c | 6 +- sysdeps/unix/sysv/linux/pwrite.c | 6 +- sysdeps/unix/sysv/linux/pwrite64.c | 6 +- 12 files changed, 200 insertions(+), 14 deletions(-) create mode 100644 nss/nss_files/files-key.c diff --git a/ChangeLog b/ChangeLog index 47590b2662..4976978a5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +1998-06-03 03:09 Geoff Keating + + * sysdeps/unix/sysv/linux/pread.c: Detect missing syscall, like poll(). + * sysdeps/unix/sysv/linux/pread64.c: Likewise. + * sysdeps/unix/sysv/linux/pwrite.c: Likewise. + * sysdeps/unix/sysv/linux/pwrite64.c: Likewise. + +1998-06-03 03:09 Geoff Keating + + * sysdeps/powerpc/Makefile: Use -G0 on the startup file; this + makes it easier to undump emacs. + * sysdeps/powerpc/bits/endian.h: Use more informative error message + for when the endianness can't be determined. + +1998-06-04 13:19 Geoff Keating + + * nss/Makefile: Add files publickey database support. + * nss/libnss_files.map: Export the required functions. + * nss/nss_files/files-key.c: Implement it. + * sunrpc/rpc/auth_des.h: Correct typos in comments. + 1998-06-10 Ulrich Drepper * iconv/gconv_builtin.h: Add aliases for CORBA. diff --git a/math/libm-test.c b/math/libm-test.c index a0c662b69c..7975bb4404 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -42,7 +42,7 @@ /* This program isn't finished yet. It has tests for: acos, acosh, asin, asinh, atan, atan2, atanh, - cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp2, expm1, + cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp10, exp2, expm1, fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify, frexp, gamma, hypot, ilogb, isfinite, isinf, isnan, isnormal, @@ -1191,6 +1191,31 @@ exp_test (void) } +static void +exp10_test (void) +{ + errno = 0; + FUNC(exp10) (0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + + check ("exp10 (+0) == 1", FUNC(exp10) (0), 1); + check ("exp10 (-0) == 1", FUNC(exp10) (minus_zero), 1); + + check_isinfp ("exp10 (+inf) == +inf", FUNC(exp10) (plus_infty)); + check ("exp10 (-inf) == 0", FUNC(exp10) (minus_infty), 0); + check_eps ("exp10 (3) == 1000", FUNC(exp10) (3), 1000, + CHOOSE(5e-16, 0, 0)); + check_eps ("exp10 (-1) == 0.1", FUNC(exp10) (-1), 0.1, + CHOOSE(6e-18, 0, 0)); + check_isinfp ("exp10 (1e6) == +inf", FUNC(exp10) (1e6)); + check ("exp10 (-1e6) == 0", FUNC(exp10) (-1e6), 0); + check_eps ("exp10 (0.7) == 5.0118723...", FUNC(exp10) (0.7), + 5.0118723362727228500L, CHOOSE(6e-16, 9e-16, 0)); +} + + static void exp2_test (void) { @@ -5956,6 +5981,7 @@ main (int argc, char *argv[]) /* exponential and logarithmic functions */ exp_test (); + exp10_test (); exp2_test (); expm1_test (); frexp_test (); diff --git a/nss/Makefile b/nss/Makefile index 69a99c6a75..e71794e426 100644 --- a/nss/Makefile +++ b/nss/Makefile @@ -53,7 +53,7 @@ subdir-dirs = $(services:%=nss_%) vpath %.c $(subdir-dirs) -libnss_files-routines := $(addprefix files-,$(filter-out key, $(databases))) +libnss_files-routines := $(addprefix files-,$(databases)) distribute += files-XXX.c files-parse.c libnss_db-routines := $(addprefix db-,$(filter-out hosts network key,\ diff --git a/nss/libnss_files.map b/nss/libnss_files.map index 3e030012d4..8daa75f5bb 100644 --- a/nss/libnss_files.map +++ b/nss/libnss_files.map @@ -70,6 +70,9 @@ GLIBC_2.0 { _nss_netgroup_parseline; + _nss_files_getpublickey; + _nss_files_getsecretkey; + local: *; }; diff --git a/nss/nss_files/files-key.c b/nss/nss_files/files-key.c new file mode 100644 index 0000000000..a3c1474c2d --- /dev/null +++ b/nss/nss_files/files-key.c @@ -0,0 +1,115 @@ +/* Public key file parser in nss_files module. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include +#include "nsswitch.h" + +#define DATAFILE "/etc/publickey" + +/* Prototype for function in xcyrpt.c. */ +extern int xdecrypt (char *, char *); + + +static enum nss_status +search (const char *netname, char *result, int *errnop, int secret) +{ + FILE *stream; + + stream = fopen (DATAFILE, "r"); + if (stream == NULL) + return errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; + + for (;;) + { + char buffer[HEXKEYBYTES * 2 + KEYCHECKSUMSIZE + MAXNETNAMELEN + 17]; + char *p; + char *save_ptr; + + buffer[sizeof (buffer) - 1] = '\xff'; + p = fgets (buffer, sizeof (buffer), stream); + if (p == NULL) + { + /* End of file or read error. */ + *errnop = errno; + fclose (stream); + return NSS_STATUS_NOTFOUND; + } + else if (buffer[sizeof (buffer) - 1] != '\xff') + { + /* Invalid line in file? Skip remainder of line. */ + if (buffer[sizeof (buffer) - 2] != '\0') + while (getc (stream) != '\n') + continue; + continue; + } + + /* Parse line. */ + p = __strtok_r (buffer, "# \t:\n", &save_ptr); + if (p == NULL) /* Skip empty and comment lines. */ + continue; + if (strcmp (p, netname) != 0) + continue; + + /* A hit! Find the field we want and return. */ + p = __strtok_r (NULL, ":\n", &save_ptr); + if (p == NULL) /* malformed line? */ + continue; + if (secret) + p = __strtok_r (NULL, ":\n", &save_ptr); + if (p == NULL) /* malformed line? */ + continue; + strcpy (result, p); + return NSS_STATUS_SUCCESS; + } +} + +enum nss_status +_nss_files_getpublickey (const char *netname, char *pkey, int *errnop) +{ + return search (netname, pkey, errnop, 0); +} + +enum nss_status +_nss_files_getsecretkey (const char *netname, char *skey, char *passwd, + int *errnop) +{ + enum nss_status status; + char buf[HEXKEYBYTES + KEYCHECKSUMSIZE + 16]; + + skey[0] = 0; + + status = search (netname, buf, errnop, 1); + if (status != NSS_STATUS_SUCCESS) + return status; + + if (!xdecrypt (buf, passwd)) + return NSS_STATUS_SUCCESS; + + if (memcmp (buf, &(buf[HEXKEYBYTES]), KEYCHECKSUMSIZE) != 0) + return NSS_STATUS_SUCCESS; + + buf[HEXKEYBYTES] = 0; + strcpy (skey, buf); + + return NSS_STATUS_SUCCESS; +} diff --git a/sunrpc/rpc/auth_des.h b/sunrpc/rpc/auth_des.h index 0177ede5e9..c53c221552 100644 --- a/sunrpc/rpc/auth_des.h +++ b/sunrpc/rpc/auth_des.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -85,13 +85,13 @@ extern int authdes_getucred __P ((__const struct authdes_cred * __adc, /* Get the public key for NAME and place it in KEY. NAME can only be up to MAXNETNAMELEN bytes long and the destination buffer KEY should - have HEXKEYBATES + 1 bytes long to fit all characters from the key. */ + have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */ extern int getpublickey __P ((__const char *__name, char *__key)); /* Get the secret key for NAME and place it in KEY. PASSWD is used to decrypt the encrypted key stored in the database. NAME can only be up to MAXNETNAMELEN bytes long and the destination buffer KEY - should have HEXKEYBATES + 1 bytes long to fit all characters from + should have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */ extern int getsecretkey __P ((__const char *__name, char *__key, __const char *__passwd)); diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile index a9922ff6b6..0f8860b1d0 100644 --- a/sysdeps/powerpc/Makefile +++ b/sysdeps/powerpc/Makefile @@ -8,16 +8,21 @@ endif # On PPC, -fpic works until the GOT contains 2^15 bytes, and possibly # more depending on how clever the linker is. Each GOT entry takes 4 bytes, -# so that's at least 8192 entries. Since libc only uses about 1200 entries, +# so that's at least 8192 entries. Since libc only uses about 2000 entries, # we want to use -fpic, because this generates fewer relocs. ifeq (yes,$(build-shared)) pic-ccflag = -fpic endif +ifeq ($(subdir),csu) # The initfini generation code doesn't work in the presence of -fPIC, so # we use -fpic instead which is much better. -ifeq ($(subdir),csu) CFLAGS-initfini.s = -g0 -fpic + +# There is no benefit to using sdata for these objects, and the user +# of the library should be able to control what goes into sdata. +CFLAGS-init.o = -G0 +CFLAGS-gmon-start.o = -G0 endif ifeq ($(subdir),string) diff --git a/sysdeps/powerpc/bits/endian.h b/sysdeps/powerpc/bits/endian.h index 9259da8039..d292ba9fdb 100644 --- a/sysdeps/powerpc/bits/endian.h +++ b/sysdeps/powerpc/bits/endian.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,13 +24,13 @@ #if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN # if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN -# error Please fix sysdeps/powerpc/bits/endian.h (compiling bi-endian?). +# error Both BIG_ENDIAN and LITTLE_ENDIAN defined! # endif # define __BYTE_ORDER __BIG_ENDIAN #else # if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN # define __BYTE_ORDER __LITTLE_ENDIAN # else -# error Please fix sysdeps/powerpc/bits/endian.h. +# error Cannot determine current byte order. # endif #endif diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c index eb0d301fa1..4d7a7c5ad7 100644 --- a/sysdeps/unix/sysv/linux/pread.c +++ b/sysdeps/unix/sysv/linux/pread.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -19,6 +19,9 @@ #include #include +#include + +#ifdef __NR_pread extern ssize_t __syscall_pread64 (int fd, void *buf, size_t count, off_t offset_hi, off_t offset_lo); @@ -49,4 +52,5 @@ weak_alias (__pread, pread) #define __pread(fd, buf, count, offset) \ static internal_function __emulate_pread (fd, buf, count, offset) +#endif #include diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c index e2505dbaa4..bd600f17d4 100644 --- a/sysdeps/unix/sysv/linux/pread64.c +++ b/sysdeps/unix/sysv/linux/pread64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -19,6 +19,9 @@ #include #include +#include + +#ifdef __NR_pread extern ssize_t __syscall_pread64 (int fd, void *buf, size_t count, off_t offset_hi, off_t offset_lo); @@ -50,4 +53,5 @@ weak_alias (__pread64, pread64) #define __pread64(fd, buf, count, offset) \ static internal_function __emulate_pread64 (fd, buf, count, offset) +#endif #include diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c index 9ab3259fc6..72b3cfba66 100644 --- a/sysdeps/unix/sysv/linux/pwrite.c +++ b/sysdeps/unix/sysv/linux/pwrite.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -19,6 +19,9 @@ #include #include +#include + +#ifdef __NR_pwrite extern ssize_t __syscall_pwrite64 (int fd, const void *buf, size_t count, off_t offset_hi, off_t offset_lo); @@ -49,4 +52,5 @@ weak_alias (__pwrite, pwrite) #define __pwrite(fd, buf, count, offset) \ static internal_function __emulate_pwrite (fd, buf, count, offset) +#endif #include diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c index f2b4bcbe4e..70902b28b7 100644 --- a/sysdeps/unix/sysv/linux/pwrite64.c +++ b/sysdeps/unix/sysv/linux/pwrite64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -19,6 +19,9 @@ #include #include +#include + +#ifdef __NR_pwrite extern ssize_t __syscall_pwrite64 (int fd, const void *buf, size_t count, off_t offset_hi, off_t offset_lo); @@ -50,4 +53,5 @@ weak_alias (__pwrite64, pwrite64) #define __pwrite64(fd, buf, count, offset) \ static internal_function __emulate_pwrite64 (fd, buf, count, offset) +#endif #include -- cgit 1.4.1