update from main archive 970122

1997-01-23  Paul Eggert  <eggert@twinsun.com>

	* mktime.c (mktime): Invoke __tzset, not __tzset_internal, to set tz,
	so that tzname is set as POSIX requires.

Fri Jan 24 02:49:18 1997  Ulrich Drepper  <drepper@cygnus.com>

	* dirent/dirent.h: Declare readdir_r also when __USE_POSIX.
	* grp/grp.h: Declare *_r functions also when __USE_POSIX.
	* pwd/pwd.h: Likewise.
	* time/time.h: Likewise.
	* posix/unistd.h: Declare ttyname_r also when __USE_POSIX.
	* string/string.h: Declare strtok_r also when __USE_POSIX.

	* stdio-common/bug7.c: Use tmpnam to generate names for test files.

	* stdio-common/tmpnam.c: Update copyright.
	* stdio-common/tmpnam_r.c: Likewise.

	* sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h: Protect
	against multiple inclusion.  Include <termbits.h>.
	* sysdeps/unix/sysv/linux/sys/kernel_termios.h: Likewise.

	* sysdeps/unix/sysv/linux/net/if.h: Update according to recent
	kernel headers.  Patch by Philip Blundell <pjb27@cam.ac.uk>.

Thu Jan 23 17:42:00 1997  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/sparc/clone.S: Correct author attribution.

	* sysdeps/unix/sysv/linux/net/if_arp (MAX_ADDR_LEN): Add definition.

Thu Jan 23 14:20:34 1997  Ulrich Drepper  <drepper@cygnus.com>

	* time/tzfile.c (__tzfile_read): Don't allow arbitrary files to be
	read when running a setuid program.
This commit is contained in:
Ulrich Drepper 1997-01-24 02:23:54 +00:00
parent 8d57beeab1
commit 9d187dd4ad
21 changed files with 200 additions and 108 deletions

View File

@ -1,3 +1,40 @@
1997-01-23 Paul Eggert <eggert@twinsun.com>
* mktime.c (mktime): Invoke __tzset, not __tzset_internal, to set tz,
so that tzname is set as POSIX requires.
Fri Jan 24 02:49:18 1997 Ulrich Drepper <drepper@cygnus.com>
* dirent/dirent.h: Declare readdir_r also when __USE_POSIX.
* grp/grp.h: Declare *_r functions also when __USE_POSIX.
* pwd/pwd.h: Likewise.
* time/time.h: Likewise.
* posix/unistd.h: Declare ttyname_r also when __USE_POSIX.
* string/string.h: Declare strtok_r also when __USE_POSIX.
* stdio-common/bug7.c: Use tmpnam to generate names for test files.
* stdio-common/tmpnam.c: Update copyright.
* stdio-common/tmpnam_r.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h: Protect
against multiple inclusion. Include <termbits.h>.
* sysdeps/unix/sysv/linux/sys/kernel_termios.h: Likewise.
* sysdeps/unix/sysv/linux/net/if.h: Update according to recent
kernel headers. Patch by Philip Blundell <pjb27@cam.ac.uk>.
Thu Jan 23 17:42:00 1997 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/sparc/clone.S: Correct author attribution.
* sysdeps/unix/sysv/linux/net/if_arp (MAX_ADDR_LEN): Add definition.
Thu Jan 23 14:20:34 1997 Ulrich Drepper <drepper@cygnus.com>
* time/tzfile.c (__tzfile_read): Don't allow arbitrary files to be
read when running a setuid program.
Thu Jan 23 04:06:42 1997 Ulrich Drepper <drepper@cygnus.com> Thu Jan 23 04:06:42 1997 Ulrich Drepper <drepper@cygnus.com>
* Make-dist (.PHONY: dist): Remove duplicate declaration. * Make-dist (.PHONY: dist): Remove duplicate declaration.
@ -85,7 +122,6 @@ Wed Jan 22 13:19:56 1997 Richard Henderson <rth@tamu.edu>
Wed Jan 22 23:05:14 1997 Ulrich Drepper <drepper@cygnus.com> Wed Jan 22 23:05:14 1997 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/mach/hurd/vdprintf.c: Complete de-ANSI-declfication. * sysdeps/mach/hurd/vdprintf.c: Complete de-ANSI-declfication.
* sysdeps/posix/pipestream.c (writedecl): Fix typo.
Reported by Marcus G. Daniels <marcus@shannon.sysc.pdx.edu>. Reported by Marcus G. Daniels <marcus@shannon.sysc.pdx.edu>.
Wed Jan 22 13:58:56 1997 Andreas Jaeger <aj@arthur.pfalz.de> Wed Jan 22 13:58:56 1997 Andreas Jaeger <aj@arthur.pfalz.de>

