aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-11-10 02:42:49 +0000
committerUlrich Drepper <drepper@redhat.com>1999-11-10 02:42:49 +0000
commit2864e767053317538feafa815046fff89e5a16be (patch)
treea52fa311533e331ee0dbf609092e5cf6dc554b82
parentf2b9733fd6af9cd7e2aac553db4b30c96b83f66c (diff)
downloadglibc-2864e767053317538feafa815046fff89e5a16be.tar.xz
glibc-2864e767053317538feafa815046fff89e5a16be.zip
Update.
1999-11-09 Ulrich Drepper <drepper@cygnus.com> * elf/dl-load.c (_dl_dst_count): Allow $ORIGIN to point to directory with the reference since this is as secure as using the object with the dependency. (_dl_dst_substitute): Likewise. * elf/dl-load.c (_dl_dst_count): Change strings in first two strncmp calls to allow reuse. (_dl_dst_substitute): Likewise. 1999-11-01 Arnold D. Robbins <arnold@skeeve.com> * posix/regex.c (init_syntax_once): move below definition of ISALNUM etc., then use ISALNUM to init the table, so that the word ops will work if i18n'ed. (SYNTAX): And subscript with 0xFF for 8bit character sets. 1999-11-09 Andreas Jaeger <aj@suse.de> * sysdeps/unix/getlogin_r.c (getlogin_r): Sync with getlogin implementation for ttyname_r call; fix inverted condition; return ut_user. Closes PR libc/1438. 1999-11-09 Ulrich Drepper <drepper@cygnus.com> * timezone/checktab.awk: Update from tzcode1999h. * timezone/africa: Update from tzdata1999i. * timezone/asia: Likewise. * timezone/australasia: Likewise. * timezone/backward: Likewise. * timezone/europe: Likewise. * timezone/northamerica: Likewise. * timezone/southamerica: Likewise. * timezone/iso3166.tab: Likewise. * timezone/zone.tab: Likewise. * sysdeps/unix/sysv/linux/bits/resource.h: Define values also as macros. Patch by brg@csua.berkeley.edu [PR libc/1439]. 1999-11-09 Andreas Jaeger <aj@suse.de> * posix/Makefile (tests): Added tst-getlogin. * posix/tst-getlogin.c: New file, contains simple tests for getlogin and getlogin_r. 1999-11-09 Andreas Schwab <schwab@suse.de> * misc/syslog.c: For LOG_PERROR only append a newline if necessary.
-rw-r--r--ChangeLog52
-rw-r--r--elf/dl-load.c38
-rw-r--r--manual/search.texi8
-rw-r--r--misc/syslog.c12
-rw-r--r--posix/Makefile2
-rw-r--r--posix/regex.c77
-rw-r--r--posix/tst-getlogin.c58
-rw-r--r--sysdeps/unix/getlogin_r.c32
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h3
-rw-r--r--timezone/africa30
-rw-r--r--timezone/asia85
-rw-r--r--timezone/australasia70
-rw-r--r--timezone/backward3
-rw-r--r--timezone/checktab.awk4
-rw-r--r--timezone/europe55
-rw-r--r--timezone/iso3166.tab17
-rw-r--r--timezone/northamerica68
-rw-r--r--timezone/southamerica147
-rw-r--r--timezone/zone.tab15
19 files changed, 450 insertions, 326 deletions
diff --git a/ChangeLog b/ChangeLog
index cd3953c9fa..f3d9cad5c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,55 @@
+1999-11-09 Ulrich Drepper <drepper@cygnus.com>
+
+ * elf/dl-load.c (_dl_dst_count): Allow $ORIGIN to point to
+ directory with the reference since this is as secure as using the
+ object with the dependency.
+ (_dl_dst_substitute): Likewise.
+
+ * elf/dl-load.c (_dl_dst_count): Change strings in first two
+ strncmp calls to allow reuse.
+ (_dl_dst_substitute): Likewise.
+
+1999-11-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ * posix/regex.c (init_syntax_once): move below definition of
+ ISALNUM etc., then use ISALNUM to init the table, so that
+ the word ops will work if i18n'ed.
+ (SYNTAX): And subscript with 0xFF for 8bit character sets.
+
+1999-11-09 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/getlogin_r.c (getlogin_r): Sync with getlogin
+ implementation for ttyname_r call; fix inverted condition; return
+ ut_user. Closes PR libc/1438.
+
+1999-11-09 Ulrich Drepper <drepper@cygnus.com>
+
+ * timezone/checktab.awk: Update from tzcode1999h.
+ * timezone/africa: Update from tzdata1999i.
+ * timezone/asia: Likewise.
+ * timezone/australasia: Likewise.
+ * timezone/backward: Likewise.
+ * timezone/europe: Likewise.
+ * timezone/northamerica: Likewise.
+ * timezone/southamerica: Likewise.
+ * timezone/iso3166.tab: Likewise.
+ * timezone/zone.tab: Likewise.
+
+ * sysdeps/unix/sysv/linux/bits/resource.h: Define values also as
+ macros. Patch by brg@csua.berkeley.edu [PR libc/1439].
+
+1999-11-09 Andreas Jaeger <aj@suse.de>
+
+ * posix/Makefile (tests): Added tst-getlogin.
+
+ * posix/tst-getlogin.c: New file, contains simple tests for
+ getlogin and getlogin_r.
+
+1999-11-09 Andreas Schwab <schwab@suse.de>
+
+ * misc/syslog.c: For LOG_PERROR only append a newline if
+ necessary.
+
1999-11-08 Ulrich Drepper <drepper@cygnus.com>
* elf/elf.h: Add STT_REGISTER, STT_HP_OPAQUE, and STT_ST_STUB
diff --git a/elf/dl-load.c b/elf/dl-load.c
index eb3c41577a..2d5478621b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -149,21 +149,31 @@ local_strdup (const char *s)
size_t
_dl_dst_count (const char *name, int is_path)
{
+ const char *const start = name;
size_t cnt = 0;
do
{
size_t len = 1;
- /* $ORIGIN is not expanded for SUID/GUID programs. */
- if ((((!__libc_enable_secure
- && strncmp (&name[1], "ORIGIN", 6) == 0 && (len = 7) != 0)
- || (strncmp (&name[1], "PLATFORM", 8) == 0 && (len = 9) != 0))
+ /* $ORIGIN is not expanded for SUID/GUID programs.
+
+ Note that it is no bug that the strings in the first two `strncmp'
+ calls are longer than the sequence which is actually tested. */
+ if ((((strncmp (&name[1], "ORIGIN}", 6) == 0
+ && (!__libc_enable_secure
+ || ((name[7] == '\0' || (is_path && name[7] == ':'))
+ && (name == start || (is_path && name[-1] == ':'))))
+ && (len = 7) != 0)
+ || (strncmp (&name[1], "PLATFORM}", 8) == 0 && (len = 9) != 0))
&& (name[len] == '\0' || name[len] == '/'
|| (is_path && name[len] == ':')))
|| (name[1] == '{'
- && ((!__libc_enable_secure
- && strncmp (&name[2], "ORIGIN}", 7) == 0 && (len = 9) != 0)
+ && ((strncmp (&name[2], "ORIGIN}", 7) == 0
+ && (!__libc_enable_secure
+ || ((name[9] == '\0' || (is_path && name[9] == ':'))
+ && (name == start || (is_path && name[-1] == ':'))))
+ && (len = 9) != 0)
|| (strncmp (&name[2], "PLATFORM}", 9) == 0
&& (len = 11) != 0))))
++cnt;
@@ -180,6 +190,7 @@ char *
_dl_dst_substitute (struct link_map *l, const char *name, char *result,
int is_path)
{
+ const char *const start = name;
char *last_elem, *wp;
/* Now fill the result path. While copying over the string we keep
@@ -195,8 +206,10 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
const char *repl;
size_t len;
- if ((((strncmp (&name[1], "ORIGIN", 6) == 0 && (len = 7) != 0)
- || (strncmp (&name[1], "PLATFORM", 8) == 0 && (len = 9) != 0))
+ /* Note that it is no bug that the strings in the first two `strncmp'
+ calls are longer than the sequence which is actually tested. */
+ if ((((strncmp (&name[1], "ORIGIN}", 6) == 0 && (len = 7) != 0)
+ || (strncmp (&name[1], "PLATFORM}", 8) == 0 && (len = 9) != 0))
&& (name[len] == '\0' || name[len] == '/'
|| (is_path && name[len] == ':')))
|| (name[1] == '{'
@@ -205,7 +218,12 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
&& (len = 11) != 0))))
{
repl = ((len == 7 || name[2] == 'O')
- ? (__libc_enable_secure ? NULL : l->l_origin)
+ ? (__libc_enable_secure
+ && ((name[len] != '\0'
+ && (!is_path || name[len] != ':'))
+ || (name != start
+ && (!is_path || name[-1] != ':')))
+ ? NULL : l->l_origin)
: _dl_platform);
if (repl != NULL && repl != (const char *) -1)
@@ -259,7 +277,7 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
size_t total;
char *result;
- /* Determine the nubmer of DST elements. */
+ /* Determine the number of DST elements. */
cnt = DL_DST_COUNT (s, 1);
/* If we do not have to replace anything simply copy the string. */
diff --git a/manual/search.texi b/manual/search.texi
index f561ef9e34..ec82e1cc2c 100644
--- a/manual/search.texi
+++ b/manual/search.texi
@@ -475,9 +475,11 @@ elements.
To remove a specific element matching @var{key} from the tree
@code{tdelete} can be used. It locates the matching element using the
same method as @code{tfind}. The corresponding element is then removed
-and the data if this tree node is returned by the function. If there is
-no matching entry in the tree nothing can be deleted and the function
-returns @code{NULL}.
+and a pointer to the parent of the deleted node is returned by the
+function. If there is no matching entry in the tree nothing can be
+deleted and the function returns @code{NULL}. If the root of the tree
+is deleted @code{tdelete} returns some unspecified value not equal to
+@code{NULL}.
@end deftypefun
@comment search.h
diff --git a/misc/syslog.c b/misc/syslog.c
index ee832fefbe..9690bf1da6 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -177,10 +177,14 @@ vsyslog(pri, fmt, ap)
v->iov_base = buf + msgoff;
v->iov_len = bufsize - msgoff;
- ++v;
- v->iov_base = (char *) "\n";
- v->iov_len = 1;
- (void)__writev(STDERR_FILENO, iov, 2);
+ /* Append a newline if necessary. */
+ if (buf[bufsize - 1] != '\n')
+ {
+ ++v;
+ v->iov_base = (char *) "\n";
+ v->iov_len = 1;
+ }
+ (void)__writev(STDERR_FILENO, iov, v - iov + 1);
}
/* Prepare for multiple users. We have to take care: open and
diff --git a/posix/Makefile b/posix/Makefile
index f8e72b65ae..7861bdf5f3 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -57,7 +57,7 @@ include ../Makeconfig
aux := init-posix environ
tests := tstgetopt testfnm runtests runptests \
- tst-preadwrite test-vfork regexbug1
+ tst-preadwrite test-vfork regexbug1 tst-getlogin
ifeq (yes,$(build-shared))
test-srcs := globtest
tests += wordexp-test
diff --git a/posix/regex.c b/posix/regex.c
index 16e91f1514..04df21e308 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -164,46 +164,6 @@ char *realloc ();
# define SWITCH_ENUM_CAST(x) (x)
# endif
-/* How many characters in the character set. */
-# define CHAR_SET_SIZE 256
-
-# ifdef SYNTAX_TABLE
-
-extern char *re_syntax_table;
-
-# else /* not SYNTAX_TABLE */
-
-static char re_syntax_table[CHAR_SET_SIZE];
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done;
-
- if (done)
- return;
-
- bzero (re_syntax_table, sizeof re_syntax_table);
-
- for (c = 'a'; c <= 'z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = 'A'; c <= 'Z'; c++)
- re_syntax_table[c] = Sword;
-
- for (c = '0'; c <= '9'; c++)
- re_syntax_table[c] = Sword;
-
- re_syntax_table['_'] = Sword;
-
- done = 1;
-}
-
-# endif /* not SYNTAX_TABLE */
-
-# define SYNTAX(c) re_syntax_table[c]
-
#endif /* not emacs */
/* Get the interface, including the syntax bits. */
@@ -276,6 +236,43 @@ init_syntax_once ()
# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
#endif
+#ifndef emacs
+/* How many characters in the character set. */
+# define CHAR_SET_SIZE 256
+
+# ifdef SYNTAX_TABLE
+
+extern char *re_syntax_table;
+
+# else /* not SYNTAX_TABLE */
+
+static char re_syntax_table[CHAR_SET_SIZE];
+
+static void
+init_syntax_once ()
+{
+ register int c;
+ static int done = 0;
+
+ if (done)
+ return;
+ bzero (re_syntax_table, sizeof re_syntax_table);
+
+ for (c = 0; c < CHAR_SET_SIZE; ++c)
+ if (ISALNUM (c))
+ re_syntax_table[c] = Sword;
+
+ re_syntax_table['_'] = Sword;
+
+ done = 1;
+}
+
+# endif /* not SYNTAX_TABLE */
+
+# define SYNTAX(c) re_syntax_table[((c) & 0xFF)]
+
+#endif /* emacs */
+
/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
use `alloca' instead of `malloc'. This is because using malloc in
re_search* or re_match* could cause memory leaks when C-g is used in
diff --git a/posix/tst-getlogin.c b/posix/tst-getlogin.c
new file mode 100644
index 0000000000..75c0c5c436
--- /dev/null
+++ b/posix/tst-getlogin.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 1999 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 <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+ char *login;
+ int errors = 0;
+
+ login = getlogin ();
+ if (login == NULL)
+ puts ("getlogin returned NULL, no further tests");
+ else
+ {
+ char name[1024];
+ int ret;
+
+ printf ("getlogin returned: `%s'\n", login);
+
+ ret = getlogin_r (name, sizeof (name));
+ if (ret == 0)
+ {
+ printf ("getlogin_r returned: `%s'\n", name);
+ if (strcmp (name, login) != 0)
+ {
+ puts ("Error: getlogin and getlogin_r returned different names");
+ ++errors;
+ }
+ }
+ else
+ {
+ printf ("Error: getlogin_r returned: %d (%s)\n",
+ ret, strerror (ret));
+ ++errors;
+ }
+ }
+
+ return errors != 0;
+}
diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c
index cb0545e08a..04b99056b0 100644
--- a/sysdeps/unix/getlogin_r.c
+++ b/sysdeps/unix/getlogin_r.c
@@ -40,20 +40,20 @@ getlogin_r (name, name_len)
int result = 0;
struct utmp *ut, line, buffer;
- {
- int d = __open ("/dev/tty", 0);
- if (d < 0)
- return errno;
+ /* Get name of tty connected to fd 0. Return if not a tty or
+ if fd 0 isn't open. Note that a lot of documentation says that
+ getlogin() is based on the controlling terminal---what they
+ really mean is "the terminal connected to standard input". The
+ getlogin() implementation of DEC Unix, SunOS, Solaris, HP-UX all
+ return NULL if fd 0 has been closed, so this is the compatible
+ thing to do. Note that ttyname(open("/dev/tty")) on those
+ systems returns /dev/tty, so that is not a possible solution for
+ getlogin(). */
- result = __ttyname_r (d, real_tty_path, sizeof (tty_pathname));
- (void) __close (d);
-
- if (result != 0)
- {
- __set_errno (result);
- return result;
- }
- }
+ result = __ttyname_r (0, real_tty_path, sizeof (tty_pathname));
+
+ if (result != 0)
+ return result;
real_tty_path += 5; /* Remove "/dev/". */
@@ -69,16 +69,16 @@ getlogin_r (name, name_len)
}
else
{
- size_t needed = strlen (ut->ut_line) + 1;
+ size_t needed = strlen (ut->ut_user) + 1;
- if (needed < name_len)
+ if (needed > name_len)
{
__set_errno (ERANGE);
result = ERANGE;
}
else
{
- memcpy (name, ut->ut_line, needed);
+ memcpy (name, ut->ut_user, needed);
result = 0;
}
}
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 42e0d36f19..fcff605892 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -219,6 +219,9 @@ struct rusage
enum __priority_which
{
PRIO_PROCESS = 0, /* WHO is a process ID. */
+#define PRIO_PROCESS PRIO_PROCESS
PRIO_PGRP = 1, /* WHO is a process group ID. */
+#define PRIO_PGRP PRIO_PGRP
PRIO_USER = 2 /* WHO is a user ID. */
+#define PRIO_USER PRIO_USER
};
diff --git a/timezone/africa b/timezone/africa
index d5d85444e8..69657c0176 100644
--- a/timezone/africa
+++ b/timezone/africa
@@ -1,4 +1,4 @@
-# @(#)africa 7.31
+# @(#)africa 7.32
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -7,8 +7,8 @@
# From Paul Eggert <eggert@twinsun.com> (1999-03-22):
#
# A good source for time zone historical data outside the U.S. is
-# Thomas G. Shanks, The International Atlas (4th edition),
-# San Diego: ACS Publications, Inc. (1995).
+# Thomas G. Shanks, The International Atlas (5th edition),
+# San Diego: ACS Publications, Inc. (1999).
#
# Gwillim Law <LAW@encmail.encompass.com> writes that a good source
# for recent time zone data is the International Air Transport
@@ -294,8 +294,6 @@ Zone Africa/Maseru 1:50:00 - LMT 1903 Mar
# Shanks reports the date as May 1, whereas Howse reports Jan; go with Shanks.
# For Liberia before 1972, Shanks reports -0:44, whereas Howse and Whitman
# each report -0:44:30; go with the more precise figure.
-#
-# From Shanks, as corrected by Whitman:
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Monrovia -0:43:08 - LMT 1882
-0:43:08 - MMT 1919 Mar # Monrovia Mean Time
@@ -320,18 +318,16 @@ Rule Libya 1986 only - Apr 4 0:00 1:00 S
Rule Libya 1986 only - Oct 3 0:00 0 -
Rule Libya 1987 1989 - Apr 1 0:00 1:00 S
Rule Libya 1987 1990 - Oct 1 0:00 0 -
-Rule Libya 1990 only - May 4 0:00 1:00 S
-Rule Libya 1996 only - Mar 30 2:00s 1:00 S
-Rule Libya 1996 only - Sep 30 2:00s 0 -
-Rule Libya 1997 only - Apr 4 0:00 1:00 S
-Rule Libya 1997 only - Oct 4 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Tripoli 0:52:44 - LMT 1920
1:00 Libya CE%sT 1959
2:00 - EET 1982
- 1:00 Libya CE%sT 1991
- 2:00 - EET 1996 Mar 30 3:00
- 1:00 Libya CE%sT 1997 Oct 4 0:00
+ 1:00 Libya CE%sT 1990 May 4
+# The following entries are all from Shanks;
+# the IATA SSIM data contain some obvious errors.
+ 2:00 - EET 1996 Sep 30
+ 1:00 - CET 1997 Apr 4
+ 1:00 1:00 CEST 1997 Oct 4
2:00 - EET
# Madagascar
@@ -409,8 +405,8 @@ Zone Africa/Maputo 2:10:20 - LMT 1903 Mar
2:00 - CAT
# Namibia
-# Shanks says DST transitions are at 0:00; go with IATA.
# The 1994-04-03 transition is from Shanks.
+# Shanks reports no DST after 1998-04; go with IATA.
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Namibia 1994 max - Sep Sun>=1 2:00 1:00 S
Rule Namibia 1995 max - Apr Sun>=1 2:00 0 -
@@ -458,9 +454,6 @@ Zone Africa/Kigali 2:00:16 - LMT 1935 Jun
2:00 - CAT
# St Helena
-# From Paul Eggert (1997-10-05):
-# Shanks says St Helena was 1W26 (-0:05:44) from 1890 to 1951,
-# but this is most likely a typo for 5W42, the longitude of Jamestown.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Atlantic/St_Helena -0:22:48 - LMT 1890 # Jamestown
-0:22:48 - JMT 1951 # Jamestown Mean Time
@@ -517,9 +510,6 @@ Rule SA 1943 1944 - Mar Sun>=15 2:00 0 -
Zone Africa/Johannesburg 1:52:00 - LMT 1892 Feb 8
1:30 - SAST 1903 Mar
2:00 SA SAST
-# Shanks erroneously claims that most of South Africa switched to 1:00
-# on 1994-04-03 at 00:00.
-#
# Marion and Prince Edward Is
# scientific station since 1947
# no information
diff --git a/timezone/asia b/timezone/asia
index 394877c490..fd174078ad 100644
--- a/timezone/asia
+++ b/timezone/asia
@@ -1,4 +1,4 @@
-# @(#)asia 7.48
+# @(#)asia 7.49
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@@ -7,9 +7,8 @@
# From Paul Eggert <eggert@twinsun.com> (1999-03-22):
#
# A good source for time zone historical data outside the U.S. is
-# Thomas G. Shanks, The International Atlas (4th edition),
-# San Diego: ACS Publications, Inc. (1995).
-# Except where otherwise noted, it is the source for the data below.
+# Thomas G. Shanks, The International A