1998-06-03 03:09  Geoff Keating  <geoffk@ozemail.com.au>

	* 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  <geoffk@ozemail.com.au>

	* 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  <geoffk@ozemail.com.au>

	* 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.
This commit is contained in:
Ulrich Drepper 1998-06-11 11:32:21 +00:00
parent bbbad73229
commit 36ecfe5690
12 changed files with 200 additions and 14 deletions

View File

@ -1,3 +1,24 @@
1998-06-03 03:09 Geoff Keating <geoffk@ozemail.com.au>
* 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 <geoffk@ozemail.com.au>
* 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 <geoffk@ozemail.com.au>
* 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 <drepper@cygnus.com>
* iconv/gconv_builtin.h: Add aliases for CORBA.

View File

@ -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 ();

View File

@ -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,\

View File

@ -70,6 +70,9 @@ GLIBC_2.0 {
_nss_netgroup_parseline;
_nss_files_getpublickey;
_nss_files_getsecretkey;
local:
*;
};

115
nss/nss_files/files-key.c Normal file
View File

@ -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 <stdio.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <rpc/key_prot.h>
#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;
}

View File

@ -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));

View File

@ -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)

View File

@ -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

View File

@ -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 <drepper@cygnus.com>, 1997.
@ -19,6 +19,9 @@
#include <errno.h>
#include <unistd.h>
#include <sys/syscall.h>
#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 <sysdeps/posix/pread.c>

View File

@ -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 <drepper@cygnus.com>, 1997.
@ -19,6 +19,9 @@
#include <errno.h>
#include <unistd.h>
#include <sys/syscall.h>
#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 <sysdeps/posix/pread64.c>

View File

@ -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 <drepper@cygnus.com>, 1997.
@ -19,6 +19,9 @@
#include <errno.h>
#include <unistd.h>
#include <sys/syscall.h>
#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 <sysdeps/posix/pwrite.c>

View File

@ -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 <drepper@cygnus.com>, 1997.
@ -19,6 +19,9 @@
#include <errno.h>
#include <unistd.h>
#include <sys/syscall.h>
#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 <sysdeps/posix/pwrite64.c>