View File

@ -749,8 +749,8 @@ ifdef install-lib
install-lib.a := $(filter lib%.a,$(install-lib)) install-lib.a := $(filter lib%.a,$(install-lib))
install-lib-non.a := $(filter-out lib%.a,$(install-lib)) install-lib-non.a := $(filter-out lib%.a,$(install-lib))
ifdef install-lib-non.a ifdef install-lib-non.a
$(addprefix $(libdir)/$(libprefix),$(install-lib-non.a)): \ $(addprefix $(inst_libdir)/$(libprefix),$(install-lib-non.a)): \
$(libdir)/$(libprefix)%: $(objpfx)% $(inst_libdir)/$(libprefix)%: $(objpfx)%
$(do-install) $(do-install)
endif endif
ifdef install-lib.a ifdef install-lib.a

View File

@ -1,6 +1,6 @@
Open jobs for finishing GNU libc: Open jobs for finishing GNU libc:
--------------------------------- ---------------------------------
Status: October 1996 Status: January 1997
If you have time and talent to take over any of the jobs below please If you have time and talent to take over any of the jobs below please
contact <bug-glibc@prep.ai.mit.edu> contact <bug-glibc@prep.ai.mit.edu>
@ -10,6 +10,8 @@ contact <bug-glibc@prep.ai.mit.edu>
[ 1] Port to new platforms or test current version on formerly supported [ 1] Port to new platforms or test current version on formerly supported
platforms. platforms.
**** See http://www.gnu.org/software/libc/porting.html for more details.
[ 2] Test compliance with standards. If you have access to recent [ 2] Test compliance with standards. If you have access to recent
standards (IEEE, ISO, ANSI, X/Open, ...) and/or test suites you standards (IEEE, ISO, ANSI, X/Open, ...) and/or test suites you
@ -31,6 +33,8 @@ contact <bug-glibc@prep.ai.mit.edu>
Implementation idea: use some functions from bash. Implementation idea: use some functions from bash.
**** Somebody is working on this. Help may or may not be appreciated.
[ 5] Write `long double' versions of the math functions. This should be [ 5] Write `long double' versions of the math functions. This should be
done in collaboration with the NetBSD and FreeBSD people. done in collaboration with the NetBSD and FreeBSD people.
@ -83,5 +87,15 @@ contact <bug-glibc@prep.ai.mit.edu>
[11] Rewrite utmp/wtmp functions to use database functions. This is much [11] Rewrite utmp/wtmp functions to use database functions. This is much
better than the normal flat file format. better than the normal flat file format.
Please contact bug-glibc@prep.ai.mit.edu before starting to avoid **** There are plans for a new approach to this problem. Please contact
duplicated work. bug-glibc@prep.ai.mit.edu before starting to work.)
[12] Several more or less small functions have to be written:
+ tcgetid() and waitid() from XPG4.2
+ grantpt(), ptsname(), unlockpt() from XPG4.2
+ getdate() from XPG4.2
+ fmtmsg() from SVID
More information are available on request.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. /* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -116,14 +116,14 @@ extern int closedir __P ((DIR *__dirp));
extern struct dirent *__readdir __P ((DIR *__dirp)); extern struct dirent *__readdir __P ((DIR *__dirp));
extern struct dirent *readdir __P ((DIR *__dirp)); extern struct dirent *readdir __P ((DIR *__dirp));
#ifdef __USE_REENTRANT #if defined __USE_POSIX || defined __USE_REENTRANT
/* Reentrant version of `readdir'. Return in RESULT a pointer to the /* Reentrant version of `readdir'. Return in RESULT a pointer to the
next entry. */ next entry. */
extern int __readdir_r __P ((DIR *__dirp, struct dirent *entry, extern int __readdir_r __P ((DIR *__dirp, struct dirent *entry,
struct dirent **result)); struct dirent **result));
extern int readdir_r __P ((DIR *__dirp, struct dirent *entry, extern int readdir_r __P ((DIR *__dirp, struct dirent *entry,
struct dirent **result)); struct dirent **result));
#endif #endif /* POSIX or reentrant */
/* Rewind DIRP to the beginning of the directory. */ /* Rewind DIRP to the beginning of the directory. */
extern void rewinddir __P ((DIR *__dirp)); extern void rewinddir __P ((DIR *__dirp));

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -91,7 +91,7 @@ extern struct group *getgrgid __P ((__gid_t __gid));
/* Search for an entry with a matching group name. */ /* Search for an entry with a matching group name. */
extern struct group *getgrnam __P ((__const char *__name)); extern struct group *getgrnam __P ((__const char *__name));
#ifdef __USE_REENTRANT #if defined __USE_POSIX || defined __USE_REENTRENT
/* Reasonable value for the buffer sized used in the reentrant /* Reasonable value for the buffer sized used in the reentrant
functions below. But better use `sysconf'. */ functions below. But better use `sysconf'. */
#define NSS_BUFLEN_GROUP 1024 #define NSS_BUFLEN_GROUP 1024
@ -132,7 +132,7 @@ extern int fgetgrent_r __P ((FILE * __stream, struct group *__resultbuf,
struct group **__result)); struct group **__result));
#endif #endif
#endif /* reentrant */ #endif /* POSIX or reentrant */
#ifdef __USE_BSD #ifdef __USE_BSD

View File

@ -32,7 +32,7 @@ include ../Rules
CPPFLAGS += -D'GNULOCALEDIR="$(localedir)"' \ CPPFLAGS += -D'GNULOCALEDIR="$(localedir)"' \
-D'LOCALE_ALIAS_PATH="$(localedir):$(i18ndir)"' -D'LOCALE_ALIAS_PATH="$(localedir):$(i18ndir)"'
$(localedir)/locale.alias: locale.alias $(inst_localedir)/locale.alias: locale.alias
$(do-install) $(do-install)
ifdef gettext-srcdir ifdef gettext-srcdir

View File

@ -552,12 +552,11 @@ extern __pid_t vfork __P ((void));
/* Return the pathname of the terminal FD is open on, or NULL on errors. /* Return the pathname of the terminal FD is open on, or NULL on errors.
The returned storage is good only until the next call to this function. */ The returned storage is good only until the next call to this function. */
extern char *ttyname __P ((int __fd)); extern char *ttyname __P ((int __fd));
#ifdef __USE_REENTRANT
/* Store at most BUFLEN characters of the pathname of the terminal FD is /* Store at most BUFLEN characters of the pathname of the terminal FD is
open on in BUF. Return 0 on success, -1 otherwise. */ open on in BUF. Return 0 on success, -1 otherwise. */
extern int __ttyname_r __P ((int __fd, char *__buf, size_t __buflen)); extern int __ttyname_r __P ((int __fd, char *__buf, size_t __buflen));
extern int ttyname_r __P ((int __fd, char *__buf, size_t __buflen)); extern int ttyname_r __P ((int __fd, char *__buf, size_t __buflen));
#endif
/* Return 1 if FD is a valid descriptor associated /* Return 1 if FD is a valid descriptor associated
with a terminal, zero if not. */ with a terminal, zero if not. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -94,7 +94,7 @@ extern struct passwd *getpwuid __P ((__uid_t __uid));
/* Search for an entry with a matching username. */ /* Search for an entry with a matching username. */
extern struct passwd *getpwnam __P ((__const char *__name)); extern struct passwd *getpwnam __P ((__const char *__name));
#ifdef __USE_REENTRANT #if defined __USE_POSIX || defined __USE_REENTRANT
/* Reasonable value for the buffer sized used in the reentrant /* Reasonable value for the buffer sized used in the reentrant
functions below. But better use `sysconf'. */ functions below. But better use `sysconf'. */
#define NSS_BUFLEN_PASSWD 1024 #define NSS_BUFLEN_PASSWD 1024
@ -140,7 +140,7 @@ extern int fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
struct passwd **__result)); struct passwd **__result));
#endif #endif
#endif /* reentrant */ #endif /* POSIX or reentrant */
__END_DECLS __END_DECLS

