Skip to content

Commit

Permalink
update from main archive 960927
Browse files Browse the repository at this point in the history
Sat Sep 28 03:02:49 1996  Ulrich Drepper  <drepper@cygnus.com>
	* dirent/Makefile (routines): Add readdir_r.
	* dirent/readdir_r.c: New file.  Wrapper around readdir.c.
	* dirent/dirent.h: Add prototype for readdir_r.
	* misc/hsearch_r.c (ENTRY): Make field `used' of type `unsigned int'
	to prevent warnings.
	* sysdeps/unix/sysv/linux/getsysstats.c (get_proc_path):
 	Initialize `result'.

Sat Sep 28 01:16:42 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/strsep.c: Rename to __strsep and make strsep
	weak alias.
	* string/string.h: Add prototype for __strsep.
	* misc/mntent_r.c: Use __strsep instead of strsep to keep
	namespace clean.

	* sysdeps/stub/nanosleep.c: Rename to __libc_nanosleep and make
	__nanosleep and nanosleep weak aliases.
	* sysdeps/unix/sysv/linux/syscalls.list: Add __nanosleep as weak
	alias.
	* sysdeps/unix/sysv/linux/sleep.c: Call __nanosleep instead of
	nanosleep to keep namespace clean.

	* sysdeps/posix/ttyname.c (ttyname): Add cast to prevent warning.
	* sysdeps/posix/ttyname_r.c (ttyname_r): Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.

	* sysdeps/unix/nlist.c: Use ISO C definition since we don't always
	have prototype.

	* login/Makefile (headers): Add pty.h.
	* login/pty.h: New file.
	* sysdeps/generic/pty.h: Include <pty.h>.
	* login/pututline_r.c: Add cast to prevent warning.

	* gmon/gmon.c: Add prototype for __profile_frequency.
	(monstartup): Add cast to prevent warning.
	* sysdeps/generic/prof-freq.c: Change to use ISO C style definition.

	* locale/programs/ld-time.c (time_output): Write `era' information
	in correct order.

Sat Sep 28 00:11:08 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/syscalls.list: Add weak alias
	`adjtimex'.
	Set caller for mlock, mlockall, mremap, munlock, and munlockall
	to EXTRA.
	Reported by Matthias Urlichs <smurf@smurf.noris.de>.

1996-09-27  Paul Eggert  <eggert@twinsun.com>

	* strftime.c (strftime): Output incomplete formats like %E
	at end of string.

1996-09-27  Paul Eggert  <eggert@twinsun.com>

	* strftime.c (strftime): Add support for %EC and %Ey.
	Fix support for %EY.  This uses the new _nl_get_era_entry function.

Fri Sep 27 14:12:27 1996  Ulrich Drepper  <drepper@cygnus.com>

	Security related patch by Elliot Lee <sopwith@redhat.com> and
	David Holland <dholland@eecs.harvard.edu>.

	* inet/rexec.c (rexec): Increase size of `num' array from 8 to 32.
	* inet/ruserpass.c (ruserpass): Don't allow $HOME envvar to not exist.

	* sysdeps/generic/getenv.c (__secure_getenv): New function.  Return
	NULL when programs runs with SUID or SGID enabled.
	* sysdeps/stub/getenv.c: Make __secure_getenv an alias of getenv.
	* stdlib/stdlib.h: Add prototype for __secure_getenv.

	* locale/setlocale.c: Use __secure_getenv.
	* resolv/res_init.c: Likewise.
	* resolv/res_query.c: Likewise.
	* inet/ruserpass.c: Likewise.
	* sysdeps/posix/tempname.c: Likewise.
	* malloc/mtrace.c: Likewise.
	* catgets/catgets.c: Likewise.

	Make temporary file handling functions reentrant.

	* stdio-common/tmpnam.c: Rewrite to have own buffer to write
	result to.  The called __stdio_gen_tempname function must be
	thread safe.
	* stdio-common/tmpnam_r.c: New file.
	* stdio/stdio.h: Add prototype for `tmpnam_r'.
	Change prototype for __stdio_gen_tempname.
	* stdio/libio.h: Likewise.
	* sysdeps/posix/tempname.c: Add new parameters and use them instead
	of static buffer.
	Don't reset `indeces' when PID changed between calls.
	Don't fail for long running programs when index counter once
	reached the limit.
	* sysdeps/stub/tempname.c: Likewise.
	* stdio-common/tempnam.c: Provide local buffer as extra argument
	to __stdio_gen_tempname.  This makes this function reentrant.
	* stdio-common/tmpfile.c: Likewise.
	* stdio-common/temptest.c: Provide extra argument to
	__stdio_gen_tempname.
	* manual/filesys.texi: Describe tmpnam_r and add comments about
	reentrancy of the functions.

	* inet/rcmd.c: Fixed address length handling.

	* sysdeps/posix/mk-stdiolim.c: Count final \0 byte in L_tmpnam value.

	* time/strftime.c: Remove unused variables alt_digits and
 	end_alt_digits.

	* sysdeps/unix/sysv/linux/sys/sysinfo.h: Correct prototype names
	for get_nprocs and get_nprocs_conf.
	* sysdeps/generic/sys/sysinfo.h: Likewise.

	* stdlib/test-canon.c: Finally do the right fix.

	* misc/Makefile: Only compile force-wrapper when compiling
	reentrant libc.
  • Loading branch information
