]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 31 Jul 1998 18:02:14 +0000 (18:02 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 31 Jul 1998 18:02:14 +0000 (18:02 +0000)
1998-07-31 17:59  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/unix/sysv/linux/Makefile [subdir==misc] (sysdep_routines):
Add sys_setresuid.

1998-07-30  Mark Kettenis  <kettenis@phys.uva.nl>

* sysdeps/unix/sysv/linux/syscalls.list: Add __syscall_setresuid
as real name for system call and make setresuid a weak alias.  Set
caller to seteuid.
* sysdeps/unix/sysv/linux/seteuid.c (seteuid): Implement using
`setresuid' syscall if availble.  Fixes problems with sendmail
which expects `seteuid' to not set the saved user ID.

1998-07-30 20:09 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

* time/tzset.c (__tzstring): Get rid of excessive cleverness
which was causing stack corruption.

1998-07-31 16:41 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

* argp/argp-fmtstream.c (__argp_fmtstream_update): Correct
off-by-one in wordwrap algorithm when there' a space at the
beginning of the buffer.

1998-07-31 15:45  Ulrich Drepper  <drepper@cygnus.com>

* Makerules (LDLIBS-c.so): Extend value instead of overwriting it.

ChangeLog
Makerules
argp/argp-fmtstream.c
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/seteuid.c
sysdeps/unix/sysv/linux/syscalls.list
time/tzset.c

index 7e2e42b1655a93b9c6cbece6cc6e87bf2fa4b28e..e918d29cac82ade9bf1ffd9efec9c1dc66c66207 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+1998-07-31 17:59  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/unix/sysv/linux/Makefile [subdir==misc] (sysdep_routines):
+       Add sys_setresuid.
+
+1998-07-30  Mark Kettenis  <kettenis@phys.uva.nl>
+
+       * sysdeps/unix/sysv/linux/syscalls.list: Add __syscall_setresuid
+       as real name for system call and make setresuid a weak alias.  Set
+       caller to seteuid.
+       * sysdeps/unix/sysv/linux/seteuid.c (seteuid): Implement using
+       `setresuid' syscall if availble.  Fixes problems with sendmail
+       which expects `seteuid' to not set the saved user ID.
+
+1998-07-30 20:09 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>
+
+       * time/tzset.c (__tzstring): Get rid of excessive cleverness
+       which was causing stack corruption.
+
+1998-07-31 16:41 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>
+
+       * argp/argp-fmtstream.c (__argp_fmtstream_update): Correct
+       off-by-one in wordwrap algorithm when there' a space at the
+       beginning of the buffer.
+
+1998-07-31 15:45  Ulrich Drepper  <drepper@cygnus.com>
+
+       * Makerules (LDLIBS-c.so): Extend value instead of overwriting it.
+
 1998-07-31 11:10  Ulrich Drepper  <drepper@cygnus.com>
 
        * elf/elf.h: Add lots of new symbols from Irix and Solaris.
index 1c79713732a16ff48f1039e32acd0537b51f766a..e8930e32a5b8a4682e21aafa68f04a8af5c21be2 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -396,7 +396,7 @@ elide-routines.ob += $(shared-only-routines)
 # since we define our own `.init' section specially.
 LDFLAGS-c.so = -nostdlib -nostartfiles
 # But we still want to link libc.so against $(gnulib).
-LDLIBS-c.so = $(gnulib)
+LDLIBS-c.so += $(gnulib)
 # Give libc.so an entry point and make it directly runnable itself.
 LDFLAGS-c.so += -e __libc_main
 # Pre-link the objects of libc_pic.a so that we can locally resolve
index 05e9e21f06f463f9849337e854f0b30d41349f6a..1649f15cbbeecd2d79a07cf84373be58bcdb345f 100644 (file)
@@ -213,10 +213,10 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
          if (nextline > buf)
            {
              /* Swallow separating blanks.  */
-             if (p > buf)
+             if (p >= buf)
                do
                  --p;
-               while (p > buf && isblank (*p));
+               while (p >= buf && isblank (*p));
              nl = p + 1;       /* The newline will replace the first blank. */
            }
          else
index 7de1008716e8a366106a6495887264f1c8cf523a..af53184cb25c92fc42f064c2e1ea70253550aaa5 100644 (file)
@@ -9,7 +9,7 @@ CPPFLAGS += -DHAVE_LLSEEK=1
 endif
 
 ifeq ($(subdir),misc)
-sysdep_routines += sysctl clone llseek getresuid getresgid
+sysdep_routines += sysctl clone llseek getresuid getresgid sys_setresuid
 
 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
                  sys/io.h sys/klog.h sys/kdaemon.h \
index 37fb72c020ba4cfd91354770fe823112f2e3798f..c8e3950cfa66b0184a4b26d2d75bc404413ad047 100644 (file)
@@ -1 +1,51 @@
-#include <sysdeps/unix/bsd/seteuid.c>
+/* Copyright (C) 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 <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifdef __NR_setresuid
+
+extern int __syscall_setresuid (uid_t ruid, uid_t euid, uid_t suid);
+
+int
+seteuid (uid_t uid)
+{
+  int result;
+
+  if (uid == (uid_t) ~0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* First try the syscall.  */
+  result = __syscall_setresuid (-1, uid, -1);
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use emulation.  This may not work
+       since `setreuid' also sets the saved user ID when UID is not
+       equal to the real user ID, making it impossible to switch back.  */
+    result = __setreuid (-1, uid);
+
+  return result;
+}
+#else
+# include <sysdeps/unix/bsd/seteuid.c>
+#endif
index e80fd845684bd5dcd96e89b3286f41acdece7521..6d06d0df99e7aaad8e99d64cdfe874aeb60c57f8 100644 (file)
@@ -71,12 +71,12 @@ setfsgid    EXTRA   setfsgid        1       setfsgid
 setfsuid       EXTRA   setfsuid        1       setfsuid
 setpgid                -       setpgid         2       __setpgid       setpgid
 setresgid      EXTRA   setresgid       3       setresgid
-setresuid      EXTRA   setresuid       3       setresuid
 sigaltstack    -       sigaltstack     2       __sigaltstack   sigaltstack
 sys_fstat      fxstat  fstat           2       __syscall_fstat
 sys_lstat      lxstat  lstat           2       __syscall_lstat
 sys_mknod      xmknod  mknod           3       __syscall_mknod
 sys_readv      readv   readv           3       __syscall_readv
+sys_setresuid  EXTRA   setresuid       3       __syscall_setresuid
 sys_stat       xstat   stat            2       __syscall_stat
 sys_writev     writev  writev          3       __syscall_writev
 sysinfo                EXTRA   sysinfo         1       sysinfo
index 9c8e5d7b9c73ca70f253fc9823bcfc85a0d5bd38..d4e3037260eda49743ba4d092d9dacec07fcc329 100644 (file)
@@ -88,66 +88,51 @@ static int tz_compute __P ((time_t timer, const struct tm *tm))
      internal_function;
 static void tzset_internal __P ((int always)) internal_function;
 \f
-/* Header for a list of buffers containing time zone strings.  */
-struct tzstring_head
+/* List of buffers containing time zone strings. */
+struct tzstring_l
 {
-  struct tzstring_head *next;
-  /* The buffer itself immediately follows the header.
-     The buffer contains zero or more (possibly overlapping) strings.
-     The last string is followed by 2 '\0's instead of the usual 1.  */
+  struct tzstring_l *next;
+  size_t len;  /* strlen(data) - doesn't count terminating NUL! */
+  char data[0];
 };
 
-/* First in a list of buffers containing time zone strings.
-   All the buffers but the last are read-only.  */
-static struct
-{
-  struct tzstring_head head;
-  char data[48];
-} tzstring_list;
-
-/* Size of the last buffer in the list, not counting its header.  */
-static size_t tzstring_last_buffer_size = sizeof tzstring_list.data;
+struct tzstring_l *tzstring_list;
 
-/* Allocate a time zone string with given contents.
-   The string will never be moved or deallocated.
-   However, its contents may be shared with other such strings.  */
+/* Allocate a permanent home for S.  It will never be moved or deallocated,
+   but may share space with other strings.
+   Don't modify the returned string. */
 char *
-__tzstring (string)
-     const char *string;
+__tzstring (const char *s)
 {
-  struct tzstring_head *h;
-  size_t needed;
   char *p;
+  struct tzstring_l *t, *u, *new;
+  size_t len = strlen(s);
 
-  /* Look through time zone string list for a duplicate of this one.  */
-  for (h = &tzstring_list.head;  ;  h = h->next)
-    {
-      for (p = (char *) (h + 1);  p[0] | p[1];  ++p)
-       if (strcmp (p, string) == 0)
+  /* Walk the list and look for a match.  If this string is the same
+     as the end of an already-allocated string, it can share space. */
+  for (u = t = tzstring_list; t; u = t, t = t->next)
+    if (len <= t->len)
+      {
+       p = &t->data[t->len - len];
+       if (strcmp (s, p) == 0)
          return p;
-      if (! h->next)
-       break;
-    }
+      }
 
-  /* No duplicate was found.  Copy to the end of this buffer if there's room;
-     otherwise, append a large-enough new buffer to the list and use it.  */
-  ++p;
-  needed = strlen (string) + 2; /* Need 2 trailing '\0's after last string.  */
+  /* Not found; allocate a new buffer. */
+  new = malloc (sizeof (struct tzstring_l) + len + 1);
+  if (!new)
+    return NULL;
 
-  if ((size_t) ((char *) (h + 1) + tzstring_last_buffer_size - p) < needed)
-    {
-      size_t buffer_size = tzstring_last_buffer_size;
-      while ((buffer_size *= 2) < needed)
-       continue;
-      h = malloc (sizeof *h + buffer_size);
-      if (h == NULL)
-       return NULL;
-      h->next = NULL;
-      tzstring_last_buffer_size = buffer_size;
-      p = (char *) (h + 1);
-    }
+  new->next = NULL;
+  new->len = len;
+  strcpy (new->data, s);
+
+  if (u)
+    u->next = new;
+  else
+    tzstring_list = new;
 
-  return strncpy (p, string, needed);
+  return new->data;
 }
 \f
 static char *old_tz = NULL;