View File

@ -6,50 +6,62 @@ int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
int lose = 0; int lose = 0;
char filename[] = "/tmp/foo"; char filename[L_tmpnam];
FILE *fp; FILE *fp;
fp = fopen (filename, "w+"); if (tmpnam (filename) == NULL)
fprintf (fp, "Hello world!\n");
fflush (fp);
fseek (fp, 5L, SEEK_SET);
if (fseek (fp, -1L, SEEK_CUR) < 0)
{ {
printf ("seek failed\n"); printf ("tmpnam failed\n");
lose = 1; lose = 1;
} }
fclose (fp); else
remove (filename); {
fp = fopen (filename, "w+");
fprintf (fp, "Hello world!\n");
fflush (fp);
fseek (fp, 5L, SEEK_SET);
if (fseek (fp, -1L, SEEK_CUR) < 0)
{
printf ("seek failed\n");
lose = 1;
}
fclose (fp);
remove (filename);
}
{ {
FILE *file1; FILE *file1;
FILE *file2; FILE *file2;
char filename1[] = "/tmp/foo"; char filename1[L_tmpnam];
char filename2[] = "/tmp/bar"; char filename2[L_tmpnam];
int ch; int ch;
file1 = fopen (filename1, "w"); if (tmpnam (filename1) == NULL || tmpnam (filename2) == NULL)
fclose (file1);
file2 = fopen (filename2, "w");
fputc ('x', file2);
fclose (file2);
file1 = fopen (filename1, "r");
file2 = freopen (filename2, "r", file1);
if ((ch = fgetc (file2)) != 'x')
{ {
printf ("wrong character in reopened file, value = %d\n", ch); printf ("tmpnam failed\n");
lose = 1; lose = 1;
} }
#if 0 else
/* Hey, how did this ever worked? `file1' is already closed!!! {
-- drepper@gnu */
fclose (file1); file1 = fopen (filename1, "w");
#endif fclose (file1);
fclose (file2);
remove (filename1); file2 = fopen (filename2, "w");
remove (filename2); fputc ('x', file2);
fclose (file2);
file1 = fopen (filename1, "r");
file2 = freopen (filename2, "r", file1);
if ((ch = fgetc (file2)) != 'x')
{
printf ("wrong character in reopened file, value = %d\n", ch);
lose = 1;
}
fclose (file2);
remove (filename1);
remove (filename2);
}
} }
puts (lose ? "Test FAILED!" : "Test succeeded."); puts (lose ? "Test FAILED!" : "Test succeeded.");