Ulrich Drepper committed Sep 28, 1996
1 parent c402982 commit d68171e
Show file tree
Hide file tree
Showing 52 changed files with 547 additions and 197 deletions.
128 changes: 120 additions & 8 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,14 +1,126 @@
Mon Sep 23 15:31:04 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
Sat Sep 28 03:02:49 1996 Ulrich Drepper <drepper@cygnus.com>

* hurd/Makefile ($(includedir)/rpc/netdb.h): There is no make
variable `top_srcdir' in libc; use $(..) instead.
* dirent/Makefile (routines): Add readdir_r.
* dirent/readdir_r.c: New file. Wrapper around readdir.c.
* dirent/dirent.h: Add prototype for readdir_r.

* sysdeps/mach/hurd/Makefile (rtld-installed-name): Delete special
definition. It was a *Mistake*. (With a capital M.)
* misc/hsearch_r.c (ENTRY): Make field `used' of type `unsigned int'
to prevent warnings.

* sysdeps/mach/getsysstats.c (__get_nprocs): Renamed from
__get_nproc.
(__get_nprocs_conf): Renamed from __get_nproc_conf.
* sysdeps/unix/sysv/linux/getsysstats.c (get_proc_path):
Initialize `result'.

Sat Sep 28 01:16:42 1996 Ulrich Drepper <drepper@cygnus.com>

* sysdeps/generic/strsep.c: Rename to __strsep and make strsep
weak alias.
* string/string.h: Add prototype for __strsep.
* misc/mntent_r.c: Use __strsep instead of strsep to keep
namespace clean.

* sysdeps/stub/nanosleep.c: Rename to __libc_nanosleep and make
__nanosleep and nanosleep weak aliases.
* sysdeps/unix/sysv/linux/syscalls.list: Add __nanosleep as weak
alias.
* sysdeps/unix/sysv/linux/sleep.c: Call __nanosleep instead of
nanosleep to keep namespace clean.

* sysdeps/posix/ttyname.c (ttyname): Add cast to prevent warning.
* sysdeps/posix/ttyname_r.c (ttyname_r): Likewise.
* sysdeps/posix/getcwd.c (__getcwd): Likewise.

* sysdeps/unix/nlist.c: Use ISO C definition since we don't always
have prototype.

* login/Makefile (headers): Add pty.h.
* login/pty.h: New file.
* sysdeps/generic/pty.h: Include <pty.h>.
* login/pututline_r.c: Add cast to prevent warning.

* gmon/gmon.c: Add prototype for __profile_frequency.
(monstartup): Add cast to prevent warning.
* sysdeps/generic/prof-freq.c: Change to use ISO C style definition.

* locale/programs/ld-time.c (time_output): Write `era' information
in correct order.

