Patch-ID# 100266-07
Keywords: strcoll, colldef, localtime, fcvt, strxfrm, setlocale, fork, vfork, nl_langinfo, scanf, access, export, getpwuid, leak, collating, strcoll, strxfrm, strcmp, colldef, getgroups, initgroups
Synopsis: SunOS 4.1.1: Domestic libc replacement with all 4.1.1 patches to date
Date: 30-Apr-92

********************************************************************************

        This is the "domestic" version of the libc patch and should be given
        only to customers who are using the U.S. Encryption Kit.

********************************************************************************

	PLEASE read the ENTIRE installation discussion before proceeding with
	the installation of this patch.
 
********************************************************************************
 
SunOS release: 4.1.1
 
Unbundled Product: 
 
Unbundled Release: 
 
Topic: jumbo patch to integrate CTE fixes to libc for 4.1.1
 
BugId's fixed with this patch: 1034993 1045471 1033812 1038500 1050040 1053346 1051619 1053356 1069731 1069726 1033104 1069972 1061071 1054748 1049421 1070565 1059039 1087375 1072740 1088455 1041424

(revs 01 - 06)
      **1034993  _Q_get_rp_rd not in libc.a
      **1045471  shared C libraries reference undefined symbols:
		   __Q_get_rp_rd, _dlclose, _dlopen, _dlsym, _nl_langinfo
      **1033812  tzload(), called from tzset(), is off-by-one
      **1038500  localtime or tzsetwall corrupts malloc space
        1050040  fcvt() segment faults
	1051619  system() using fork() instead of vfork()
       *1053346  There should be no imposed length limit for strings in 
		   strcoll()
       *1053356  strxfrm using uninitialized variable
       *1052398  strxfrm is not 8 bit clean
	1069731  long format strings for sscanf, fscanf, and scanf cause 
		   data corruption
	1069726  nl_langinfo(D_T_FMT) returns NULL if setlocale defaulted to
		   "C" locale
	1033104  An /etc/hosts.equiv file opens up for any hosts.
	1069972  __Q_get_rp_rd, undefined symbol with patches 100267-02 (libc)
		   and 100173-06 (ld)
	1061071	 host cannot mount filesystem if it is after 1024th byte in 
	 	   the access list
	1054748	 ftp, ping dump core when connecting to a host with 
		   multiple DNS A records
	1049421  localtime.c writes a null byte 1 byte beyond allocated space
	1070565  c compiler stores wrong data for double
	1059039	 memory leak using getpwuid(3) on a host that uses NIS
(rev 07)
	1087375  opendir() hangs when passed the name of a named pipe
	1072740  strcoll() .... strxfrm() dumps core for locale >< C if
                 stdin closed
        1088455  strcoll returns bad results when collating spec exhausts
                 single char matrix
	1041424  initgroups failes under SysV - problem with getgroups


** 4.1 fixes that have been rolled into this 4.1.1 patch
*  libc patches needed with 'colldef' patch


Architectures for which this patch is available: sun3, sun4

Patches which may conflict with this patch: 

	These patches are now obsoleted by this patch:

        100167-01  strcmp fails to detect end-of-string null byte
	100203-01  fcvt() causes segmentation fault with INGRES
	100208-01  nl_langinfo, dlopen, dlclose, dlsym, Q_get_rp_rd
		   are unresolved externs


Obsoleted by: 


Problem Description: 

	All known patches to libc for 4.1.1 have been rolled into this 
	one libc set.  The patch id of this patch will remain constant 
	for the life of libc patches for 4.1.1.  Subsequent libc patches 
	will simply be higher revisions of this patch.

	The "standard" SunOS combinations of static, dynamic, and profiled
	libc's are contained in this patch.  In addition, a complete 
	replacement for /usr/lib/shlib.etc has also been included.


INSTALL: 

	The parts list for this patch is listed below.  The list is identical 
	between sun3 and sun4 sets (with the noted exception of the 
	major.minor numbers for the shared libs being different between sun3 
	and sun4).

		lib/libc.a
		lib/libc_p.a
		lib/libc.sa.1.6
		lib/libc.so.1.6
		5lib/libc.a
		5lib/libc_p.a
		5lib/libc.sa.2.6
		5lib/libc.so.2.6
		lib/shlib.etc/lorder-sparc
		lib/shlib.etc/objsort
		lib/shlib.etc/Makefile
		lib/shlib.etc/README
		lib/shlib.etc/awkfile
		lib/shlib.etc/libc_pic.a
		lib/shlib.etc/libcs5_pic.a


The libraries in this patch may be placed in any directory.  But if you
choose to place any libc.* in a location other than /usr/lib or
/usr/5lib, you'll have to use the -L flag with each ld execution to
"point" to the chosen directory that holds these substitutes.  Since
this is likely to be a somewhat awkward requirement, the patch and the
following install sequence assume you wish to substitute your standard
libraries with the patched versions.

The installation of ANY of the library parts may be done while the
system is running, EXCEPT for the SHARED libc's.  It is SAFEST to
substitute the shared libraries while SunOS is booted in single-user
mode or from the SunOS Installation miniroot.  Since using SunOS in
single-user mode is easier than booting the miniroot off the SunOS
Installation tapes, the install sequence below will reference
single-user mode.