View File

@ -1,20 +1,20 @@
/* Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc. /* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -1,20 +1,20 @@
/* Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc. /* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -138,12 +138,14 @@ extern char *strstr __P ((__const char *__haystack, __const char *__needle));
/* Divide S into tokens separated by characters in DELIM. */ /* Divide S into tokens separated by characters in DELIM. */
extern char *strtok __P ((char *__s, __const char *__delim)); extern char *strtok __P ((char *__s, __const char *__delim));
#ifdef __USE_GNU #if defined __USE_POSIX || defined __USE_REENTRANT
/* Divide S into tokens separated by characters in DELIM. Information /* Divide S into tokens separated by characters in DELIM. Information
passed between calls are stored in SAVE_PTR. */ passed between calls are stored in SAVE_PTR. */
extern char *strtok_r __P ((char *__s, __const char *__delim, extern char *strtok_r __P ((char *__s, __const char *__delim,
char **__save_ptr)); char **__save_ptr));
#endif
#ifdef __USE_GNU
/* Find the first occurrence of NEEDLE in HAYSTACK. /* Find the first occurrence of NEEDLE in HAYSTACK.
NEEDLE is NEEDLELEN bytes long; NEEDLE is NEEDLELEN bytes long;
HAYSTACK is HAYSTACKLEN bytes long. */ HAYSTACK is HAYSTACKLEN bytes long. */

View File

@ -1,5 +1,10 @@
#ifndef _SYS_KERNEL_TERMIOS_H
#define _SYS_KERNEL_TERMIOS_H 1
/* The following corresponds to the values from the Linux 2.1.20 kernel. */ /* The following corresponds to the values from the Linux 2.1.20 kernel. */
/* We need the definition of tcflag_t, cc_t, and speed_t. */
#include <termbits.h>
#define __KERNEL_NCCS 19 #define __KERNEL_NCCS 19
struct __kernel_termios struct __kernel_termios
@ -16,3 +21,5 @@ struct __kernel_termios
#define _HAVE_C_ISPEED 1 #define _HAVE_C_ISPEED 1
#define _HAVE_C_OSPEED 1 #define _HAVE_C_OSPEED 1
#endif /* sys/kernel_termios.h */

View File