Sat Sep 28 00:11:08 1996 Ulrich Drepper <drepper@cygnus.com>

* sysdeps/unix/sysv/linux/syscalls.list: Add weak alias
`adjtimex'.
Set caller for mlock, mlockall, mremap, munlock, and munlockall
to EXTRA.
Reported by Matthias Urlichs <smurf@smurf.noris.de>.

1996-09-27 Paul Eggert <eggert@twinsun.com>

* strftime.c (strftime): Output incomplete formats like %E
at end of string.

1996-09-27 Paul Eggert <eggert@twinsun.com>

* strftime.c (strftime): Add support for %EC and %Ey.
Fix support for %EY. This uses the new _nl_get_era_entry function.

Fri Sep 27 14:12:27 1996 Ulrich Drepper <drepper@cygnus.com>

Security related patch by Elliot Lee <sopwith@redhat.com> and
David Holland <dholland@eecs.harvard.edu>.

* inet/rexec.c (rexec): Increase size of `num' array from 8 to 32.
* inet/ruserpass.c (ruserpass): Don't allow $HOME envvar to not exist.

* sysdeps/generic/getenv.c (__secure_getenv): New function. Return
NULL when programs runs with SUID or SGID enabled.
* sysdeps/stub/getenv.c: Make __secure_getenv an alias of getenv.
* stdlib/stdlib.h: Add prototype for __secure_getenv.

* locale/setlocale.c: Use __secure_getenv.
* resolv/res_init.c: Likewise.
* resolv/res_query.c: Likewise.
* inet/ruserpass.c: Likewise.
* sysdeps/posix/tempname.c: Likewise.
* malloc/mtrace.c: Likewise.
* catgets/catgets.c: Likewise.

Make temporary file handling functions reentrant.

* stdio-common/tmpnam.c: Rewrite to have own buffer to write
result to. The called __stdio_gen_tempname function must be
thread safe.
* stdio-common/tmpnam_r.c: New file.
* stdio/stdio.h: Add prototype for `tmpnam_r'.
Change prototype for __stdio_gen_tempname.
* stdio/libio.h: Likewise.
* sysdeps/posix/tempname.c: Add new parameters and use them instead
of static buffer.
Don't reset `indeces' when PID changed between calls.
Don't fail for long running programs when index counter once
reached the limit.
* sysdeps/stub/tempname.c: Likewise.
* stdio-common/tempnam.c: Provide local buffer as extra argument
to __stdio_gen_tempname. This makes this function reentrant.
* stdio-common/tmpfile.c: Likewise.
* stdio-common/temptest.c: Provide extra argument to
__stdio_gen_tempname.
* manual/filesys.texi: Describe tmpnam_r and add comments about
reentrancy of the functions.

* inet/rcmd.c: Fixed address length handling.

* sysdeps/posix/mk-stdiolim.c: Count final \0 byte in L_tmpnam value.

* time/strftime.c: Remove unused variables alt_digits and
end_alt_digits.

* sysdeps/unix/sysv/linux/sys/sysinfo.h: Correct prototype names
for get_nprocs and get_nprocs_conf.
* sysdeps/generic/sys/sysinfo.h: Likewise.

* stdlib/test-canon.c: Finally do the right fix.

* misc/Makefile: Only compile force-wrapper when compiling
reentrant libc.

Fri Sep 27 03:49:56 1996 Ulrich Drepper <drepper@cygnus.com>

Expand Down
2 changes: 1 addition & 1 deletion catgets/catgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ catopen (const char *cat_name, int flag)
return (nl_catd) -1;
}

if (getenv ("NLSPATH") != NULL)
if (__secure_getenv ("NLSPATH") != NULL)
result->nlspath = __strdup (getenv ("NLSPATH"));
else
result->nlspath = __strdup (NLSPATH);
Expand Down
2 changes: 1 addition & 1 deletion dirent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
subdir := dirent

