Index: linux/libc/ChangeLog diff -u linux/libc/ChangeLog:1.184 linux/libc/ChangeLog:1.190 --- linux/libc/ChangeLog:1.184 Fri May 30 19:23:08 1997 +++ linux/libc/ChangeLog Wed Aug 27 19:58:16 1997 @@ -1,3 +1,170 @@ +Wed Aug 27 19:57:10 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.38 is released. + + * <_G_config.h>: change version to 5.4.38. + + * elf/libc/jump.params: set version to 5.4.38. + + * release.libc: update. + +Wed Aug 27 19:56:54 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * nls/msgcat.c (catopen): Check if the message file is + really a file. + +Tue Aug 26 07:01:20 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * libio/stdio/ferror.c (_IO_ferror): + * libio/stdio/putc.c (_IO_putc): New aliase for glibc + compatibility. + +Fri Aug 8 21:05:22 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * locale/setlocale.c (_Xsetlocale): New, weak alias for + X11R6 libraries compiled with glibc 2. + +Fri Aug 8 08:07:22 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.37 is released. + + * <_G_config.h>: change version to 5.4.37. + + * elf/libc/jump.params: set version to 5.4.37. + + * release.libc: update. + +Mon Aug 4 21:11:35 1997 Thorsten Kukuk (kukuk@vt.uni-paderborn.de) + + * clnt_udp.c (clntudp_call): don't decode xargs, if + xargs == NULL. + +Sun Aug 3 05:25:00 1997 Ulrich Drepper (drepper@cygnus.com) + + * libio/printf_fp.c (__printf_fp): Round number to even + according to IEEE 754-1985 4.1. + +Thu Jul 31 12:57:14 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * Makefile (clean.include): fix a typo. + +Thu Jul 31 10:34:55 1997 "Tomer Verona" + + * inet/rcmd.c (_validuser): Support "+" entries for host and + user. + +Sun Jul 20 12:06:57 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.36 is released. + + * <_G_config.h>: change version to 5.4.36. + + * elf/libc/jump.params: set version to 5.4.36. + + * release.libc: update. + +Sun Jul 20 10:57:50 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * : include . + + * ../include/Makefile: new. + + * Makeconfig (INCLUDE_DIR): new, set to ../include. + + * Makefile (lib, install, clean): include "include". + +Sat Jul 19 11:48:48 1997 Miquel van Smoorenburg + + * yp/yplib.c (yp_maplist): fix argument for xdr_domainname (). + +Sun Jul 13 11:33:06 1997 Ian Justman + + * ufc/Makefile (SRCS): add crypt_md5.c and md5.c. + + * ufc/crypt_md5.c: + * ufc/md5.c: + * ufc/md5.h: new. + + * ufc/crypt_util.c (crypt): call crypt_md5 (). + +Thu Jul 10 08:41:49 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.35 is released. + + * <_G_config.h>: change version to 5.4.35. + + * elf/libc/jump.params: set version to 5.4.35. + + * release.libc: update. + +Wed Jul 9 08:16:23 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * (signal): treat __FAVOR_BSD the same as + __USE_BSD_SIGNAL. + + * libio/fileops.c (_IO_file_underflow): Adjust pointers + before calling _IO_SYSREAD (). + + * posix/execvp.c (execvp): Handle ESTALE. + +Mon Jul 7 08:26:19 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * Makeconfig (CANONICAL_TARGET_MACHINE): recognize i686-linux. + (TARGET__MACHINE): Removed. + + * configure (TARGET__MACHINE): Added. + +Fri Jul 4 18:42:08 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * locale/cur_max.c: new for glibc compatibility. + +Tue Jul 1 14:05:25 1997 Bill Fenner + + * (struct ip): change ip_csum to ip_sum. + +Tue Jul 1 04:00:58 1997 Thorsten Kukuk + + * rpc/openchild.c: + * rpc/key_call.c: + * rpc/auth_des.c: fix some problems with secure rpc. + +Sun Jun 29 11:38:51 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * : new. + + * sysdeps/linux/Makefile (SRC2S): add quotactl.S. + + * sysdeps/linux/quotactl.S: new. + +Fri Jun 27 07:31:27 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.34 is released. + + * <_G_config.h>: change version to 5.4.34. + + * elf/libc/jump.params: set version to 5.4.34. + + * release.libc: update. + +Wed Jun 25 08:00:46 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * nls/msgcat-libc.c (libc_nls_init): save errno. + + * libio/genops.c: + * libio/strops.c: + * libio/libioP.h: + * libio/fileops.c: update from glibc 2. + +Thu Jun 12 02:10:32 1997 Helmut Geyer + + * grp/getgrnam.c: don't segfault if a /etc/groups entry for a + NIS group lacks the ':' or does not contain any members, + +Sun Jun 8 09:25:41 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * (tftphdr): change "tu_block" to unsigned + short. + Fri May 30 21:06:03 1997 H.J. Lu (hjl@gnu.ai.mit.edu) * version 5.4.33 is released. @@ -150,7 +317,7 @@ Tue Apr 29 05:29:08 1997 Miquel van Smoorenburg - * yp/yplib.c (): fix argument for xdr_domainname (). + * yp/yplib.c (__yp_dobind): fix argument for xdr_domainname (). Thu Apr 10 17:15:09 1997 H.J. Lu (hjl@gnu.ai.mit.edu) Index: linux/libc/Makeconfig diff -u linux/libc/Makeconfig:1.23 linux/libc/Makeconfig:1.25 --- linux/libc/Makeconfig:1.23 Thu Nov 14 01:25:25 1996 +++ linux/libc/Makeconfig Sun Jul 20 12:09:23 1997 @@ -15,6 +15,8 @@ include $(TOPDIR)/config.in +INCLUDE_DIR=../include + ifeq ($(NYS),true) NYS_DIR_SUFFIX=-nys endif @@ -393,8 +395,6 @@ CPP =$(CC) -E $(INC_CFLAGS) # $(XCFLAGS) RM =/bin/rm -TARGET__MACHINE = $(subst -unknown-,-,$(TARGET_MACHINE)) - ifeq ($(TARGET__MACHINE),i386-linux) CANONICAL_TARGET_MACHINE=ix86-linux endif @@ -404,6 +404,10 @@ endif ifeq ($(TARGET__MACHINE),i586-linux) +CANONICAL_TARGET_MACHINE=ix86-linux +endif + +ifeq ($(TARGET__MACHINE),i686-linux) CANONICAL_TARGET_MACHINE=ix86-linux endif Index: linux/libc/Makefile diff -u linux/libc/Makefile:1.21 linux/libc/Makefile:1.23 --- linux/libc/Makefile:1.21 Wed Jul 17 01:24:53 1996 +++ linux/libc/Makefile Fri Aug 8 12:12:44 1997 @@ -53,7 +53,16 @@ endif endif -all: lib +all: include lib + +include: + $(MAKE) -C $(INCLUDE_DIR) $@ + +install.include: + $(MAKE) -C $(INCLUDE_DIR) install + +clean.include: + $(MAKE) -C $(INCLUDE_DIR) clean lib: set -e; for i in $(DIRS); do \ @@ -67,7 +76,7 @@ $(MAKE) -C $$i $@; \ done -clean realclean: +clean realclean: clean.include $(RM) -f core *.o *.s *.sa *.so.* *.a verify.out $(RM) -rf $(OBJS_DIRS) for i in $(CLEAN_DIRS); do \ @@ -75,7 +84,7 @@ $(MAKE) -C $$i $@; \ done -install: install.elf +install: install.include install.elf install.elf: $(MAKE) -C elf install ELF=true Index: linux/libc/config.in diff -u linux/libc/config.in:1.38 linux/libc/config.in:1.40 --- linux/libc/config.in:1.38 Wed Jul 17 01:06:37 1996 +++ linux/libc/config.in Fri Aug 8 12:12:44 1997 @@ -5,14 +5,16 @@ HOST_BINDIR=/usr/bin TARGET_ROOTDIR=/ ifeq ($(ELF), true) -TARGET_MACHINE=i486-linux +TARGET_MACHINE=i586-unknown-linux-gnulibc1 +TARGET__MACHINE=i386-linux else -TARGET_MACHINE=i486-linuxaout +TARGET_MACHINE=i586-unknown-linux-gnulibc1aout +TARGET__MACHINE=i386-linuxaout endif TARGET_OS=linux TARGET_ARCH=i386 -TARGET_ARCH_x86=4 +TARGET_ARCH_x86=5 MALLOC=dl-malloc OLD_GCC=true -GCCVERSION=2.7.2.l.3 -GCC_ARCH_INC_DIR=/usr/lib/gcc-lib/i486-linux/2.7.2.l.3/include +GCCVERSION=2.7.2.3 +GCC_ARCH_INC_DIR=/usr/lib/gcc-lib/i586-unknown-linux-gnulibc1/2.7.2.3/include Index: linux/libc/configure diff -u linux/libc/configure:1.11 linux/libc/configure:1.12 --- linux/libc/configure:1.11 Tue Sep 24 12:02:40 1996 +++ linux/libc/configure Thu Jul 10 08:43:49 1997 @@ -354,6 +354,7 @@ echo Oops: Unknown target machine "$TARGET_MACHINE". ;; esac + TARGET__MACHINE=${TARGET_ARCH}-${TARGET_OS} fi fi } @@ -442,8 +443,10 @@ echo TARGET_ROOTDIR="${TARGET_ROOTDIR}" echo ifeq \(\$\(ELF\), true\) echo TARGET_MACHINE="${TARGET_MACHINE}" + echo TARGET__MACHINE="${TARGET__MACHINE}" echo else echo TARGET_MACHINE="${TARGET_MACHINE}aout" + echo TARGET__MACHINE="${TARGET__MACHINE}aout" echo endif echo TARGET_OS="${TARGET_OS}" echo TARGET_ARCH="${TARGET_ARCH}" Index: linux/libc/release.libc diff -u linux/libc/release.libc:1.51 linux/libc/release.libc:1.59 --- linux/libc/release.libc:1.51 Fri May 30 19:23:08 1997 +++ linux/libc/release.libc Wed Aug 27 19:56:10 1997 @@ -1,27 +1,9 @@ Hi, Gals and Guys, -I would like to release libc 5.4.33 to public in a day or 2. But -I was told libc 5.4.26 doesn't work with shadow-970211. I couldn't -reproduce the problem. I'd like to hear the results of libc 5.4.33 -and shadow-970211 before I release 5.4.33 to public. Thanks. - -I added the glibc stat support so that I can run netscape with -XFree86 compiled for glibc 2. Please check it out. - -I modified sysdeps/linux/i386/crt/gcrt0.S to call sbrk () before any -calls to malloc () which may be used by atexit () since not all malloc -implemenation allow the outside sbrk () calls. Please check if profile -still works fine. - -The NYS bug is suppposed to be fixed. If a service is not available, -the some NIS/NIS+ routines will give back a NULL pointer, but the -other functions expect a struct with the error code. Please check -it out. - -glibc's putenv () was used in libc 5.4.23 which breaks many TeX -binaries. You have to re-compile them with -DSMART_PUTENV. Otherwise -they won't work. Please see kpathsea/xputenv.c in those packages for -details. I backed this change out in libc 5.4.33. +I updated libio from glibc 2. libg++ 2.7.2.8 or above should be used +with this release. + +md5 support is added. I have modified the NIS support in libc, which is not compatible with the previous version, but is compatible with SunOS, Solaris, ... @@ -42,20 +24,20 @@ so that the old XFree86 binaries will run fine with the new XFree86 shared librraries compiled with libc 6.x/glibc 2.x. -If you use linux 2.1.x, you need libc 5.4.33 or above to compile libc +If you use linux 2.1.x, you need libc 5.4.38 or above to compile libc yourself. The pre-compiled libc should run fine under linux 2.1.x. Also this library is compiled with -D_REENTRANT so that errno is MT safe. The shared libraries are now compiled with -g1 which can provide minimum information when core dump happens. You can strip -libc.so.5.4.33 if you want. +libc.so.5.4.38 if you want. -Due to the new, improved locale, the Linux C library 5.4.33 is binary +Due to the new, improved locale, the Linux C library 5.4.38 is binary compatible with libc 5.3.12 but not vice versa. The binaries -compiled/linked with libc.so.5.4.33 may not run with libc.so.5.3.12. +compiled/linked with libc.so.5.4.38 may not run with libc.so.5.3.12. You may need to regenerate locale files for the new locale in libc -5.4.33 if you use locales other tha C/POSIX which are the defaults. +5.4.38 if you use locales other tha C/POSIX which are the defaults. The locale sources are at @@ -64,7 +46,7 @@ There are many security bug fixes. Please consult ChangeLog for details. Please let me know if there are more security bugs remains. -This is the beta release of the Linux C library 5.4.33. Please read +This is the beta release of the Linux C library 5.4.38. Please read the ChangeLog for details regarding changes/bug fixes. DISTRIBUTION SITES: @@ -85,11 +67,11 @@ DISTRIBUTION FILES: -1. libc-5.4.33.bin.tar.gz +1. libc-5.4.38.bin.tar.gz REQUIRED. This package contains the header files for libc, shared and static ELF libraries libc and libm, and the static ELF library libbsd.a. -The header files in libc-5.4.33.bin.tar.gz are not complete. You need to +The header files in libc-5.4.38.bin.tar.gz are not complete. You need to install the kernel source tree for the system-dependent header files. The header files are in lib-x.y.z.bin.tar.gz and libc-x.y.z.tar.gz. You @@ -100,11 +82,11 @@ to extract the header files without the binaries files. A separate tar file for the header files may cause unnecessary confusion. -2. libc-5.4.33.tar.gz +2. libc-5.4.38.tar.gz Source tree for libc and header files. -3. libc-5.4.32-5.4.33.diff.gz +3. libc-5.4.37-5.4.38.diff.gz Context diffs against the source tree from the previous libc release. Please make sure the empty libc/regex/rx.h is deleted. @@ -143,9 +125,9 @@ Linux kernel source code 1.99.10. You can comment out pthreads in DIRS in libc/sysdeps/Makefile. * gcc-2.7.2 or above and binutils-2.7.0.3 or above. -* ld.so-1.8.1 or above. The latest version can be obtained from +* ld.so-1.9.5 or above. The latest version can be obtained from ftp://ftp.ods.com/pub/linux -* libg++ 2.7.2.1 or above. This is only necessary for development +* libg++ 2.7.2.8 or above. This is only necessary for development using c++. BINARY INSTALLATION: @@ -175,7 +157,7 @@ rm -f /usr/include/wcstr.h /usr/include/mbstr.h rm -f /usr/include/ld_so_config.h /usr/include/localeinfo.h rm -rf /usr/include/netinet /usr/include/net /usr/include/pthread -gzip -dc libc-5.4.33.bin.tar.gz | tar xvf - +gzip -dc libc-5.4.38.bin.tar.gz | tar xvf - SOURCE INSTALLATION: @@ -241,4 +223,4 @@ H.J. hjl@gnu.ai.mit.edu -05/30/97 +08/27/97 Index: linux/libc/elf/libc/jump.params diff -u linux/libc/elf/libc/jump.params:1.86 linux/libc/elf/libc/jump.params:1.91 --- linux/libc/elf/libc/jump.params:1.86 Fri May 30 19:18:47 1997 +++ linux/libc/elf/libc/jump.params Wed Aug 27 12:37:18 1997 @@ -1 +1 @@ -Version=5.4.33 +Version=5.4.38 Index: linux/libc/grp/getgrnam.c diff -u linux/libc/grp/getgrnam.c:1.3 linux/libc/grp/getgrnam.c:1.4 --- linux/libc/grp/getgrnam.c:1.3 Fri Oct 4 15:52:50 1996 +++ linux/libc/grp/getgrnam.c Fri Jun 27 09:32:58 1997 @@ -111,7 +111,8 @@ outtmp[i-1] = '\0'; i = 0; c = strrchr(outtmp, ':'); - *(c+1) = '\0'; + if (c != NULL) + *(c+1) = '\0'; while (more_members[i] != NULL) { outtmp = realloc(outtmp, strlen(outtmp) @@ -120,7 +121,8 @@ strcat(outtmp, ","); i++; } - *(strrchr(outtmp, ',')) = '\0'; + c = strrchr(outtmp, ','); + if (c != NULL) *(c) = '\0'; strcat(outtmp, "\n"); outkey = outtmp; } Index: linux/libc/inet/rcmd.c diff -u linux/libc/inet/rcmd.c:1.7 linux/libc/inet/rcmd.c:1.8 --- linux/libc/inet/rcmd.c:1.7 Tue Dec 17 08:22:49 1996 +++ linux/libc/inet/rcmd.c Fri Aug 8 12:12:46 1997 @@ -413,17 +413,26 @@ if (hostvalid && (uservalid || *user == '\0')) return -1; - /* enable host from +@netgroup entry for host */ - if ('+' == ahost[0] && '@' == ahost[1] && '\0' != ahost[2]) + if ('+' == ahost[0] && '\0' == ahost[1]) + /* enable all hosts if + entry for host */ + hostvalid = 1; + else if ('+' == ahost[0] && '@' == ahost[1] && '\0' != ahost[2]) + /* enable host from +@netgroup entry for host */ hostvalid = _checknetgrouphost(rhost, &ahost[2], baselen); else hostvalid = _checkhost(rhost, ahost, baselen); + /* enable user from +@netgroup entry for user */ /* -@netgroup entry already gave uservalid=1 */ if (user[0] == '+') - if (user[1] == '@' && user[2] != '\0') + { + if (user[1] == '\0') + /* enable all users if + entry for user */ + uservalid = 1; + else if (user[1] == '@' && user[2] != '\0') uservalid = _checknetgroupuser(ruser, &user[2]); else uservalid = !strcmp(&user[1], ruser); + } else if (user[0] == '-') uservalid = -uservalid; else Index: linux/libc/libio/fileops.c diff -u linux/libc/libio/fileops.c:1.14 linux/libc/libio/fileops.c:1.16 --- linux/libc/libio/fileops.c:1.14 Mon Apr 7 09:47:29 1997 +++ linux/libc/libio/fileops.c Thu Jul 10 08:43:51 1997 @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 1993, 1995 Free Software Foundation This file is part of the GNU IO Library. This library is free @@ -24,7 +24,9 @@ /* written by Per Bothner (bothner@cygnus.com) */ -#define _POSIX_SOURCE +#ifndef _POSIX_SOURCE +# define _POSIX_SOURCE +#endif #include "libioP.h" #include #include @@ -35,11 +37,16 @@ extern int errno; #endif + +#ifdef _LIBC +# define open(Name, Flags, Prot) __open ((Name), (Flags), (Prot)) +#endif + /* An fstream can be in at most one of put mode, get mode, or putback mode. Putback mode is a variant of get mode. In a filebuf, there is only one current position, instead of two - separate get and put pointers. In get mode, the current posistion + separate get and put pointers. In get mode, the current position is that of gptr(); in put mode that of pptr(). The position in the buffer that corresponds to the position @@ -73,14 +80,14 @@ (The pointers save_gptr() and save_egptr() are the values of gptr() and egptr() at the time putback mode was entered.) The OS position corresponds to that of save_egptr(). - + LINE BUFFERED OUTPUT: During line buffered output, _IO_write_base==base() && epptr()==base(). However, ptr() may be anywhere between base() and ebuf(). This forces a call to filebuf::overflow(int C) on every put. If there is more space in the buffer, and C is not a '\n', then C is inserted, and pptr() incremented. - + UNBUFFERED STREAMS: If a filebuf is unbuffered(), the _shortbuf[1] is used as the buffer. */ @@ -100,9 +107,7 @@ fp->_IO_file_flags |= CLOSED_FILEBUF_FLAGS; _IO_link_in(fp); -#if 0 fp->_fileno = -1; -#endif } int @@ -133,8 +138,8 @@ } void -DEFUN(_IO_file_finish, (fp), - register _IO_FILE* fp) +DEFUN(_IO_file_finish, (fp, dummy), + register _IO_FILE* fp AND int dummy) { if (_IO_file_is_open(fp)) { @@ -142,7 +147,7 @@ if (!(fp->_flags & _IO_DELETE_DONT_CLOSE)) _IO_SYSCLOSE (fp); } - _IO_default_finish(fp); + _IO_default_finish(fp, 0); } _IO_FILE * @@ -184,7 +189,7 @@ _IO_mask_flags(fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING); if (read_write & _IO_IS_APPENDING) if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT) - == _IO_pos_BAD && errno != ESPIPE) + == _IO_pos_BAD && errno != ESPIPE) return NULL; _IO_link_in(fp); return fp; @@ -223,11 +228,11 @@ } /* Write TO_DO bytes from DATA to FP. - Then mark FP has having empty buffers. */ + Then mark FP as having empty buffers. */ int DEFUN(_IO_do_write, (fp, data, to_do), - register _IO_FILE *fp AND const char* data AND _IO_size_t to_do) + register _IO_FILE *fp AND const char* data AND _IO_size_t to_do) { _IO_size_t count; if (to_do == 0) @@ -240,7 +245,7 @@ unpredictable. */ fp->_offset = _IO_pos_BAD; else if (fp->_IO_read_end != fp->_IO_write_base) - { + { _IO_pos_t new_pos = _IO_SYSSEEK(fp, fp->_IO_write_base - fp->_IO_read_end, 1); if (new_pos == _IO_pos_BAD) @@ -269,7 +274,10 @@ #endif if (fp->_flags & _IO_NO_READS) - return EOF; + { + errno = EBADF; + return EOF; + } if (fp->_IO_read_ptr < fp->_IO_read_end) return *(unsigned char*)fp->_IO_read_ptr; @@ -283,37 +291,25 @@ _IO_switch_to_get_mode(fp); + /* This is very tricky. We have to adjust those + pointers before we call _IO_SYSREAD () since + we may longjump () out while waiting for + input. Those pointers may be screwed up. H.J. */ + fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base; + fp->_IO_read_end = fp->_IO_buf_base; + fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end + = fp->_IO_buf_base; + count = _IO_SYSREAD (fp, fp->_IO_buf_base, fp->_IO_buf_end - fp->_IO_buf_base); if (count <= 0) { - /* - * I think EAGAIN and EWOULDBLOCK should be treated as - * EOF. H.J. - */ -#ifdef EAGAIN -#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN - if (count == 0 || errno == EAGAIN - || errno == EWOULDBLOCK) -#else - if (count == 0 || errno == EAGAIN) -#endif -#else -#ifdef EWOULDBLOCK - if (count == 0 || errno == EWOULDBLOCK) -#else if (count == 0) -#endif -#endif fp->_flags |= _IO_EOF_SEEN; else - fp->_flags |= _IO_ERR_SEEN; - count = 0; + fp->_flags |= _IO_ERR_SEEN, count = 0; } - fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base; - fp->_IO_read_end = fp->_IO_buf_base + count; - fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end - = fp->_IO_buf_base; + fp->_IO_read_end += count; if (count == 0) return EOF; if (fp->_offset != _IO_pos_BAD) @@ -326,10 +322,11 @@ register _IO_FILE* f AND int ch) { if (f->_flags & _IO_NO_WRITES) /* SET ERROR */ - { - f->_flags |= _IO_ERR_SEEN; - return EOF; - } + { + f->_flags |= _IO_ERR_SEEN; + errno = EBADF; + return EOF; + } /* If currently reading or no buffer allocated. */ if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0) { @@ -378,7 +375,7 @@ /* char* ptr = cur_ptr(); */ if (fp->_IO_write_ptr > fp->_IO_write_base) if (_IO_do_flush(fp)) return EOF; - delta = fp->_IO_read_ptr - fp->_IO_read_end; + delta = fp->_IO_read_ptr - fp->_IO_read_end; if (delta != 0) { #ifdef TODO @@ -408,6 +405,10 @@ _IO_pos_t result; _IO_off_t delta, new_offset; long count; + /* POSIX.1 8.2.3.7 says that after a call the fflush() the file + offset of the underlying file must be exact. */ + int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end + && fp->_IO_write_base == fp->_IO_write_ptr); if (mode == 0) dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */ @@ -524,7 +525,8 @@ else { count = _IO_SYSREAD (fp, fp->_IO_buf_base, - fp->_IO_buf_end - fp->_IO_buf_base); + (must_be_exact + ? delta : fp->_IO_buf_end - fp->_IO_buf_base)); if (count < delta) { /* We weren't allowed to read, but try to seek the remainder. */ @@ -557,7 +559,11 @@ for (;;) { _IO_ssize_t count = _IO_read(fp->_fileno, buf, size); -#ifdef EINTR +#if 0 && defined EINTR + /* We must not do this optimization since POSIX.1 explicitly + requests that the stream operations must return with the + error EINTR if this happens. There must be the possibility + that stream operations time out. --drepper */ if (count == -1 && errno == EINTR) continue; #endif @@ -596,7 +602,11 @@ _IO_ssize_t count = _IO_write(f->_fileno, data, to_do); if (count == EOF) { -#ifdef EINTR +#if 0 && defined EINTR + /* We must not do this optimization since POSIX.1 explicitly + requests that the stream operations must return with the + error EINTR if this happens. There must be the + possibility that stream operations time out. --drepper */ if (errno == EINTR) continue; else @@ -680,7 +690,7 @@ if (_IO_do_write(f, s, count) == EOF) return n - to_do; to_do = dont_write; - + /* Now write out the remainder. Normally, this will fit in the buffer, but it's somewhat messier for line-buffered files, so we let _IO_default_xsputn handle the general case. */ @@ -745,7 +755,7 @@ else fp->_flags |= _IO_ERR_SEEN, count = 0; } - + s += count; more -= count; } Index: linux/libc/libio/genops.c diff -u linux/libc/libio/genops.c:1.11 linux/libc/libio/genops.c:1.12 --- linux/libc/libio/genops.c:1.11 Tue Apr 8 09:11:14 1997 +++ linux/libc/libio/genops.c Fri Jun 27 09:32:59 1997 @@ -53,7 +53,7 @@ int _IO_default_doallocate( _IO_FILE * ); void _IO_init( register _IO_FILE *, int ); int _IO_default_sync( _IO_FILE * ); -void _IO_default_finish( _IO_FILE * ); +void _IO_default_finish( _IO_FILE * , int); _IO_pos_t _IO_default_seekoff( register _IO_FILE *, _IO_off_t, int, int ); int _IO_sputbackc( register _IO_FILE *, int ); int _IO_sungetc( register _IO_FILE * ); @@ -326,11 +326,7 @@ _IO_FILE *f AND char *b AND char *eb AND int a) { if (f->_IO_buf_base && !(f->_flags & _IO_USER_BUF)) -#ifdef __linux__ FREE_BUF(f->_IO_buf_base, _IO_blen(f)); -#else - FREE_BUF(f->_IO_buf_base); -#endif f->_IO_buf_base = b; f->_IO_buf_end = eb; if (a) @@ -517,7 +513,6 @@ fp->_IO_save_end = NULL; fp->_markers = NULL; fp->_cur_column = 0; - fp->_fileno = -1; } int @@ -531,17 +526,13 @@ current implementation, this function can get called twice! */ void -DEFUN(_IO_default_finish, (fp), - _IO_FILE *fp) +DEFUN(_IO_default_finish, (fp, dummy), + _IO_FILE *fp AND int dummy) { struct _IO_marker *mark; if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) { -#ifdef __linux__ FREE_BUF(fp->_IO_buf_base, _IO_blen(fp)); -#else - FREE_BUF(fp->_IO_buf_base); -#endif fp->_IO_buf_base = fp->_IO_buf_end = NULL; } Index: linux/libc/libio/libioP.h diff -u linux/libc/libio/libioP.h:1.16 linux/libc/libio/libioP.h:1.17 --- linux/libc/libio/libioP.h:1.16 Sun Nov 3 02:51:28 1996 +++ linux/libc/libio/libioP.h Fri Jun 27 09:32:59 1997 @@ -112,8 +112,8 @@ /* The 'finish' function does any final cleaning up of an _IO_FILE object. It does not delete (free) it, but does everything else to finalize it/ It matches the streambuf::~streambuf virtual destructor. */ -typedef void (*_IO_finish_t) __P((_IO_FILE*)); /* finalize */ -#define _IO_FINISH(FP) JUMP0(__finish, FP) +typedef void (*_IO_finish_t) __P((_IO_FILE*, int)); /* finalize */ +#define _IO_FINISH(FP) JUMP1(__finish, FP, 0) /* The 'overflow' hook flushes the buffer. The second argument is a character, or EOF. @@ -303,7 +303,7 @@ extern int _IO_default_underflow __P((_IO_FILE*)); extern int _IO_default_uflow __P((_IO_FILE*)); extern int _IO_default_doallocate __P((_IO_FILE*)); -extern void _IO_default_finish __P((_IO_FILE *)); +extern void _IO_default_finish __P((_IO_FILE *, int)); extern int _IO_default_pbackfail __P((_IO_FILE*, int)); extern _IO_FILE* _IO_default_setbuf __P((_IO_FILE *, char*, _IO_ssize_t)); extern _IO_size_t _IO_default_xsputn __P((_IO_FILE *, const void*, _IO_size_t)); @@ -360,7 +360,7 @@ extern int _IO_file_sync __P((_IO_FILE*)); extern int _IO_file_close_it __P((_IO_FILE*)); extern _IO_fpos_t _IO_file_seek __P((_IO_FILE *, _IO_off_t, int)); -extern void _IO_file_finish __P((_IO_FILE*)); +extern void _IO_file_finish __P((_IO_FILE*, int)); /* Other file functions. */ extern _IO_FILE* _IO_file_attach __P((_IO_FILE *, int)); @@ -417,7 +417,7 @@ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); \ if (_B == (char *) -1) return (_R) #else -#define FREE_BUF(_B) free(_B) +#define FREE_BUF(_B, _S) free(_B) #define ALLOC_BUF(_B,_S,_R) _B = (char*)malloc(_S); \ if (_B == NULL) return (_R) #endif Index: linux/libc/libio/printf_fp.c diff -u linux/libc/libio/printf_fp.c:1.7 linux/libc/libio/printf_fp.c:1.8 --- linux/libc/libio/printf_fp.c:1.7 Tue Dec 17 08:22:50 1996 +++ linux/libc/libio/printf_fp.c Fri Aug 8 12:12:47 1997 @@ -786,13 +786,24 @@ { char *tp = cp; - if (digit == '5') + if (digit == '5' && (*(cp - 1) & 1) == 0) /* This is the critical case. */ if (fracsize == 1 && frac[0] == 0) /* Rest of the number is zero -> round to even. (IEEE 754-1985 4.1 says this is the default rounding.) */ - if ((*(cp - 1) & 1) == 0) - goto do_expo; + goto do_expo; + else if (scalesize == 0) + { + /* Here we have to see whether all limbs are zero since no + normalization happened. */ + size_t lcnt = fracsize; + while (lcnt >= 1 && frac[lcnt - 1] == 0) + --lcnt; + if (lcnt == 0) + /* Rest of the number is zero -> round to even. + (IEEE 754-1985 4.1 says this is the default rounding.) */ + goto do_expo; + } if (fracdig_no > 0) { Index: linux/libc/libio/strops.c diff -u linux/libc/libio/strops.c:1.5 linux/libc/libio/strops.c:1.6 --- linux/libc/libio/strops.c:1.5 Fri Oct 4 15:52:58 1996 +++ linux/libc/libio/strops.c Fri Jun 27 09:33:00 1997 @@ -65,7 +65,7 @@ _IO_ssize_t _IO_str_count( register _IO_FILE * ); _IO_pos_t _IO_str_seekoff( register _IO_FILE *, _IO_off_t, int, int ); int _IO_str_pbackfail( register _IO_FILE *, int ); -void _IO_str_finish( register _IO_FILE * ); +void _IO_str_finish( register _IO_FILE *, int); void DEFUN(_IO_str_init_static, (fp, ptr, size, pstart), @@ -267,14 +267,14 @@ } void -DEFUN (_IO_str_finish, (fp), - register _IO_FILE* fp) +DEFUN (_IO_str_finish, (fp, dummy), + register _IO_FILE* fp AND int dummy) { if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) (((_IO_strfile*)fp)->_s._free_buffer)(fp->_IO_buf_base); fp->_IO_buf_base = NULL; - _IO_default_finish(fp); + _IO_default_finish(fp, 0); } struct _IO_jump_t _IO_str_jumps = { Index: linux/libc/libio/stdio/ferror.c diff -u linux/libc/libio/stdio/ferror.c:1.3 linux/libc/libio/stdio/ferror.c:1.4 --- linux/libc/libio/stdio/ferror.c:1.3 Sat Aug 5 23:18:48 1995 +++ linux/libc/libio/stdio/ferror.c Wed Aug 27 12:37:19 1997 @@ -1,5 +1,8 @@ #include "libioP.h" #include "stdio.h" +#include + +#pragma weak ferror int ferror(fp) @@ -8,3 +11,6 @@ CHECK_FILE(fp, EOF); return _IO_ferror(fp); } + +#undef _IO_ferror +elf_alias (ferror, _IO_ferror); Index: linux/libc/libio/stdio/putc.c diff -u linux/libc/libio/stdio/putc.c:1.4 linux/libc/libio/stdio/putc.c:1.5 --- linux/libc/libio/stdio/putc.c:1.4 Fri Oct 4 15:53:00 1996 +++ linux/libc/libio/stdio/putc.c Wed Aug 27 12:37:20 1997 @@ -1,5 +1,6 @@ #include "libioP.h" #include "stdio.h" +#include #undef putc @@ -26,3 +27,5 @@ #endif /* __GNUC__ */ #endif /* __ELF__ */ #endif /* _LIBPTHREAD */ + +elf_alias (putc, _IO_putc); Index: linux/libc/locale/Makefile diff -u linux/libc/locale/Makefile:1.11 linux/libc/locale/Makefile:1.12 --- linux/libc/locale/Makefile:1.11 Fri Sep 13 01:44:22 1996 +++ linux/libc/locale/Makefile Thu Jul 10 08:43:51 1997 @@ -16,7 +16,7 @@ -Iprograms $(BASE_CFLAGS) SRCS = setlocale.c loadlocale.c localeconv.c nl_langinfo.c \ - $(categories:%=lc-%.c) $(categories:%=C-%.c) \ + $(categories:%=lc-%.c) $(categories:%=C-%.c) cur_max.c \ explodename.c l10nflist.c findlocale.c C_name.c localealias.c categories = ctype messages monetary numeric time collate Index: linux/libc/locale/cur_max.c diff -u /dev/null linux/libc/locale/cur_max.c:1.1 --- /dev/null Tue Sep 2 13:36:33 1997 +++ linux/libc/locale/cur_max.c Thu Jul 10 08:43:52 1997 @@ -0,0 +1,48 @@ +/* Return number of characters in multibyte representation for current + character set. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include +#include "localeinfo.h" + + +/* This is a gross hack to get borken programs running. + + ISO C provides no mean to find out how many bytes the wide + character representation really uses. But it defines MB_CUR_LEN to + return the information for the multi-byte character representation. + Many programmers don't know the difference between the two and + thing this means the same. But assuming all characters have a size + of MB_CUR_LEN after they have been processed by `mbrtowc' is wrong. + Instead the maximal number of character used for the conversion is + MB_CURLEN. + + It is known that some Motif applications have this problem. To + cure this one has to make sure the glibc uses the function in this + file instead of the one in locale/mb_cur_max.c. This can either be + done by linking with this file or by using the LD_PRELOAD feature + of the dynamic linker. */ +int +__ctype_get_mb_cur_max (void) +{ + return 1; +} Index: linux/libc/locale/setlocale.c diff -u linux/libc/locale/setlocale.c:1.10 linux/libc/locale/setlocale.c:1.11 --- linux/libc/locale/setlocale.c:1.10 Fri Oct 4 15:53:02 1996 +++ linux/libc/locale/setlocale.c Wed Aug 27 12:37:20 1997 @@ -26,6 +26,9 @@ #include "localeinfo.h" +/* For X11R6 libraries compiled with glibc 2. */ +#pragma weak _Xsetlocale = setlocale + extern char *__libc_secure_getenv(const char *); extern void _nl_free_locale (const struct locale_data *); extern void _nl_free_locale_file_list( int ); Index: linux/libc/nls/msgcat-libc.c diff -u linux/libc/nls/msgcat-libc.c:1.1.1.1 linux/libc/nls/msgcat-libc.c:1.2 --- linux/libc/nls/msgcat-libc.c:1.1.1.1 Fri Feb 17 21:33:23 1995 +++ linux/libc/nls/msgcat-libc.c Fri Jun 27 09:33:01 1997 @@ -7,12 +7,14 @@ #ifdef __linux__ #include #include +#include #include "nl_types.h" #define CATALOGUE "libc" nl_catd _libc_cat = 0; void libc_nls_init(void) { extern nl_catd _libc_cat; + int saved_errno = errno; if (_libc_cat != 0) /* * Either a previous catopen() failed @@ -24,6 +26,7 @@ /* Get the environment setting for LC_MESSAGES */ setlocale(LC_MESSAGES,""); _libc_cat=catopen(CATALOGUE,0); + errno = saved_errno; } #endif Index: linux/libc/nls/msgcat.c diff -u linux/libc/nls/msgcat.c:1.7 linux/libc/nls/msgcat.c:1.8 --- linux/libc/nls/msgcat.c:1.7 Fri Mar 14 20:03:04 1997 +++ linux/libc/nls/msgcat.c Wed Aug 27 19:56:10 1997 @@ -1,5 +1,5 @@ #if 0 -static char rcsid[] = "@(#)$Id: msgcat.c,v 1.6 1996/10/04 22:53:05 hjl Exp $"; +static char rcsid[] = "@(#)$Id: msgcat.c,v 1.7 1997/03/15 04:03:04 hjl Exp $"; #endif /* -*- c++ -*- */ @@ -208,7 +208,7 @@ } } *pathP = '\0'; - if (stat(path, &sbuf) == 0) { + if (stat(path, &sbuf) == 0 && S_ISREG (sbuf.st_mode)) { catpath = path; break; } Index: linux/libc/posix/execvp.c diff -u linux/libc/posix/execvp.c:1.3 linux/libc/posix/execvp.c:1.4 --- linux/libc/posix/execvp.c:1.3 Fri Oct 4 15:53:08 1996 +++ linux/libc/posix/execvp.c Thu Jul 10 08:43:54 1997 @@ -112,6 +112,7 @@ { case ENOENT: case EACCES: + case ESTALE: /* Those errors indicate the file is missing or not executable by us, in which case we want to just try the next path directory. */ Index: linux/libc/rpc/auth_des.c diff -u linux/libc/rpc/auth_des.c:1.3 linux/libc/rpc/auth_des.c:1.4 --- linux/libc/rpc/auth_des.c:1.3 Sun Oct 20 21:40:19 1996 +++ linux/libc/rpc/auth_des.c Thu Jul 10 08:43:54 1997 @@ -1,5 +1,5 @@ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)auth_des.c 2.2 88/07/29 4.0 RPCSRC; from 1.9 88/02/08 SMI"; +static char sccsid[] = "@(#)auth_des.c 2.2 88/07/29 4.0 RPCSRC; from 1.9 88/02/08 SMI"; #endif /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -8,23 +8,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -35,12 +35,14 @@ /* * auth_des.c, client-side implementation of DES authentication */ + +#include #include #include -#include #include #include -#include /* XXX: just to get htonl() and ntohl() */ +#include +#include /* XXX: just to get htonl() and ntohl() */ #include #define MILLION 1000000L @@ -51,416 +53,409 @@ #define FREE(ptr, size) mem_free((char *)(ptr), (int) size) #define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE) -#define debug(msg) /*printf("%s\n", msg) */ +#define debug(msg) /* printf("%s\n", msg) */ -extern int getnetname ( char * ); -extern int key_gendes ( des_block * ); -extern bool_t xdr_authdes_cred ( XDR *, struct authdes_cred * ); -extern bool_t xdr_authdes_verf ( register XDR *, - register struct authdes_verf * ); -extern int key_encryptsession __P (( char *, des_block * )); -extern int rtime ( struct sockaddr_in *, - struct timeval *, - struct timeval * ); +extern int rtime (struct sockaddr_in *, struct timeval *, struct timeval *); +extern bool_t xdr_authdes_cred (XDR *, struct authdes_cred *); +extern bool_t xdr_authdes_verf (XDR *, struct authdes_verf *); -/* +/* * DES authenticator operations vector */ -#ifdef __STDC__ -AUTH *authdes_create ( char *, u_int, struct sockaddr *, - des_block * ); -static void authdes_nextverf ( AUTH * ); -static bool_t authdes_marshal ( AUTH *, XDR * ); -static bool_t authdes_validate ( AUTH *, struct opaque_auth * ); -static bool_t authdes_refresh ( AUTH * ); -static void authdes_destroy ( AUTH * ); -static bool_t synchronize ( struct sockaddr *, struct timeval * ); -#else -AUTH *authdes_create(); -static void authdes_nextverf(); -static bool_t authdes_marshal(); -static bool_t authdes_validate(); -static bool_t authdes_refresh(); -static void authdes_destroy(); -static bool_t synchronize(); -#endif +AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *); +AUTH *authdes_pk_create (const char *, netobj *, u_int, + struct sockaddr *, des_block *); +static void authdes_nextverf (AUTH *); +static bool_t authdes_marshal (AUTH *, XDR *); +static bool_t authdes_validate (AUTH *, struct opaque_auth *); +static bool_t authdes_refresh (AUTH *); +static void authdes_destroy (AUTH *); +static bool_t synchronize (struct sockaddr *, struct timeval *); -static struct auth_ops authdes_ops = { - authdes_nextverf, - authdes_marshal, - authdes_validate, - authdes_refresh, - authdes_destroy +static struct auth_ops authdes_ops = +{ + authdes_nextverf, + authdes_marshal, + authdes_validate, + authdes_refresh, + authdes_destroy }; /* * This struct is pointed to by the ah_private field of an "AUTH *" */ -struct ad_private { - char *ad_fullname; /* client's full name */ - u_int ad_fullnamelen; /* length of name, rounded up */ - char *ad_servername; /* server's full name */ - u_int ad_servernamelen; /* length of name, rounded up */ - u_int ad_window; /* client specified window */ - bool_t ad_dosync; /* synchronize? */ - struct sockaddr ad_syncaddr; /* remote host to synch with */ - struct timeval ad_timediff; /* server's time - client's time */ - u_long ad_nickname; /* server's nickname for client */ - struct authdes_cred ad_cred; /* storage for credential */ - struct authdes_verf ad_verf; /* storage for verifier */ - struct timeval ad_timestamp; /* timestamp sent */ - des_block ad_xkey; /* encrypted conversation key */ -}; - +struct ad_private + { + char *ad_fullname; /* client's full name */ + u_int ad_fullnamelen; /* length of name, rounded up */ + char *ad_servername; /* server's full name */ + u_int ad_servernamelen; /* length of name, rounded up */ + u_int ad_window; /* client specified window */ + bool_t ad_dosync; /* synchronize? */ + struct sockaddr ad_syncaddr; /* remote host to synch with */ + struct timeval ad_timediff; /* server's time - client's time */ + u_long ad_nickname; /* server's nickname for client */ + struct authdes_cred ad_cred; /* storage for credential */ + struct authdes_verf ad_verf; /* storage for verifier */ + struct timeval ad_timestamp; /* timestamp sent */ + des_block ad_xkey; /* encrypted conversation key */ + u_char ad_pkey[1024]; /* Servers actual public key */ + }; + + /* * Create the client des authentication object */ -#ifdef __STDC__ -AUTH * -authdes_create( char *servername, u_int window, - struct sockaddr *syncaddr, des_block *ckey ) -#else AUTH * -authdes_create(servername, window, syncaddr, ckey) - char *servername; /* network name of server */ - u_int window; /* time to live */ - struct sockaddr *syncaddr; /* optional addr of host to sync with */ - des_block *ckey; /* optional conversation key to use*/ -#endif +authdes_create (char *servername, u_int window, + struct sockaddr *syncaddr, des_block * ckey) + /* servername - network name of server */ + /* window - time to live */ + /* syncaddr - optional addr of host to sync with */ + /* ckey - optional conversation key to use */ { + u_char pkey_data[1024]; + netobj pkey; - AUTH *auth; - struct ad_private *ad; - char namebuf[MAXNETNAMELEN+1]; - - /* - * Allocate everything now - */ - auth = ALLOC(AUTH); - ad = ALLOC(struct ad_private); - (void) getnetname(namebuf); - - ad->ad_fullnamelen = RNDUP(strlen(namebuf)); - ad->ad_fullname = mem_alloc(ad->ad_fullnamelen + 1); - - ad->ad_servernamelen = strlen(servername); - ad->ad_servername = mem_alloc(ad->ad_servernamelen + 1); - - if (auth == NULL || ad == NULL || ad->ad_fullname == NULL || - ad->ad_servername == NULL) { - debug("authdes_create: out of memory"); - goto failed; - } + if (!getpublickey (servername, pkey_data)) + return (NULL); - /* - * Set up private data - */ - bcopy(namebuf, ad->ad_fullname, ad->ad_fullnamelen + 1); - bcopy(servername, ad->ad_servername, ad->ad_servernamelen + 1); - if (syncaddr != NULL) { - ad->ad_syncaddr = *syncaddr; - ad->ad_dosync = TRUE; - } else { - ad->ad_dosync = FALSE; - } - ad->ad_window = window; - if (ckey == NULL) { - if (key_gendes(&auth->ah_key) < 0) { - debug("authdes_create: unable to gen conversation key"); - return (NULL); - } - } else { - auth->ah_key = *ckey; - } + pkey.n_bytes = (char *) pkey_data; + pkey.n_len = strlen ((char *) pkey_data) + 1; + return authdes_pk_create (servername, &pkey, window, syncaddr, ckey); +} - /* - * Set up auth handle - */ - auth->ah_cred.oa_flavor = AUTH_DES; - auth->ah_verf.oa_flavor = AUTH_DES; - auth->ah_ops = &authdes_ops; - auth->ah_private = (caddr_t)ad; - - if (!authdes_refresh(auth)) { - goto failed; - } - return (auth); +AUTH * +authdes_pk_create (const char *servername, netobj * pkey, u_int window, + struct sockaddr * syncaddr, des_block * ckey) +{ + AUTH *auth; + struct ad_private *ad; + char namebuf[MAXNETNAMELEN + 1]; + + /* + * Allocate everything now + */ + auth = ALLOC (AUTH); + ad = ALLOC (struct ad_private); + memcpy (ad->ad_pkey, pkey->n_bytes, pkey->n_len); + if (!getnetname (namebuf)) + goto failed; + ad->ad_fullnamelen = RNDUP (strlen (namebuf)); + ad->ad_fullname = mem_alloc (ad->ad_fullnamelen + 1); + + ad->ad_servernamelen = strlen (servername); + ad->ad_servername = mem_alloc (ad->ad_servernamelen + 1); + + if (auth == NULL || ad == NULL || ad->ad_fullname == NULL || + ad->ad_servername == NULL) + { + debug ("authdes_create: out of memory"); + goto failed; + } + + /* + * Set up private data + */ + bcopy (namebuf, ad->ad_fullname, ad->ad_fullnamelen + 1); + bcopy (servername, ad->ad_servername, ad->ad_servernamelen + 1); + ad->ad_timediff.tv_sec = ad->ad_timediff.tv_usec = 0; + if (syncaddr != NULL) + { + ad->ad_syncaddr = *syncaddr; + ad->ad_dosync = TRUE; + } + else + ad->ad_dosync = FALSE; + + ad->ad_window = window; + if (ckey == NULL) + { + if (key_gendes (&auth->ah_key) < 0) + { + debug ("authdes_create: unable to gen conversation key"); + return (NULL); + } + } + else + auth->ah_key = *ckey; + + /* + * Set up auth handle + */ + auth->ah_cred.oa_flavor = AUTH_DES; + auth->ah_verf.oa_flavor = AUTH_DES; + auth->ah_ops = &authdes_ops; + auth->ah_private = (caddr_t) ad; + + if (!authdes_refresh (auth)) + goto failed; + + return (auth); failed: - if (auth != NULL) - FREE(auth, sizeof(AUTH)); - if (ad != NULL) - FREE(ad, sizeof(struct ad_private)); - if (ad->ad_fullname != NULL) - FREE(ad->ad_fullname, ad->ad_fullnamelen + 1); - if (ad->ad_servername != NULL) - FREE(ad->ad_servername, ad->ad_servernamelen + 1); - return (NULL); + if (auth != NULL) + FREE (auth, sizeof (AUTH)); + if (ad != NULL) + { + if (ad->ad_fullname != NULL) + FREE (ad->ad_fullname, ad->ad_fullnamelen + 1); + if (ad->ad_servername != NULL) + FREE (ad->ad_servername, ad->ad_servernamelen + 1); + FREE (ad, sizeof (struct ad_private)); + } + return (NULL); } /* * Implement the five authentication operations */ + /* * 1. Next Verifier - */ -/*ARGSUSED*/ -#ifdef __STDC__ -static void -authdes_nextverf( AUTH *auth ) -#else + */ +/*ARGSUSED */ static void -authdes_nextverf(auth) - AUTH *auth; -#endif +authdes_nextverf (AUTH * auth) { - /* what the heck am I supposed to do??? */ + /* what the heck am I supposed to do??? */ } - + + + /* * 2. Marshal */ -#ifdef __STDC__ static bool_t -authdes_marshal( AUTH *auth, XDR *xdrs ) -#else -static bool_t -authdes_marshal(auth, xdrs) - AUTH *auth; - XDR *xdrs; -#endif +authdes_marshal (AUTH * auth, XDR * xdrs) { - struct ad_private *ad = AUTH_PRIVATE(auth); - struct authdes_cred *cred = &ad->ad_cred; - struct authdes_verf *verf = &ad->ad_verf; - des_block cryptbuf[2]; - des_block ivec; - int status; - int len; - register long *ixdr; - - /* - * Figure out the "time", accounting for any time difference - * with the server if necessary. - */ - (void) gettimeofday(&ad->ad_timestamp, (struct timezone *)NULL); - ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec; - ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec; - if (ad->ad_timestamp.tv_usec >= MILLION) { - ad->ad_timestamp.tv_usec -= MILLION; - ad->ad_timestamp.tv_sec += 1; - } - - /* - * XDR the timestamp and possibly some other things, then - * encrypt them. - */ - ixdr = (long *)cryptbuf; - IXDR_PUT_LONG(ixdr, ad->ad_timestamp.tv_sec); - IXDR_PUT_LONG(ixdr, ad->ad_timestamp.tv_usec); - if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { - IXDR_PUT_U_LONG(ixdr, ad->ad_window); - IXDR_PUT_U_LONG(ixdr, ad->ad_window - 1); - ivec.key.high = ivec.key.low = 0; - status = cbc_crypt((char *)&auth->ah_key, (char *)cryptbuf, - 2*sizeof(des_block), DES_ENCRYPT | DES_HW, (char *)&ivec); - } else { - status = ecb_crypt((char *)&auth->ah_key, (char *)cryptbuf, - sizeof(des_block), DES_ENCRYPT | DES_HW); - } - if (DES_FAILED(status)) { - debug("authdes_marshal: DES encryption failure"); - return (FALSE); - } - ad->ad_verf.adv_xtimestamp = cryptbuf[0]; - if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { - ad->ad_cred.adc_fullname.window = cryptbuf[1].key.high; - ad->ad_verf.adv_winverf = cryptbuf[1].key.low; - } else { - ad->ad_cred.adc_nickname = ad->ad_nickname; - ad->ad_verf.adv_winverf = 0; - } - - /* - * Serialize the credential and verifier into opaque - * authentication data. - */ - if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { - len = ((1 + 1 + 2 + 1)*BYTES_PER_XDR_UNIT + ad->ad_fullnamelen); - } else { - len = (1 + 1)*BYTES_PER_XDR_UNIT; - } - - if ((ixdr = xdr_inline(xdrs, 2*BYTES_PER_XDR_UNIT))) { - IXDR_PUT_LONG(ixdr, AUTH_DES); - IXDR_PUT_LONG(ixdr, len); - } else { -/* enum_t ah_cred.oa_flavor */ - ATTEMPT(xdr_putlong(xdrs, (long *)&auth->ah_cred.oa_flavor)); - ATTEMPT(xdr_putlong(xdrs, (long *)&len)); - } - ATTEMPT(xdr_authdes_cred(xdrs, cred)); - - len = (2 + 1)*BYTES_PER_XDR_UNIT; - if ((ixdr = xdr_inline(xdrs, 2*BYTES_PER_XDR_UNIT))) { - IXDR_PUT_LONG(ixdr, AUTH_DES); - IXDR_PUT_LONG(ixdr, len); - } else { - ATTEMPT(xdr_putlong(xdrs, (long *)&auth->ah_verf.oa_flavor)); - ATTEMPT(xdr_putlong(xdrs, (long *)&len)); - } - ATTEMPT(xdr_authdes_verf(xdrs, verf)); - return (TRUE); + struct ad_private *ad = AUTH_PRIVATE (auth); + struct authdes_cred *cred = &ad->ad_cred; + struct authdes_verf *verf = &ad->ad_verf; + des_block cryptbuf[2]; + des_block ivec; + int status; + int len; + register long *ixdr; + + /* + * Figure out the "time", accounting for any time difference + * with the server if necessary. + */ + gettimeofday (&ad->ad_timestamp, (struct timezone *) NULL); + ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec; + ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec; + if (ad->ad_timestamp.tv_usec >= MILLION) + { + ad->ad_timestamp.tv_usec -= MILLION; + ad->ad_timestamp.tv_sec += 1; + } + + /* + * XDR the timestamp and possibly some other things, then + * encrypt them. + */ + ixdr = (long *) cryptbuf; + IXDR_PUT_LONG (ixdr, ad->ad_timestamp.tv_sec); + IXDR_PUT_LONG (ixdr, ad->ad_timestamp.tv_usec); + if (ad->ad_cred.adc_namekind == ADN_FULLNAME) + { + IXDR_PUT_U_LONG (ixdr, ad->ad_window); + IXDR_PUT_U_LONG (ixdr, ad->ad_window - 1); + ivec.key.high = ivec.key.low = 0; + status = cbc_crypt ((char *) &auth->ah_key, (char *) cryptbuf, + 2 * sizeof (des_block), DES_ENCRYPT | DES_HW, (char *) &ivec); + } + else + { + status = ecb_crypt ((char *) &auth->ah_key, (char *) cryptbuf, + sizeof (des_block), DES_ENCRYPT | DES_HW); + } + if (DES_FAILED (status)) + { + debug ("authdes_marshal: DES encryption failure"); + return (FALSE); + } + ad->ad_verf.adv_xtimestamp = cryptbuf[0]; + if (ad->ad_cred.adc_namekind == ADN_FULLNAME) + { + ad->ad_cred.adc_fullname.window = cryptbuf[1].key.high; + ad->ad_verf.adv_winverf = cryptbuf[1].key.low; + } + else + { + ad->ad_cred.adc_nickname = ad->ad_nickname; + ad->ad_verf.adv_winverf = 0; + } + + /* + * Serialize the credential and verifier into opaque + * authentication data. + */ + if (ad->ad_cred.adc_namekind == ADN_FULLNAME) + { + len = ((1 + 1 + 2 + 1) * BYTES_PER_XDR_UNIT + ad->ad_fullnamelen); + } + else + { + len = (1 + 1) * BYTES_PER_XDR_UNIT; + } + + if ((ixdr = xdr_inline (xdrs, 2 * BYTES_PER_XDR_UNIT)) != NULL) + { + IXDR_PUT_LONG (ixdr, AUTH_DES); + IXDR_PUT_LONG (ixdr, len); + } + else + { + ATTEMPT (xdr_putlong (xdrs, (long *)&auth->ah_cred.oa_flavor)); + ATTEMPT (xdr_putlong (xdrs, (long *)&len)); + } + ATTEMPT (xdr_authdes_cred (xdrs, cred)); + + len = (2 + 1) * BYTES_PER_XDR_UNIT; + if ((ixdr = xdr_inline (xdrs, 2 * BYTES_PER_XDR_UNIT)) != NULL) + { + IXDR_PUT_LONG (ixdr, AUTH_DES); + IXDR_PUT_LONG (ixdr, len); + } + else + { + ATTEMPT (xdr_putlong (xdrs, (long *)&auth->ah_verf.oa_flavor)); + ATTEMPT (xdr_putlong (xdrs, (long *)&len)); + } + ATTEMPT (xdr_authdes_verf (xdrs, verf)); + return (TRUE); } + /* * 3. Validate */ -#ifdef __STDC__ -static bool_t -authdes_validate( AUTH *auth, struct opaque_auth *rverf ) -#else static bool_t -authdes_validate(auth, rverf) - AUTH *auth; - struct opaque_auth *rverf; -#endif +authdes_validate (AUTH * auth, struct opaque_auth *rverf) { - struct ad_private *ad = AUTH_PRIVATE(auth); - struct authdes_verf verf; - int status; - register u_long *ixdr; - - if (rverf->oa_length != (2 + 1) * BYTES_PER_XDR_UNIT) { - return (FALSE); - } - ixdr = (u_long *)rverf->oa_base; - verf.adv_xtimestamp.key.high = (u_long)*ixdr++; - verf.adv_xtimestamp.key.low = (u_long)*ixdr++; - verf.adv_int_u = (u_long)*ixdr++; /* nickname not XDR'd ! */ - - /* - * Decrypt the timestamp - */ - status = ecb_crypt((char *)&auth->ah_key, (char *)&verf.adv_xtimestamp, - sizeof(des_block), DES_DECRYPT | DES_HW); - - if (DES_FAILED(status)) { - debug("authdes_validate: DES decryption failure"); - return (FALSE); - } - - /* - * xdr the decrypted timestamp - */ - ixdr = (u_long *)verf.adv_xtimestamp.c; - verf.adv_timestamp.tv_sec = IXDR_GET_LONG(ixdr) + 1; - verf.adv_timestamp.tv_usec = IXDR_GET_LONG(ixdr); - - /* - * validate - */ - if (bcmp((char *)&ad->ad_timestamp, (char *)&verf.adv_timestamp, - sizeof(struct timeval)) != 0) { - debug("authdes_validate: verifier mismatch\n"); - return (FALSE); - } - - /* - * We have a nickname now, let's use it - */ - ad->ad_nickname = verf.adv_nickname; - ad->ad_cred.adc_namekind = ADN_NICKNAME; - return (TRUE); + struct ad_private *ad = AUTH_PRIVATE (auth); + struct authdes_verf verf; + int status; + register u_long *ixdr; + + if (rverf->oa_length != (2 + 1) * BYTES_PER_XDR_UNIT) + return (FALSE); + + ixdr = (u_long *) rverf->oa_base; + verf.adv_xtimestamp.key.high = (u_long)*ixdr++; + verf.adv_xtimestamp.key.low = (u_long)*ixdr++; + verf.adv_int_u = (u_long)*ixdr++; /* nickname not XDR'd ! */ + + /* + * Decrypt the timestamp + */ + status = ecb_crypt ((char *) &auth->ah_key, (char *) &verf.adv_xtimestamp, + sizeof (des_block), DES_DECRYPT | DES_HW); + + if (DES_FAILED (status)) + { + debug ("authdes_validate: DES decryption failure"); + return (FALSE); + } + + /* + * xdr the decrypted timestamp + */ + ixdr = (u_long *) verf.adv_xtimestamp.c; + verf.adv_timestamp.tv_sec = IXDR_GET_LONG (ixdr) + 1; + verf.adv_timestamp.tv_usec = IXDR_GET_LONG (ixdr); + + /* + * validate + */ + if (bcmp ((char *) &ad->ad_timestamp, (char *) &verf.adv_timestamp, + sizeof (struct timeval)) != 0) + { + debug ("authdes_validate: verifier mismatch\n"); + return (FALSE); + } + + /* + * We have a nickname now, let's use it + */ + ad->ad_nickname = verf.adv_nickname; + ad->ad_cred.adc_namekind = ADN_NICKNAME; + return (TRUE); } /* * 4. Refresh */ -#ifdef __STDC__ static bool_t -authdes_refresh( AUTH *auth ) -#else -static bool_t -authdes_refresh(auth) - AUTH *auth; -#endif +authdes_refresh (AUTH * auth) { - struct ad_private *ad = AUTH_PRIVATE(auth); - struct authdes_cred *cred = &ad->ad_cred; - - if (ad->ad_dosync && - !synchronize(&ad->ad_syncaddr, &ad->ad_timediff)) { - /* - * Hope the clocks are synced! - */ - ad->ad_timediff.tv_sec = ad->ad_timediff.tv_usec = 0; - debug("authdes_refresh: unable to synchronize with server"); - } - ad->ad_xkey = auth->ah_key; - if (key_encryptsession(ad->ad_servername, &ad->ad_xkey) < 0) { - debug("authdes_create: unable to encrypt conversation key"); - return (FALSE); - } - cred->adc_fullname.key = ad->ad_xkey; - cred->adc_namekind = ADN_FULLNAME; - cred->adc_fullname.name = ad->ad_fullname; - return (TRUE); + netobj pkey; + struct ad_private *ad = AUTH_PRIVATE (auth); + struct authdes_cred *cred = &ad->ad_cred; + + if (ad->ad_dosync && + !synchronize (&ad->ad_syncaddr, &ad->ad_timediff)) + { + /* + * Hope the clocks are synced! + */ + ad->ad_timediff.tv_sec = ad->ad_timediff.tv_usec = 0; + debug ("authdes_refresh: unable to synchronize with server"); + } + ad->ad_xkey = auth->ah_key; + pkey.n_bytes = (char *) (ad->ad_pkey); + pkey.n_len = strlen ((char *) ad->ad_pkey) + 1; + if (key_encryptsession_pk (ad->ad_servername, &pkey, &ad->ad_xkey) < 0) + { + debug ("authdes_create: unable to encrypt conversation key"); + return (FALSE); + } + cred->adc_fullname.key = ad->ad_xkey; + cred->adc_namekind = ADN_FULLNAME; + cred->adc_fullname.name = ad->ad_fullname; + return (TRUE); } - /* * 5. Destroy */ -#ifdef __STDC__ static void -authdes_destroy( AUTH *auth ) -#else -static void -authdes_destroy(auth) - AUTH *auth; -#endif +authdes_destroy (AUTH * auth) { - struct ad_private *ad = AUTH_PRIVATE(auth); + struct ad_private *ad = AUTH_PRIVATE (auth); - FREE(ad->ad_fullname, ad->ad_fullnamelen + 1); - FREE(ad->ad_servername, ad->ad_servernamelen + 1); - FREE(ad, sizeof(struct ad_private)); - FREE(auth, sizeof(AUTH)); + FREE (ad->ad_fullname, ad->ad_fullnamelen + 1); + FREE (ad->ad_servername, ad->ad_servernamelen + 1); + FREE (ad, sizeof (struct ad_private)); + FREE (auth, sizeof (AUTH)); } - - /* * Synchronize with the server at the given address, that is, * adjust timep to reflect the delta between our clocks */ -#ifdef __STDC__ -static bool_t -synchronize( struct sockaddr *syncaddr, struct timeval *timep ) -#else static bool_t -synchronize(syncaddr, timep) - struct sockaddr *syncaddr; - struct timeval *timep; -#endif +synchronize (struct sockaddr *syncaddr, struct timeval *timep) { - struct timeval mytime; - struct timeval timeout; + struct timeval mytime; + struct timeval timeout; - timeout.tv_sec = RTIME_TIMEOUT; - timeout.tv_usec = 0; - if (rtime((struct sockaddr_in *)syncaddr, timep, &timeout) < 0) { - return (FALSE); - } - (void) gettimeofday(&mytime, (struct timezone *)NULL); - timep->tv_sec -= mytime.tv_sec; - if (mytime.tv_usec > timep->tv_usec) { - timep->tv_sec -= 1; - timep->tv_usec += MILLION; - } - timep->tv_usec -= mytime.tv_usec; - return (TRUE); + timeout.tv_sec = RTIME_TIMEOUT; + timeout.tv_usec = 0; + if (rtime ((struct sockaddr_in *) syncaddr, timep, &timeout) < 0) + return (FALSE); + + gettimeofday (&mytime, (struct timezone *) NULL); + timep->tv_sec -= mytime.tv_sec; + if (mytime.tv_usec > timep->tv_usec) + { + timep->tv_sec -= 1; + timep->tv_usec += MILLION; + } + timep->tv_usec -= mytime.tv_usec; + return (TRUE); } Index: linux/libc/rpc/clnt_udp.c diff -u linux/libc/rpc/clnt_udp.c:1.3 linux/libc/rpc/clnt_udp.c:1.4 --- linux/libc/rpc/clnt_udp.c:1.3 Fri Oct 4 15:53:13 1996 +++ linux/libc/rpc/clnt_udp.c Fri Aug 8 12:12:50 1997 @@ -302,6 +302,8 @@ time_waited.tv_usec = 0; call_again: xdrs = &(cu->cu_outxdrs); + if (xargs == NULL) + goto get_reply; xdrs->x_op = XDR_ENCODE; XDR_SETPOS(xdrs, cu->cu_xdrpos); /* @@ -328,6 +330,7 @@ if (timeout.tv_sec == 0 && timeout.tv_usec == 0) { return (cu->cu_error.re_status = RPC_TIMEDOUT); } +get_reply: /* * sub-optimal code appears here because we have * some clock time to spare while the packets are in flight. Index: linux/libc/rpc/key_call.c diff -u linux/libc/rpc/key_call.c:1.5 linux/libc/rpc/key_call.c:1.6 --- linux/libc/rpc/key_call.c:1.5 Sun Nov 3 02:51:32 1996 +++ linux/libc/rpc/key_call.c Thu Jul 10 08:43:54 1997 @@ -31,275 +31,226 @@ */ /* -** The original source is from the RPCSRC 4.0 package from Sun Microsystems. -** The Interface to keyserver protocoll 2 was added by -** Thorsten Kukuk -*/ + * The original source is from the RPCSRC 4.0 package from Sun Microsystems. + * The Interface to keyserver protocoll 2 was added by + * Thorsten Kukuk + */ #include +#include #include +#include +#include #include +#include #include #include #include #include -#include -#include #define KEY_TIMEOUT 5 /* per-try timeout in seconds */ #define KEY_NRETRY 12 /* number of retries */ #define debug(msg) /* turn off debugging */ -static struct timeval trytimeout = { KEY_TIMEOUT, 0 }; -static struct timeval tottimeout = { KEY_TIMEOUT * KEY_NRETRY, 0 }; +extern int _openchild (char *command, FILE **fto, FILE **ffrom); -#ifdef __STDC__ -extern int _openchild ( char *, FILE **, FILE ** ); -extern bool_t xdr_keybuf ( XDR *xdrs, keybuf objp ); -extern bool_t xdr_keystatus ( XDR *xdrs, keystatus *objp ); -extern bool_t xdr_cryptkeyarg ( XDR *, cryptkeyarg * ); -extern bool_t xdr_cryptkeyres ( XDR *, cryptkeyres * ); - -int key_setsecret __P (( char * )); -int key_encryptsession __P (( char *, des_block * )); -int key_decryptsession __P (( char *, des_block * )); -int key_gendes __P (( des_block * )); -static int key_call __P (( u_long proc, - bool_t (*xdr_arg)( XDR *, void * ), - void *arg, - bool_t (*xdr_rslt)( XDR *, void * ), - void *rslt )); -#else -extern bool_t xdr_des_block(); -extern int _openchild(); - -int key_setsecret(); -int key_encryptsession(); -int key_decryptsession(); -int key_gendes(); -static int key_call(); -#endif /* __STDC__ */ -#ifdef __STDC__ -int -key_setsecret( char *secretkey ) -#else +static int key_call (u_long, xdrproc_t xdr_arg, char *, + xdrproc_t xdr_rslt, char *); + +static struct timeval trytimeout = {KEY_TIMEOUT, 0}; +static struct timeval tottimeout = {KEY_TIMEOUT *KEY_NRETRY, 0}; + int -key_setsecret( secretkey ) - char *secretkey; -#endif +key_setsecret (char *secretkey) { keystatus status; - - if (!key_call( (u_long)KEY_SET, xdr_keybuf, (void *) secretkey, - xdr_keystatus, (void *) &status )) { - return (-1); - } - if (status != KEY_SUCCESS) { - debug("set status is nonzero"); - return (-1); - } - return (0); + + if (!key_call ((u_long) KEY_SET, (xdrproc_t) xdr_keybuf, secretkey, + (xdrproc_t) xdr_keystatus, (char *) &status)) + return -1; + if (status != KEY_SUCCESS) + { + debug ("set status is nonzero"); + return -1; + } + return 0; } /* key_secretkey_is_set() returns 1 if the keyserver has a secret key - * stored for the caller's effective uid; it returns 0 otherwise - * - * N.B.: The KEY_NET_GET key call is undocumented. Applications shouldn't - * be using it, because it allows them to get the user's secret key. - */ -int + * stored for the caller's effective uid; it returns 0 otherwise + * + * N.B.: The KEY_NET_GET key call is undocumented. Applications shouldn't + * be using it, because it allows them to get the user's secret key. + */ +int key_secretkey_is_set (void) { struct key_netstres kres; - - memset((void*)&kres, 0, sizeof (kres)); - if (key_call((u_long) KEY_NET_GET, xdr_void, (char *)NULL, - xdr_key_netstres, (char *) &kres) && + + memset (&kres, 0, sizeof (kres)); + if (key_call ((u_long) KEY_NET_GET, (xdrproc_t) xdr_void, (char *) NULL, + (xdrproc_t) xdr_key_netstres, (char *) &kres) && (kres.status == KEY_SUCCESS) && (kres.key_netstres_u.knet.st_priv_key[0] != 0)) { /* avoid leaving secret key in memory */ - memset(kres.key_netstres_u.knet.st_priv_key, 0, HEXKEYBYTES); - return (1); + memset (kres.key_netstres_u.knet.st_priv_key, 0, HEXKEYBYTES); + return 1; } - return (0); + return 0; } - - -#ifdef __STDC__ -int -key_encryptsession( char *remotename, des_block *deskey ) -#else int -key_encryptsession( remotename, deskey ) - char *remotename; - des_block *deskey; -#endif +key_encryptsession (char *remotename, des_block *deskey) { - cryptkeyarg arg; - cryptkeyres res; + cryptkeyarg arg; + cryptkeyres res; + + arg.remotename = remotename; + arg.deskey = *deskey; + if (!key_call ((u_long) KEY_ENCRYPT, (xdrproc_t) xdr_cryptkeyarg, + (char *) &arg, (xdrproc_t) xdr_cryptkeyres, (char *) &res)) + return -1; - arg.remotename = remotename; - arg.deskey = *deskey; - if (!key_call((u_long)KEY_ENCRYPT, xdr_cryptkeyarg, - (void *) &arg, xdr_cryptkeyres, (void *) &res)) { - return (-1); - } - if (res.status != KEY_SUCCESS) { - debug("encrypt status is nonzero"); - return (-1); - } - *deskey = res.cryptkeyres_u.deskey; - return (0); + if (res.status != KEY_SUCCESS) + { + debug ("encrypt status is nonzero"); + return -1; + } + *deskey = res.cryptkeyres_u.deskey; + return 0; } -#ifdef __STDC__ -int -key_decryptsession( char *remotename, des_block *deskey ) -#else int -key_decryptsession( remotename, deskey ) - char *remotename; - des_block *deskey; -#endif +key_decryptsession (char *remotename, des_block *deskey) { - cryptkeyarg arg; - cryptkeyres res; + cryptkeyarg arg; + cryptkeyres res; - arg.remotename = remotename; - arg.deskey = *deskey; - if (!key_call((u_long)KEY_DECRYPT, xdr_cryptkeyarg, - (void *)&arg, xdr_cryptkeyres, (void *)&res)) - { - return (-1); - } - if (res.status != KEY_SUCCESS) { - debug("decrypt status is nonzero"); - return (-1); - } - *deskey = res.cryptkeyres_u.deskey; - return (0); + arg.remotename = remotename; + arg.deskey = *deskey; + if (!key_call ((u_long) KEY_DECRYPT, (xdrproc_t) xdr_cryptkeyarg, + (char *) &arg, (xdrproc_t) xdr_cryptkeyres, (char *) &res)) + return -1; + if (res.status != KEY_SUCCESS) + { + debug ("decrypt status is nonzero"); + return -1; + } + *deskey = res.cryptkeyres_u.deskey; + return 0; } int -key_encryptsession_pk (char *remotename, netobj *remotekey, des_block *deskey) +key_encryptsession_pk (char *remotename, netobj *remotekey, + des_block *deskey) { cryptkeyarg2 arg; cryptkeyres res; - + arg.remotename = remotename; arg.remotekey = *remotekey; arg.deskey = *deskey; - if (!key_call((u_long)KEY_ENCRYPT_PK, xdr_cryptkeyarg2, (char *)&arg, - xdr_cryptkeyres, (char *)&res)) - { - return (-1); - } - if (res.status != KEY_SUCCESS) + if (!key_call ((u_long) KEY_ENCRYPT_PK, (xdrproc_t) xdr_cryptkeyarg2, + (char *) &arg, (xdrproc_t) xdr_cryptkeyres, (char *) &res)) + return -1; + + if (res.status != KEY_SUCCESS) { - debug("encrypt status is nonzero"); - return (-1); + debug ("encrypt status is nonzero"); + return -1; } *deskey = res.cryptkeyres_u.deskey; - return (0); + return 0; } int -key_decryptsession_pk(char *remotename, netobj *remotekey, des_block *deskey) +key_decryptsession_pk (char *remotename, netobj *remotekey, + des_block *deskey) { cryptkeyarg2 arg; cryptkeyres res; - + arg.remotename = remotename; arg.remotekey = *remotekey; arg.deskey = *deskey; - if (!key_call((u_long)KEY_DECRYPT_PK, xdr_cryptkeyarg2, (char *)&arg, - xdr_cryptkeyres, (char *)&res)) - { - return (-1); - } - if (res.status != KEY_SUCCESS) + if (!key_call ((u_long) KEY_DECRYPT_PK, (xdrproc_t) xdr_cryptkeyarg2, + (char *) &arg, (xdrproc_t) xdr_cryptkeyres, (char *) &res)) + return -1; + + if (res.status != KEY_SUCCESS) { - debug("decrypt status is nonzero"); - return (-1); + debug ("decrypt status is nonzero"); + return -1; } *deskey = res.cryptkeyres_u.deskey; - return (0); + return 0; } -#ifdef __STDC__ -int -key_gendes( des_block *key ) -#else int -key_gendes( key ) - des_block *key; -#endif +key_gendes (des_block *key) { struct sockaddr_in sin; CLIENT *client; int socket; enum clnt_stat stat; - - + sin.sin_family = AF_INET; sin.sin_port = 0; - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - bzero(sin.sin_zero, sizeof(sin.sin_zero)); + sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + bzero (sin.sin_zero, sizeof (sin.sin_zero)); socket = RPC_ANYSOCK; - client = clntudp_bufcreate(&sin, (u_long)KEY_PROG, (u_long)KEY_VERS, - trytimeout, &socket, RPCSMALLMSGSIZE, - RPCSMALLMSGSIZE); - if (client == NULL) { - return (-1); - } - stat = clnt_call(client, KEY_GEN, (xdrproc_t)xdr_void, NULL, - (xdrproc_t)xdr_des_block, (caddr_t)key, tottimeout); - clnt_destroy(client); - /* (void) close(socket); */ - if (stat != RPC_SUCCESS) { - return (-1); - } - return (0); + client = clntudp_bufcreate (&sin, (u_long) KEY_PROG, (u_long) KEY_VERS, + trytimeout, &socket, RPCSMALLMSGSIZE, + RPCSMALLMSGSIZE); + if (client == NULL) + return -1; + + stat = clnt_call (client, KEY_GEN, (xdrproc_t) xdr_void, NULL, + (xdrproc_t) xdr_des_block, (caddr_t) key, tottimeout); + clnt_destroy (client); + close (socket); + if (stat != RPC_SUCCESS) + return -1; + + return 0; } int -key_setnet(struct key_netstarg *arg) +key_setnet (struct key_netstarg *arg) { keystatus status; - - if (!key_call((u_long) KEY_NET_PUT, xdr_key_netstarg, (char *) arg, - xdr_keystatus, (char *) &status)) - return (-1); - + + if (!key_call ((u_long) KEY_NET_PUT, (xdrproc_t) xdr_key_netstarg, + (char *) arg,(xdrproc_t) xdr_keystatus, (char *) &status)) + return -1; + if (status != KEY_SUCCESS) { - debug("key_setnet status is nonzero"); - return (-1); + debug ("key_setnet status is nonzero"); + return -1; } - return (1); + return 1; } int -key_get_conv(char *pkey, des_block *deskey) +key_get_conv (char *pkey, des_block *deskey) { cryptkeyres res; - - if (!key_call((u_long) KEY_GET_CONV, xdr_keybuf, pkey, - xdr_cryptkeyres, (char *)&res)) - { - return (-1); - } - if (res.status != KEY_SUCCESS) + + if (!key_call ((u_long) KEY_GET_CONV, (xdrproc_t) xdr_keybuf, pkey, + (xdrproc_t) xdr_cryptkeyres, (char *) &res)) + return -1; + + if (res.status != KEY_SUCCESS) { - debug("get_conv status is nonzero"); - return (-1); + debug ("get_conv status is nonzero"); + return -1; } *deskey = res.cryptkeyres_u.deskey; - return (0); + return 0; } /* @@ -311,115 +262,105 @@ * implementations of these functions, and to call those in key_call(). */ -cryptkeyres *(*__key_encryptsession_pk_LOCAL)() = 0; -cryptkeyres *(*__key_decryptsession_pk_LOCAL)() = 0; -des_block *(*__key_gendes_LOCAL)() = 0; +cryptkeyres *(*__key_encryptsession_pk_LOCAL) (uid_t, char *) = 0; +cryptkeyres *(*__key_decryptsession_pk_LOCAL) (uid_t, char *) = 0; +des_block *(*__key_gendes_LOCAL) (uid_t, char *) = 0; -#include -#include -#include - -#ifdef __STDC__ -static int -key_call( u_long proc, bool_t (*xdr_arg)( XDR *, void * ), void *arg, - bool_t (*xdr_rslt)( XDR *, void * ), void *rslt ) -#else static int -key_call( proc, xdr_arg, arg, xdr_rslt, rslt ) - u_long proc; - bool_t (*xdr_arg)(); - char *arg; - bool_t (*xdr_rslt)(); - char *rslt; -#endif +key_call (u_long proc, xdrproc_t xdr_arg, char *arg, + xdrproc_t xdr_rslt, char *rslt) { XDR xdrargs; XDR xdrrslt; FILE *fargs; FILE *frslt; - int (*osigchild) (); + sigset_t oldmask, mask; union wait status; int pid; int success; - int ruid; - int euid; + uid_t ruid; + uid_t euid; static char MESSENGER[] = "/usr/etc/keyenvoy"; - - success = 1; - osigchild = signal(SIGCHLD, SIG_IGN); if (proc == KEY_ENCRYPT_PK && __key_encryptsession_pk_LOCAL) { cryptkeyres *res; - res = (*__key_encryptsession_pk_LOCAL)(geteuid (), arg); - *(cryptkeyres*)rslt = *res; + res = (*__key_encryptsession_pk_LOCAL) (geteuid (), arg); + *(cryptkeyres *) rslt = *res; return 1; - } - else - if (proc == KEY_DECRYPT_PK && __key_decryptsession_pk_LOCAL) - { - cryptkeyres *res; - res = (*__key_decryptsession_pk_LOCAL)(geteuid (), arg); - *(cryptkeyres*)rslt = *res; - return 1; - } - else - if (proc == KEY_GEN && __key_gendes_LOCAL) - { - des_block *res; - res = (*__key_gendes_LOCAL)(geteuid(), 0); - *(des_block*)rslt = *res; - return 1; - } - + } + else if (proc == KEY_DECRYPT_PK && __key_decryptsession_pk_LOCAL) + { + cryptkeyres *res; + res = (*__key_decryptsession_pk_LOCAL) (geteuid (), arg); + *(cryptkeyres *) rslt = *res; + return 1; + } + else if (proc == KEY_GEN && __key_gendes_LOCAL) + { + des_block *res; + res = (*__key_gendes_LOCAL) (geteuid (), 0); + *(des_block *) rslt = *res; + return 1; + } + + success = 1; + sigemptyset (&mask); + sigaddset (&mask, SIGCHLD); + sigprocmask (SIG_BLOCK, &mask, &oldmask); + /* * We are going to exec a set-uid program which makes our effective uid - * zero, and authenticates us with our real uid. We need to make the - * effective uid be the real uid for the setuid program, and + * zero, and authenticates us with our real uid. We need to make the + * effective uid be the real uid for the setuid program, and * the real uid be the effective uid so that we can change things back. */ - euid = geteuid(); - ruid = getuid(); - (void) setreuid(euid, ruid); - pid = _openchild(MESSENGER, &fargs, &frslt); - (void) setreuid(ruid, euid); - if (pid < 0) { - debug("open_streams"); - return (0); - } - xdrstdio_create(&xdrargs, fargs, XDR_ENCODE); - xdrstdio_create(&xdrrslt, frslt, XDR_DECODE); - - if (!xdr_u_long(&xdrargs, &proc) || !(*xdr_arg)(&xdrargs, arg)) { - debug("xdr args"); - success = 0; - } - (void) fclose(fargs); - - if (success && !(*xdr_rslt)(&xdrrslt, rslt)) { - debug("xdr rslt"); - success = 0; - } - -#ifdef NOTDEF - /* - * WARNING! XXX - * The original code appears first. wait4 returns only after the process - * with the requested pid terminates. The effect of using wait() instead - * has not been determined. - */ - (void) fclose(frslt); - if (wait4(pid, &status, 0, NULL) < 0 || status.w_retcode != 0) { - debug("wait4"); - success = 0; - } -#endif /* def NOTDEF */ - if (wait(&status) < 0 || status.w_retcode != 0) { - debug("wait"); - success = 0; - } - (void)signal(SIGCHLD, osigchild); - + euid = geteuid (); + ruid = getuid (); + setreuid (euid, ruid); + pid = _openchild (MESSENGER, &fargs, &frslt); + setreuid (ruid, euid); + if (pid < 0) + { + debug ("open_streams"); + sigprocmask(SIG_SETMASK, &oldmask, NULL); + return (0); + } + xdrstdio_create (&xdrargs, fargs, XDR_ENCODE); + xdrstdio_create (&xdrrslt, frslt, XDR_DECODE); + + if (!xdr_u_long (&xdrargs, &proc) || !(*xdr_arg) (&xdrargs, arg)) + { + debug ("xdr args"); + success = 0; + } + fclose (fargs); + + if (success && !(*xdr_rslt) (&xdrrslt, rslt)) + { + debug ("xdr rslt"); + success = 0; + } + fclose(frslt); + + wait_again: + if (wait4(pid, &status, 0, NULL) < 0) + { + if (errno == EINTR) + goto wait_again; + debug("wait4"); + if (errno == ECHILD || errno == ESRCH) + perror("wait"); + else + success = 0; + } + else + if (status.w_retcode) + { + debug("wait4 1"); + success = 0; + } + sigprocmask(SIG_SETMASK, &oldmask, NULL); + return (success); } - Index: linux/libc/rpc/openchild.c diff -u linux/libc/rpc/openchild.c:1.3 linux/libc/rpc/openchild.c:1.4 --- linux/libc/rpc/openchild.c:1.3 Fri Oct 4 15:53:14 1996 +++ linux/libc/rpc/openchild.c Thu Jul 10 08:43:54 1997 @@ -1,6 +1,3 @@ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)openchild.c 2.3 88/08/15 4.0 RPCSRC; from 1.7 88/02/08 SMI"; -#endif /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -8,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -40,112 +37,69 @@ * interface, but for internal use only! */ #include +#include #include -#include -#include #include - -#define basename __basename -static char SHELL[] = "/bin/sh"; - -#ifdef __STDC__ -int _openchild ( char *, FILE **, FILE ** ); -static char *basename ( char * ); -#else /* ! __STDC__ */ -int _openchild(); -static char *basename(); -#endif /* __STDC__ */ +#include +#include /* * returns pid, or -1 for failure */ -#ifdef __STDC__ int -_openchild( char *command, FILE **fto, FILE **ffrom ) -#else -int -_openchild(command, fto, ffrom) - char *command; - FILE **fto; - FILE **ffrom; -#endif +_openchild (char *command, FILE ** fto, FILE ** ffrom) { - int i; - int pid; - int pdto[2]; - int pdfrom[2]; - char *com; - - - if (pipe(pdto) < 0) { - goto error1; - } - if (pipe(pdfrom) < 0) { - goto error2; - } - switch (pid = vfork()) { - case -1: - goto error3; - - case 0: - /* - * child: read from pdto[0], write into pdfrom[1] - */ - (void) close(0); - (void) dup(pdto[0]); - (void) close(1); - (void) dup(pdfrom[1]); - for (i = _rpc_dtablesize() - 1; i >= 3; i--) { - (void) close(i); - } - com = malloc((unsigned) strlen(command) + 6); - if (com == NULL) { - _exit(~0); - } - (void) sprintf(com, "exec %s", command); - execl(SHELL, basename(SHELL), "-c", com, NULL); - _exit(~0); - - default: - /* - * parent: write into pdto[1], read from pdfrom[0] - */ - *fto = fdopen(pdto[1], "w"); - (void) close(pdto[0]); - *ffrom = fdopen(pdfrom[0], "r"); - (void) close(pdfrom[1]); - break; - } - return (pid); - - /* - * error cleanup and return - */ + int i; + int pid; + int pdto[2]; + int pdfrom[2]; + + if (pipe (pdto) < 0) + goto error1; + if (pipe (pdfrom) < 0) + goto error2; + switch (pid = fork ()) + { + case -1: + goto error3; + + case 0: + /* + * child: read from pdto[0], write into pdfrom[1] + */ + close (0); + dup (pdto[0]); + close (1); + dup (pdfrom[1]); + fflush (stderr); + for (i = _rpc_dtablesize () - 1; i >= 3; i--) + close (i); + fflush (stderr); + execlp (command, command, 0); + perror ("exec"); + _exit (~0); + + default: + /* + * parent: write into pdto[1], read from pdfrom[0] + */ + *fto = fdopen (pdto[1], "w"); + close (pdto[0]); + *ffrom = fdopen (pdfrom[0], "r"); + close (pdfrom[1]); + break; + } + return pid; + + /* + * error cleanup and return + */ error3: - (void) close(pdfrom[0]); - (void) close(pdfrom[1]); + close (pdfrom[0]); + close (pdfrom[1]); error2: - (void) close(pdto[0]); - (void) close(pdto[1]); + close (pdto[0]); + close (pdto[1]); error1: - return (-1); -} - -#ifdef __STDC__ -static char * -basename( char *path ) -#else -static char * -basename(path) - char *path; -#endif -{ - char *p; - - p = rindex(path, '/'); - if (p == NULL) { - return (path); - } else { - return (p + 1); - } + return -1; } Index: linux/libc/sysdeps/linux/Makefile diff -u linux/libc/sysdeps/linux/Makefile:1.23 linux/libc/sysdeps/linux/Makefile:1.24 --- linux/libc/sysdeps/linux/Makefile:1.23 Sat May 10 14:44:38 1997 +++ linux/libc/sysdeps/linux/Makefile Thu Jul 10 08:43:55 1997 @@ -70,7 +70,7 @@ sched_setparam.S sched_getparam.S sched_setscheduler.S \ sched_getscheduler.S sched_yield.S sched_get_priority_max.S \ sched_get_priority_min.S sched_rr_get_interval.S fdatasync.S \ - nanosleep.S __syscall_poll.S + nanosleep.S __syscall_poll.S quotactl.S SRC3S= fstatfs.c statfs.c uname.c __vfork.c vfork.c SRCS=$(SRC1S) $(SRC2S) $(SRC3S) Index: linux/libc/sysdeps/linux/quotactl.S diff -u /dev/null linux/libc/sysdeps/linux/quotactl.S:1.1 --- /dev/null Tue Sep 2 13:36:58 1997 +++ linux/libc/sysdeps/linux/quotactl.S Thu Jul 10 08:43:55 1997 @@ -0,0 +1,22 @@ +/* Copyright (C) 1991, 1992 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +SYSCALL__ (quotactl, 4) + ret Index: linux/libc/ufc/Makefile diff -u linux/libc/ufc/Makefile:1.1.1.1 linux/libc/ufc/Makefile:1.2 --- linux/libc/ufc/Makefile:1.1.1.1 Fri Feb 17 21:33:39 1995 +++ linux/libc/ufc/Makefile Sun Jul 20 12:02:25 1997 @@ -9,7 +9,7 @@ DIRS:= -SRCS = crypt.c crypt_util.c +SRCS = crypt.c crypt_md5.c md5.c crypt_util.c ASMS= $(SRCS:.c=.s) OBJS= $(SRCS:.c=.o) ALIASES= Index: linux/libc/ufc/crypt_md5.c diff -u /dev/null linux/libc/ufc/crypt_md5.c:1.1 --- /dev/null Tue Sep 2 13:37:05 1997 +++ linux/libc/ufc/crypt_md5.c Sun Jul 20 12:02:25 1997 @@ -0,0 +1,152 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * $Id: crypt.c,v 1.3 1995/05/30 05:42:22 rgrimes Exp $ + * + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char rcsid[] = "$Header: /home/ncvs/src/lib/libcrypt/crypt.c,v 1.3 1995/05/30 05:42:22 rgrimes Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +/* #include */ +#include "md5.h" + +static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */ + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +static void +to64(s, v, n) + char *s; + unsigned long v; + int n; +{ + while (--n >= 0) { + *s++ = itoa64[v&0x3f]; + v >>= 6; + } +} + +/* + * UNIX password + * + * Use MD5 for what it is best at... + */ + +char * +crypt_md5(pw, salt) + register const char *pw; + register const char *salt; +{ + static char *magic = "$1$"; /* + * This string is magic for + * this algorithm. Having + * it this way, we can get + * get better later on + */ + static char passwd[120], *p; + static const char *sp,*ep; + unsigned char final[16]; + int sl,pl,i,j; + MD5_CTX ctx,ctx1; + unsigned long l; + + /* Refine the Salt first */ + sp = salt; + + /* If it starts with the magic string, then skip that */ + if(!strncmp(sp,magic,strlen(magic))) + sp += strlen(magic); + + /* It stops at the first '$', max 8 chars */ + for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++) + continue; + + /* get the length of the true salt */ + sl = ep - sp; + + MD5Init(&ctx); + + /* The password first, since that is what is most unknown */ + MD5Update(&ctx,pw,strlen(pw)); + + /* Then our magic string */ + MD5Update(&ctx,magic,strlen(magic)); + + /* Then the raw salt */ + MD5Update(&ctx,sp,sl); + + /* Then just as many characters of the MD5(pw,salt,pw) */ + MD5Init(&ctx1); + MD5Update(&ctx1,pw,strlen(pw)); + MD5Update(&ctx1,sp,sl); + MD5Update(&ctx1,pw,strlen(pw)); + MD5Final(final,&ctx1); + for(pl = strlen(pw); pl > 0; pl -= 16) + MD5Update(&ctx,final,pl>16 ? 16 : pl); + + /* Don't leave anything around in vm they could use. */ + memset(final,0,sizeof final); + + /* Then something really weird... */ + for (j=0,i = strlen(pw); i ; i >>= 1) + if(i&1) + MD5Update(&ctx, final+j, 1); + else + MD5Update(&ctx, pw+j, 1); + + /* Now make the output string */ + strcpy(passwd,magic); + strncat(passwd,sp,sl); + strcat(passwd,"$"); + + MD5Final(final,&ctx); + + /* + * and now, just to make sure things don't run too fast + * On a 60 Mhz Pentium this takes 34 msec, so you would + * need 30 seconds to build a 1000 entry dictionary... + */ + for(i=0;i<1000;i++) { + MD5Init(&ctx1); + if(i & 1) + MD5Update(&ctx1,pw,strlen(pw)); + else + MD5Update(&ctx1,final,16); + + if(i % 3) + MD5Update(&ctx1,sp,sl); + + if(i % 7) + MD5Update(&ctx1,pw,strlen(pw)); + + if(i & 1) + MD5Update(&ctx1,final,16); + else + MD5Update(&ctx1,pw,strlen(pw)); + MD5Final(final,&ctx1); + } + + p = passwd + strlen(passwd); + + l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4; + l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4; + l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4; + l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4; + l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4; + l = final[11] ; to64(p,l,2); p += 2; + *p = '\0'; + + /* Don't leave anything around in vm they could use. */ + memset(final,0,sizeof final); + + return passwd; +} + Index: linux/libc/ufc/crypt_util.c diff -u linux/libc/ufc/crypt_util.c:1.2 linux/libc/ufc/crypt_util.c:1.3 --- linux/libc/ufc/crypt_util.c:1.2 Fri Oct 4 15:53:40 1996 +++ linux/libc/ufc/crypt_util.c Sun Jul 20 12:02:25 1997 @@ -806,6 +806,13 @@ ufc_long *s; char ktab[9]; +#ifndef NO_MD5_CRYPT + extern char *crypt_md5(); + + if (strncmp(salt, "$1$", 3) == 0) + return crypt_md5(key, salt); +#endif + /* * Hack DES tables according to salt */ Index: linux/libc/ufc/md5.c diff -u /dev/null linux/libc/ufc/md5.c:1.1 --- /dev/null Tue Sep 2 13:37:05 1997 +++ linux/libc/ufc/md5.c Sun Jul 20 12:02:25 1997 @@ -0,0 +1,252 @@ +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ +#include /* for memcpy() */ +#include "md5.h" + +#ifndef HIGHFIRST +#define byteReverse(buf, len) /* Nothing */ +#else +void byteReverse(unsigned char *buf, unsigned longs); + +#ifndef ASM_MD5 +/* + * Note: this code is harmless on little-endian machines. + */ +void byteReverse(unsigned char *buf, unsigned longs) +{ + uint32 t; + do { + t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | + ((unsigned) buf[1] << 8 | buf[0]); + *(uint32 *) buf = t; + buf += 4; + } while (--longs); +} +#endif +#endif + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void MD5Init(struct MD5Context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; +} + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) +{ + uint32 t; + + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((uint32) len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + + /* Handle any leading odd-sized chunks */ + + if (t) { + unsigned char *p = (unsigned char *) ctx->in + t; + + t = 64 - t; + if (len < t) { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32 *) ctx->in); + buf += t; + len -= t; + } + /* Process data in 64-byte chunks */ + + while (len >= 64) { + memcpy(ctx->in, buf, 64); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32 *) ctx->in); + buf += 64; + len -= 64; + } + + /* Handle any remaining bytes of data. */ + + memcpy(ctx->in, buf, len); +} + +/* + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void MD5Final(unsigned char digest[16], struct MD5Context *ctx) +{ + unsigned count; + unsigned char *p; + + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32 *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } else { + /* Pad block to 56 bytes */ + memset(p, 0, count - 8); + } + byteReverse(ctx->in, 14); + + /* Append length in bits and transform */ + ((uint32 *) ctx->in)[14] = ctx->bits[0]; + ((uint32 *) ctx->in)[15] = ctx->bits[1]; + + MD5Transform(ctx->buf, (uint32 *) ctx->in); + byteReverse((unsigned char *) ctx->buf, 4); + memcpy(digest, ctx->buf, 16); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ +} + +#ifndef ASM_MD5 + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +void MD5Transform(uint32 buf[4], uint32 const in[16]) +{ + register uint32 a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +#endif Index: linux/libc/ufc/md5.h diff -u /dev/null linux/libc/ufc/md5.h:1.1 --- /dev/null Tue Sep 2 13:37:05 1997 +++ linux/libc/ufc/md5.h Sun Jul 20 12:02:25 1997 @@ -0,0 +1,27 @@ +#ifndef _MD5_H +#define _MD5_H + +#ifdef __alpha +typedef unsigned int uint32; +#else +typedef unsigned long uint32; +#endif + +struct MD5Context { + uint32 buf[4]; + uint32 bits[2]; + unsigned char in[64]; +}; + +void MD5Init(struct MD5Context *context); +void MD5Update(struct MD5Context *context, unsigned char const *buf, + unsigned len); +void MD5Final(unsigned char digest[16], struct MD5Context *context); +void MD5Transform(uint32 buf[4], uint32 const in[16]); + +/* + * This is needed to make RSAREF happy on some MS-DOS compilers. + */ +typedef struct MD5Context MD5_CTX; + +#endif /* !MD5_H */ Index: linux/libc/yp/yplib.c diff -u linux/libc/yp/yplib.c:1.8 linux/libc/yp/yplib.c:1.9 --- linux/libc/yp/yplib.c:1.8 Sat May 3 16:01:19 1997 +++ linux/libc/yp/yplib.c Sun Jul 20 12:09:28 1997 @@ -817,7 +817,7 @@ bzero ((char *) &ypml, sizeof ypml); result = clnt_call (ysd->dom_client, YPPROC_MAPLIST, - (xdrproc_t)xdr_domainname, indomain, + (xdrproc_t)xdr_domainname, &indomain, (xdrproc_t)xdr_ypresp_maplist, (char *)&ypml, tv); if (result != RPC_SUCCESS) Index: linux/include/Makefile diff -u /dev/null linux/include/Makefile:1.1 --- /dev/null Tue Sep 2 13:37:07 1997 +++ linux/include/Makefile Sun Jul 20 12:07:29 1997 @@ -0,0 +1,301 @@ +TOPDIR=../libc + +include $(TOPDIR)/Makeconfig + +files=_G_config.h \ + a.out.h \ + alloca.h \ + ansidecl.h \ + ar.h \ + argz.h \ + arpa/ftp.h \ + arpa/inet.h \ + arpa/nameser.h \ + arpa/telnet.h \ + arpa/tftp.h \ + assert.h \ + bsd/bsd.h \ + bsd/errno.h \ + bsd/sgtty.h \ + bsd/signal.h \ + bsd/stdlib.h \ + bsd/sys/ttychars.h \ + bsd/tzfile.h \ + bsd/unistd.h \ + bstring.h \ + bytesex.h \ + confname.h \ + confstr.h \ + ctype.h \ + des_crypt.h \ + dirent.h \ + elf.h \ + endian.h \ + err.h \ + errno.h \ + fcntl.h \ + features.h \ + fnmatch.h \ + fpu_control.h \ + ftw.h \ + getopt.h \ + glob.h \ + gmp-mparam.h \ + gnu-stabs.h \ + gnu/types.h \ + grp.h \ + huge_val.h \ + i386/fpu_control.h \ + i386/gmp-mparam.h \ + i386/ieeefp.h \ + i386/jmp_buf.h \ + i386/syscall.h \ + ieee754.h \ + ieee854.h \ + jmp_buf.h \ + langinfo.h \ + lastlog.h \ + libelf.h \ + libio.h \ + limits.h \ + link.h \ + locale.h \ + m68k/__math.h \ + m68k/fpu_control.h \ + m68k/gmp-mparam.h \ + m68k/ieeefp.h \ + m68k/jmp_buf.h \ + m68k/syscall.h \ + malloc.h \ + math.h \ + memory.h \ + mntent.h \ + nan.h \ + net/if.h \ + net/if_arp.h \ + net/if_route.h \ + net/ppp-comp.h \ + net/ppp_defs.h \ + net/route.h \ + netatalk/at.h \ + netdb.h \ + netinet/igmp.h \ + netinet/in.h \ + netinet/in_systm.h \ + netinet/ip.h \ + netinet/ip_fw.h \ + netinet/ip_icmp.h \ + netinet/ip_mroute.h \ + netinet/ip_tcp.h \ + netinet/ip_udp.h \ + netinet/protocols.h \ + netinet/tcp.h \ + netinet/udp.h \ + nl_types.h \ + nlist.h \ + obstack.h \ + paths.h \ + posix1_lim.h \ + posix2_lim.h \ + posix_opt.h \ + printf.h \ + protocols/routed.h \ + protocols/rwhod.h \ + protocols/talkd.h \ + protocols/timed.h \ + pthread.h \ + pthread/mit/cleanup.h \ + pthread/mit/cond.h \ + pthread/mit/debug_out.h \ + pthread/mit/fd.h \ + pthread/mit/fd_pipe.h \ + pthread/mit/kernel.h \ + pthread/mit/kthread.h \ + pthread/mit/machdep.h \ + pthread/mit/mutex.h \ + pthread/mit/posix.h \ + pthread/mit/prio_queue.h \ + pthread/mit/pthread.h \ + pthread/mit/pthread_attr.h \ + pthread/mit/pthread_once.h \ + pthread/mit/queue.h \ + pthread/mit/sleep.h \ + pthread/mit/specific.h \ + pthread/mit/state.def \ + pthread/mit/sys/compat.h \ + pthread/mit/sys/timers.h \ + pthread/mit/sys/types.h \ + pthread/mit/types.h \ + pthread/mit/unistd.h \ + pthread/mit/util.h \ + pthread/mit/version.h \ + pthread/mit/xtypes.h \ + pwd.h \ + regex.h \ + regexp.h \ + resolv.h \ + rpc.h \ + rpc/auth.h \ + rpc/auth_des.h \ + rpc/auth_unix.h \ + rpc/clnt.h \ + rpc/key_prot.h \ + rpc/key_prot.x \ + rpc/pmap_clnt.h \ + rpc/pmap_prot.h \ + rpc/pmap_rmt.h \ + rpc/rpc.h \ + rpc/rpc_msg.h \ + rpc/svc.h \ + rpc/svc_auth.h \ + rpc/types.h \ + rpc/xdr.h \ + rpcsvc/bootparam_prot \ + rpcsvc/bootparam_prot.x \ + rpcsvc/klm_prot.h \ + rpcsvc/klm_prot.x \ + rpcsvc/mount.h \ + rpcsvc/mount.x \ + rpcsvc/nfs_prot.h \ + rpcsvc/nfs_prot.x \ + rpcsvc/nlm_prot.h \ + rpcsvc/nlm_prot.x \ + rpcsvc/rex.h \ + rpcsvc/rex.x \ + rpcsvc/rquota.h \ + rpcsvc/rquota.x \ + rpcsvc/rstat.h \ + rpcsvc/rstat.x \ + rpcsvc/rusers.h \ + rpcsvc/rusers.x \ + rpcsvc/sm_inter.h \ + rpcsvc/sm_inter.x \ + rpcsvc/spray.h \ + rpcsvc/spray.x \ + rpcsvc/yp.h \ + rpcsvc/yp.x \ + rpcsvc/yp_prot.h \ + rpcsvc/ypclnt.h \ + rpcsvc/yppasswd.h \ + rpcsvc/yppasswd.x \ + rpcsvc/ypupdate_prot.h \ + rpcsvc/ypupdate_prot.x \ + rx.h \ + sched.h \ + search.h \ + setjmp.h \ + shadow.h \ + sharedlib.h \ + signal.h \ + stab.def \ + stab.h \ + stdio.h \ + stdlib.h \ + string.h \ + strings.h \ + sys/acct.h \ + sys/bitypes.h \ + sys/cdefs.h \ + sys/debugreg.h \ + sys/dir.h \ + sys/dirent.h \ + sys/errno.h \ + sys/fcntl.h \ + sys/file.h \ + sys/ioctl.h \ + sys/ipc.h \ + sys/kd.h \ + sys/mman.h \ + sys/mount.h \ + sys/msg.h \ + sys/mtio.h \ + sys/param.h \ + sys/poll.h \ + sys/procfs.h \ + sys/ptrace.h \ + sys/queue.h \ + sys/quota.h \ + sys/resource.h \ + sys/sem.h \ + sys/serial.h \ + sys/shm.h \ + sys/signal.h \ + sys/socket.h \ + sys/socketcall.h \ + sys/socketio.h \ + sys/socketvar.h \ + sys/soundcard.h \ + sys/stat.h \ + sys/syscall.h \ + sys/sysctl.h \ + sys/sysinfo.h \ + sys/syslog.h \ + sys/sysmacros.h \ + sys/termio.h \ + sys/termios.h \ + sys/time.h \ + sys/timeb.h \ + sys/times.h \ + sys/timex.h \ + sys/tty.h \ + sys/types.h \ + sys/uio.h \ + sys/ultrasound.h \ + sys/un.h \ + sys/user.h \ + sys/utsname.h \ + sys/varargs.h \ + sys/vfs.h \ + sys/vm86.h \ + sys/vt.h \ + sys/wait.h \ + syscall.h \ + sysexits.h \ + syslog.h \ + tar.h \ + termio.h \ + termios.h \ + time.h \ + ulimit.h \ + unistd.h \ + utime.h \ + utmp.h \ + values.h \ + wait.h \ + waitflags.h \ + waitstatus.h \ + wchar.h \ + wctype.h + +all lib include: asm linux + +asm: linux + +linux: + $(RM) -f dummy.c + echo "#include " > dummy.c + dir=`$(CC) -M dummy.c 2> /dev/null | grep linux/version.h | sed -e 's,.*[ ]\([^ ]*\)linux/version.h.*,\1,'`; \ + $(RM) -f dummy.c; \ + if [ x"$$dir"x = xx -o ! -d $$dir ]; \ + then \ + echo No kernel header files found!; \ + exit 1; \ + else \ + $(RM) -fr asm linux; \ + ln -s $$dir/asm .; \ + ln -s $$dir/linux .; \ + fi + +clean: + $(RM) -f asm linux + +install: + @for f in $(files); \ + do \ + cmp -s $$f $(TARGET_ROOTDIR)/usr/include/$$f; \ + if [ $$? != 0 ]; \ + then \ + echo cp $$f $(TARGET_ROOTDIR)/usr/include/$$f; \ + cp $$f $(TARGET_ROOTDIR)/usr/include/$$f; \ + fi \ + done Index: linux/include/_G_config.h diff -u linux/include/_G_config.h:1.92 linux/include/_G_config.h:1.97 --- linux/include/_G_config.h:1.92 Fri May 30 19:23:13 1997 +++ linux/include/_G_config.h Wed Aug 27 12:37:15 1997 @@ -2,10 +2,10 @@ #ifndef _G_config_h #define _G_config_h -#define _LINUX_C_LIB_VERSION "5.4.33" +#define _LINUX_C_LIB_VERSION "5.4.38" #define _LINUX_C_LIB_VERSION_MAJOR 5 #define _LINUX_C_LIB_VERSION_MINOR 4 -#define _LINUX_C_LIB_VERSION_SUBMINOR 33 +#define _LINUX_C_LIB_VERSION_SUBMINOR 38 #define _G_LIB_VERSION "2.7.2" Index: linux/include/signal.h diff -u linux/include/signal.h:1.4 linux/include/signal.h:1.5 --- linux/include/signal.h:1.4 Sat Jun 10 17:25:49 1995 +++ linux/include/signal.h Thu Jul 10 08:44:14 1997 @@ -143,13 +143,13 @@ #endif /* Use BSD. */ -#ifdef __USE_BSD_SIGNAL +#if defined(__USE_BSD_SIGNAL) || defined(__FAVOR_BSD) extern __sighandler_t __bsd_signal __P ((int __sig, __sighandler_t)); #define signal __bsd_signal -#endif /* __USE_BSD_SIGNAL */ +#endif /* __USE_BSD_SIGNAL || __FAVOR_BSD */ __END_DECLS Index: linux/include/arpa/tftp.h diff -u linux/include/arpa/tftp.h:1.1.1.1 linux/include/arpa/tftp.h:1.2 --- linux/include/arpa/tftp.h:1.1.1.1 Fri Feb 17 21:34:08 1995 +++ linux/include/arpa/tftp.h Fri Jun 27 09:33:23 1997 @@ -53,7 +53,7 @@ struct tftphdr { short th_opcode; /* packet type */ union { - short tu_block; /* block # */ + unsigned short tu_block; /* block # */ short tu_code; /* error code */ char tu_stuff[1]; /* request packet stuff */ } th_u; Index: linux/include/netinet/in.h diff -u linux/include/netinet/in.h:1.2 linux/include/netinet/in.h:1.3 --- linux/include/netinet/in.h:1.2 Sun Dec 17 20:24:10 1995 +++ linux/include/netinet/in.h Sun Jul 20 12:07:29 1997 @@ -20,6 +20,7 @@ #define _NETINET_IN_H 1 #include +#include #include __BEGIN_DECLS Index: linux/include/netinet/ip.h diff -u linux/include/netinet/ip.h:1.6 linux/include/netinet/ip.h:1.7 --- linux/include/netinet/ip.h:1.6 Mon Apr 7 09:47:26 1997 +++ linux/include/netinet/ip.h Thu Jul 10 08:44:14 1997 @@ -27,7 +27,7 @@ __u16 ip_off; __u8 ip_ttl; __u8 ip_p; - __u16 ip_csum; + __u16 ip_sum; struct in_addr ip_src,ip_dst; }; Index: linux/include/sys/quota.h diff -u /dev/null linux/include/sys/quota.h:1.1 --- /dev/null Tue Sep 2 13:37:11 1997 +++ linux/include/sys/quota.h Thu Jul 10 08:44:14 1997 @@ -0,0 +1,2 @@ +#include +#include