@ -105,7 +105,7 @@ struct ifreq
struct sockaddr ifru_netmask; struct sockaddr ifru_netmask;
struct sockaddr ifru_hwaddr; struct sockaddr ifru_hwaddr;
short int ifru_flags; short int ifru_flags;
int ifru_metric; int ifru_ivalue;
int ifru_mtu; int ifru_mtu;
struct ifmap ifru_map; struct ifmap ifru_map;
char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_slave[IFNAMSIZ]; /* Just fits the size */
@ -120,11 +120,12 @@ struct ifreq
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
#define ifr_flags ifr_ifru.ifru_flags /* flags */ #define ifr_flags ifr_ifru.ifru_flags /* flags */
#define ifr_metric ifr_ifru.ifru_metric /* metric */ #define ifr_metric ifr_ifru.ifru_ivalue /* metric */
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
#define ifr_map ifr_ifru.ifru_map /* device map */ #define ifr_map ifr_ifru.ifru_map /* device map */
#define ifr_slave ifr_ifru.ifru_slave /* slave device */ #define ifr_slave ifr_ifru.ifru_slave /* slave device */
#define ifr_data ifr_ifru.ifru_data /* for use by interface */ #define ifr_data ifr_ifru.ifru_data /* for use by interface */
#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
/* Structure used in SIOCGIFCONF request. Used to retrieve interface /* Structure used in SIOCGIFCONF request. Used to retrieve interface

View File

@ -29,6 +29,10 @@
__BEGIN_DECLS __BEGIN_DECLS
/* Some internals from deep down in the kernel. */
#define MAX_ADDR_LEN 7
/* This structure defines an ethernet arp header. */ /* This structure defines an ethernet arp header. */
/* ARP protocol opcodes. */ /* ARP protocol opcodes. */

View File

@ -1,6 +1,5 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx) Contributed by Richard Henderson (rth@tamu.edu).
Based on code written for the Intel by Richard Henderson (rth@tamu.edu).
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as

View File

@ -1,5 +1,10 @@
#ifndef _SYS_KERNEL_TERMIOS_H
#define _SYS_KERNEL_TERMIOS_H 1
/* The following corresponds to the values from the Linux 2.1.20 kernel. */ /* The following corresponds to the values from the Linux 2.1.20 kernel. */
/* We need the definition of tcflag_t, cc_t, and speed_t. */
#include <termbits.h>
#define __KERNEL_NCCS 19 #define __KERNEL_NCCS 19
struct __kernel_termios struct __kernel_termios
@ -11,3 +16,5 @@ struct __kernel_termios
cc_t c_line; /* line discipline */ cc_t c_line; /* line discipline */
cc_t c_cc[__KERNEL_NCCS]; /* control characters */ cc_t c_cc[__KERNEL_NCCS]; /* control characters */
}; };
#endif /* sys/kernel_termios.h */

View File

@ -91,22 +91,22 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
# Kludge alert: we use an implicit rule (in what we are generating here) # Kludge alert: we use an implicit rule (in what we are generating here)
# because that is the only way to tell Make that the one command builds all # because that is the only way to tell Make that the one command builds all
# the files. # the files.
(echo 'define $*-zones' ;\ (echo 'define $*-zones' ;\
awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\ awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^ ;\
echo 'endef' ;\ echo 'endef' ;\
echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\ echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
echo 'ifdef $*-zones' ;\ echo 'ifdef $*-zones' ;\
echo '$$(addprefix $$(datadir)/zone%/right/,$$($*-zones)): \' ;\ echo '$$(addprefix $$(inst_datadir)/zone%/right/,$$($*-zones)): \' ;\
echo '$< $$(objpfx)zic leapseconds yearistype' ;\ echo '$< $$(objpfx)zic leapseconds yearistype' ;\
echo ' $$(tzcompile)' ;\ echo ' $$(tzcompile)' ;\
echo '$$(addprefix $$(datadir)/zone%/posix/,$$($*-zones)): \' ;\ echo '$$(addprefix $$(inst_datadir)/zone%/posix/,$$($*-zones)): \' ;\
echo '$< $$(objpfx)zic /dev/null yearistype' ;\ echo '$< $$(objpfx)zic /dev/null yearistype' ;\
echo ' $$(tzcompile)' ;\ echo ' $$(tzcompile)' ;\
echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\ echo '$$(addprefix $$(inst_datadir)/zone%/,$$($*-zones)): \' ;\
echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\ echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
echo ' $$(tzcompile)' ;\ echo ' $$(tzcompile)' ;\
echo 'endif' ;\ echo 'endif' ;\
echo 'zonenames := $$(zonenames) $$($*-zones)' ;\ echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
) > $@.new ) > $@.new
mv $@.new $@ mv $@.new $@

View File