headers := dirent.h direntry.h
routines := opendir closedir readdir rewinddir \
routines := opendir closedir readdir readdir_r rewinddir \
seekdir telldir scandir alphasort \
getdents dirfd
distribute := dirstream.h
Expand Down
7 changes: 7 additions & 0 deletions dirent/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ extern int closedir __P ((DIR * __dirp));
extern struct dirent *__readdir __P ((DIR * __dirp));
extern struct dirent *readdir __P ((DIR * __dirp));

#ifdef __USE_REENTRANT
/* Reentrant versio of `readdir'. Return in RESULT a pointer to the
next entry. */
extern int readdir_r __P ((DIR *__dirp, struct dirent *entry,
struct dirent **result));
#endif

/* Rewind DIRP to the beginning of the directory. */
extern void rewinddir __P ((DIR * __dirp));

Expand Down
37 changes: 37 additions & 0 deletions dirent/readdir_r.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* readdir_r - Reentrant version of readdir.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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 <dirent.h>

/* Some systems have reentrancy problems with their `readdir'
implementation so they have an additional `readdir_r' version. The
GNU version does not have these problems but for compatibility
reasons we provide this function. It is simply a wrapper around
the normal function.
The actual definition of this functions varies very strong from
system to system. We chose to follow the POSIX version. */
int
readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
{
*result = readdir (dirp);

return *result != NULL ? 0 : -1;
}
4 changes: 3 additions & 1 deletion gmon/gmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#include <string.h>
#include <unistd.h>

extern int __profile_frequency (void);

struct __bb *__bb_head; /* Head of basic-block list or NULL. */

struct gmonparam _gmonparam = { GMON_PROF_OFF };
Expand Down Expand Up @@ -128,7 +130,7 @@ DEFUN(monstartup, (lowpc, highpc), u_long lowpc AND u_long highpc)
p->tos[0].link = 0;