There is one more consideration.  The installation sequence below will
overwrite ALL libc "variants" in /usr/lib and /usr/5lib.  If you have
added/substituted parts to libc.a or libc.s?.X.Y in /usr/lib and/or
/usr/5lib, you will need to 1) preserve these copies, or 2) plan to
resubstitute your material in with these patch versions.

It is highly recommended that you "walkthru" the installation sequence
below to become familiar with what is being done prior to actually
doing it.  You can vary and even skip some steps in these instructions
if you're *confident* you understand what is going on.  Bear in mind that
/usr/lib/libc.so.X.Y dynamically binds the *entire* SunOS and any
corruption to this particular library will render a system virtually
useless.


Installing the libc patch:  (perform the following steps in this order)

	o save patch distribution under some directory, say '/tmp/X'.
	o cd /tmp/X
	o su
	o (ensure no users are actively using any libc's)
	o mv /usr/lib/libc.a /usr/lib/libc.a.FCS
	o mv /usr/lib/libc_p.a /usr/lib/libc_p.a.FCS	(1)
	o mv /usr/5lib/libc.a /usr/5lib/libc.a.FCS	(2)
	o mv /usr/5lib/libc_p.a /usr/5lib/libc_p.a.FCS	(2)

	(1) if you do not have this file on your system, then the
	"Debugging" part of the OS distribution tape has not been 	
	loaded.

	(2) if you do not have this file on your system, then the
	"SystemV" part of the OS distribution tape has not been 	
	loaded.

You will rename your original shared libc's at a later point in the
installation.

        o mv /usr/lib/shlib.etc /usr/lib/shlib.etc.FCS
        o mkdir /usr/lib/shlib.etc
        o chmod g+s /usr/lib/shlib.etc

These last 3 steps may be done if you wish to preserve completely your
original /usr/lib/ shlib.etc.  If not, you may skip them.

	o cp -p -R `arch`/* /usr

		The arch command returns either sun3 or sun4. So you are 
		actually copying all the files in the respective directory
		to /usr. If you followed all steps mentioned above you are
		still in /tmp/X.

        o "quiet" system  (have users log off,announce system going down,...)
        o sync
        o halt
        o >b[oot] vmunix -s

You're now booting SunOS in single-user mode.  We will rename the shared
libc's to make them "active" and this is best done, at minimum, under
single-user.

	o cd /usr/lib
	o ls -l libc.s*

		You will get an output similar to the following:

		-rw-r--r--  1 root         7996 Feb  8  1990 libc.sa.1.5
		-rwxr-xr-x  1 root       516096 Feb  8  1990 libc.so.1.5
		-rw-r--r--  1 root         7996 Oct  4 05:00 libc.sa16
		-rw-r--r--  1 root       516096 Oct  4 05:13 libc.so16
	
		In the following move commands you have to substitute the
		X, Y and Z with the numbers you get from your output 
		( from the output above X=1, Y=5, Z=6). 

	o sync
	o mv libc.so.X.Y libc.so.X.Y.FCS     this saves the original file

	o mv libc.soXZ libc.so.X.Z 	     this copies the patch to its 
					     new place
	o mv libc.sa.X.Y libc.sa.X.Y.FCS     this saves the original file

	o mv libc.saXZ libc.sa.X.Z	     this copies the patch to its 
					     new place

	o date

Do this last step CAREFULLY.  IF the 'date' command does *anything*
else but show a proper date, then IMMEDIATELY do:

	o mv libc.so.X.Z libc.soXZ
	o mv libc.so.X.Y.FCS libc.so.X.Y
	o mv libc.sa.X.Z libc.saXZ
	o mv libc.sa.X.Y.FCS libc.sa.X.Y

If the date command is sucessful, continue here:

	o cd ../5lib
	o ls -l libc.s*

		You will get an output similar to the following:

		-rw-r--r--  1 root         7996 Feb  8  1990 libc.sa.2.5
		-rwxr-xr-x  1 root       516096 Feb  8  1990 libc.so.2.5
		-rw-r--r--  1 root         7996 Oct  4 05:00 libc.sa26
		-rw-r--r--  1 root       524288 Oct  4 05:15 libc.so26

		In the following move commands you have to substitute the
		X , Y and Z with the numbers you get from your output
		( from the output above X=2, Y=5, Z=6).  


	o mv libc.so.X.Y libc.so.X.Y.FCS     this saves the original file

	o mv libc.soXZ libc.so.X.Z 	     this copies the patch to its 
					     new place

	o mv libc.sa.X.Y libc.sa.X.Y.FCS     this saves the original file

        o mv libc.saXZ libc.sa.X.Z	     this copies the patch to its 
					     new place


Do this last step CAREFULLY also.

The 'X' and 'Y' values above correspond to the major/minor revision
numbers of the shared libc's.  These numbers differ between /usr/lib
and /usr/5lib and between sun3 and sun4 versions.

	o ranlib -t /usr/lib/libc*
	o ranlib -t /usr/5lib/libc*

		In these two ranlib commands you will see 
		
			not an archive: ........

		error message for all the libc.so* files. You can
		disregard them. It saves a lot of typing when you
		supply the "*" wildcard instead of typing in the ".a"
		and ".sa." filenames.

	o ^D

The install is complete.  The ^D above terminates single-user mode, and
brings your system back up in multi-user mode.

<<<<<<<<<<<<<<<<<<   end README  >>>>>>>>>>>>>>>>>>>>>>