@ -85,9 +85,6 @@
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
#endif #endif
/* Prototype for the internal function to get information based on TZ. */
extern void __tzset_internal __P ((int always));
/* How many days come before each month (0-12). */ /* How many days come before each month (0-12). */
const unsigned short int __mon_yday[2][13] = const unsigned short int __mon_yday[2][13] =
{ {
@ -164,8 +161,10 @@ mktime (tp)
struct tm *tp; struct tm *tp;
{ {
#ifdef _LIBC #ifdef _LIBC
/* Update internal database according to current TZ setting. */ /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
__tzset_internal (1); time zone names contained in the external variable `tzname' shall
be set as if the tzset() function had been called. */
__tzset ();
#endif #endif
return __mktime_internal (tp, localtime_r, &localtime_offset); return __mktime_internal (tp, localtime_r, &localtime_offset);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. /* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -171,7 +171,7 @@ extern struct tm *gmtime __P ((__const time_t *__timer));
of *TIMER in the local timezone. */ of *TIMER in the local timezone. */
extern struct tm *localtime __P ((__const time_t *__timer)); extern struct tm *localtime __P ((__const time_t *__timer));
#ifdef __USE_REENTRANT #if defined __USE_POSIX || defined __USE_REENTRANT
/* Return the `struct tm' representation of *TIMER in UTC, /* Return the `struct tm' representation of *TIMER in UTC,
using *TP to store the result. */ using *TP to store the result. */
extern struct tm *__gmtime_r __P ((__const time_t *__timer, extern struct tm *__gmtime_r __P ((__const time_t *__timer,
@ -185,7 +185,7 @@ extern struct tm *__localtime_r __P ((__const time_t *__timer,
struct tm *__tp)); struct tm *__tp));
extern struct tm *localtime_r __P ((__const time_t *__timer, extern struct tm *localtime_r __P ((__const time_t *__timer,
struct tm *__tp)); struct tm *__tp));
#endif /* reentrant */ #endif /* POSIX or reentrant */
/* Compute the `struct tm' representation of *T, /* Compute the `struct tm' representation of *T,
offset OFFSET seconds east of UTC, offset OFFSET seconds east of UTC,
@ -201,7 +201,7 @@ extern char *asctime __P ((__const struct tm *__tp));
/* Equivalent to `asctime (localtime (timer))'. */ /* Equivalent to `asctime (localtime (timer))'. */
extern char *ctime __P ((__const time_t *__timer)); extern char *ctime __P ((__const time_t *__timer));
#ifdef __USE_REENTRANT #if defined __USE_POSIX || defined __USE_REENTRANT
/* Reentrant versions of the above functions. */ /* Reentrant versions of the above functions. */
/* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n" /* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
@ -211,7 +211,7 @@ extern char *asctime_r __P ((__const struct tm *__tp, char *__buf));
/* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */
extern char *ctime_r __P ((__const time_t *__timer, char *__buf)); extern char *ctime_r __P ((__const time_t *__timer, char *__buf));
#endif /* reentrant */ #endif /* POSIX or reentrant */
/* Defined in localtime.c. */ /* Defined in localtime.c. */

View File

@ -21,6 +21,7 @@
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <unistd.h>
#define NOID #define NOID
#include <tzfile.h> #include <tzfile.h>
@ -79,6 +80,7 @@ decode (const void *ptr)
void void
__tzfile_read (const char *file) __tzfile_read (const char *file)
{ {
static const char default_tzdir[] = TZDIR;
size_t num_isstd, num_isgmt; size_t num_isstd, num_isgmt;
register FILE *f; register FILE *f;
struct tzhead tzhead; struct tzhead tzhead;
@ -111,9 +113,19 @@ __tzfile_read (const char *file)
/* User specified the empty string; use UTC explicitly. */ /* User specified the empty string; use UTC explicitly. */
file = "Universal"; file = "Universal";
/* We must not allow to read an arbitrary file in a setuid program.
So we fail for any file which is not in the directory hierachy
starting at TZDIR. */
if (__libc_enable_secure
&& ((*file == '/'
&& memcmp (file, default_tzdir, sizeof (default_tzdir) - 1) != 0)
|| strstr (file, "../") != NULL))
/* This test a certainly a bit too restrictive but it should catch all
critical case. */
return;
if (*file != '/') if (*file != '/')
{ {
static const char default_tzdir[] = TZDIR;
const char *tzdir; const char *tzdir;
unsigned int len, tzdir_len; unsigned int len, tzdir_len;
char *new; char *new;