o = p->highpc - p->lowpc;
if (p->kcountsize < o)
if (p->kcountsize < (u_long) o)
{
#ifndef hp300
s_scale = ((float)p->kcountsize / o ) * SCALE_1_TO_1;
Expand Down
9 changes: 7 additions & 2 deletions inet/rcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#include <ctype.h>
#include <string.h>

#define MIN(A, B) ((A) < (B) ? (A) : (B))


int __ivaliduser __P((FILE *, u_int32_t, const char *, const char *));
static int __icheckhost __P((u_int32_t, char *));

Expand Down Expand Up @@ -92,7 +95,8 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
}
fcntl(s, F_SETOWN, pid);
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr_list[0], &sin.sin_addr, hp->h_length);
bcopy(hp->h_addr_list[0], &sin.sin_addr,
MIN (sizeof (sin.sin_addr), hp->h_length));
sin.sin_port = rport;
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
break;
Expand All @@ -114,7 +118,8 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
__set_errno (oerrno);
perror(0);
hp->h_addr_list++;
bcopy(hp->h_addr_list[0], &sin.sin_addr, hp->h_length);
bcopy(hp->h_addr_list[0], &sin.sin_addr,
MIN (sizeof (sin.sin_addr), hp->h_length));
(void)fprintf(stderr, _("Trying %s...\n"),
inet_ntoa(sin.sin_addr));
continue;
Expand Down
4 changes: 2 additions & 2 deletions inet/rexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
(void) write(s, "", 1);
port = 0;
} else {
char num[8];
char num[32];
int s2, sin2len;

s2 = socket(AF_INET, SOCK_STREAM, 0);
if (s2 < 0) {
(void) close(s);
Expand Down
11 changes: 8 additions & 3 deletions inet/ruserpass.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,14 @@ ruserpass(host, aname, apass)
int t, i, c, usedefault = 0;
struct stat stb;

hdir = getenv("HOME");
if (hdir == NULL)
hdir = ".";
hdir = __secure_getenv("HOME");
if (hdir == NULL) {
/* If we can't get HOME, fail instead of trying ".",
which is no improvement. This really should call
getpwuid(getuid()). */
/*hdir = ".";*/
return -1;
}

buf = alloca (strlen (hdir) + 8);

Expand Down
6 changes: 5 additions & 1 deletion libio/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,14 @@ extern int sprintf __P ((char*, __const char* format, ...));
extern int sscanf __P ((__const char* string, __const char* format, ...));
extern FILE* tmpfile __P ((void));
extern char* tmpnam __P ((char*));
#ifdef __USE_REENTRANT
extern char* tmpnam_r __P ((char*));
#endif
#ifdef __USE_SVID
extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
#endif
extern char *__stdio_gen_tempname __P ((__const char *dir, __const char *pfx,
extern char *__stdio_gen_tempname __P ((char *__buf, size_t bufsize,
__const char *dir, __const char *pfx,
int dir_search, size_t *lenptr,
FILE **streamptr));
extern int ungetc __P ((int c, FILE* fp));
Expand Down
6 changes: 3 additions & 3 deletions locale/programs/ld-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,11 @@ time_output (struct localedef_t *locale, const char *output_path)
++last_idx;

#if __BYTE_ORDER == __LITTLE_ENDIAN
# define ERA_B1 time->era_entries
# define ERA_B2 time->era_entries_ob
#else
# define ERA_B1 time->era_entries_ob
# define ERA_B2 time->era_entries
#else
# define ERA_B1 time->era_entries
# define ERA_B2 time->era_entries_ob
#endif
idx[1 + last_idx] = idx[last_idx];
for (num = 0; num < time->cur_num_era; ++num)
Expand Down
15 changes: 6 additions & 9 deletions locale/setlocale.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ setlocale (int category, const char *locale)
{
char *locale_path;
size_t locale_path_len;
const char *locpath_var;
char *composite;

/* Sanity check for CATEGORY argument. */
Expand All @@ -248,15 +249,11 @@ setlocale (int category, const char *locale)
locale_path = NULL;
locale_path_len = 0;

if (!__libc_enable_secure)
{
char *locpath_var = getenv ("LOCPATH");

if (locpath_var != NULL && locpath_var[0] != '\0')
if (__argz_create_sep (locpath_var, ':',
&locale_path, &locale_path_len) != 0)
return NULL;
}
locpath_var = __secure_getenv ("LOCPATH");
if (locpath_var != NULL && locpath_var[0] != '\0')
if (__argz_create_sep (locpath_var, ':',
&locale_path, &locale_path_len) != 0)
return NULL;

if (__argz_append (&locale_path, &locale_path_len,
LOCALE_PATH, sizeof (LOCALE_PATH)) != 0)
Expand Down
2 changes: 1 addition & 1 deletion login/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

subdir := login

headers := utmp.h utmpbits.h lastlog.h
headers := utmp.h utmpbits.h lastlog.h pty.h

routines := setutent endutent getutent getutid getutline pututline \
setutent_r endutent_r getutent_r getutid_r getutline_r \
Expand Down
43 changes: 43 additions & 0 deletions login/pty.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* pty.h - Functions for pseudo TTY handlung.
Copyright (C) 1996 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. */

#ifndef _PTY_H

#define _PTY_H 1
#include <features.h>

#include <termios.h>


__BEGIN_DECLS

/* Create pseudo tty master slave pair with NAME and set terminal
attributes according to TERMP and WINP and return handles for both
ends in AMASTER and ASLAVE. */
extern int openpty __P ((int *__amaster, int *__aslave, char *__name,
struct termios *__termp, struct winsize *__winp));

/* Create child process and establish the slave pseudo terminal as the
child's controlling terminal. */
extern int forkpty __P ((int *__amaster, char *__name,
struct termios *__termp, struct winsize *__winp));

__END_DECLS

#endif /* pty.h */
Loading

0 comments on commit d68171e

Please sign in to comment.