[comp.unix.xenix] Xenix 386 crypt fix.

ag@portnoy.CTS.COM (Keith Gabryelski) (04/02/88)

See previous post for an explanation of the bug and a test program.

This binary patch is for 386 SCO Xenix users.

I could have just as easily posted just the new crypt.o, but to avoid
any legal problems I made it so that you have to have the old broken
crypt.o in order to get the new one.

The bug was found and fixed by myself Michael Ditto (ford@kenobi.UUCP)
using only our bare hands and adb (Well, with some help from M-x
compare-windows, etc.).

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	ORIGScrypt.o	(A copy of the old (broken) Scrypt.o 286 small module)
#	ORIGMcrypt.o	(A copy of the old (broken) Mcrypt.o 286 middle module)
#	ORIGLcrypt.o	(A copy of the old (broken) Lcrypt.o 286 large module)
#	ORIGcrypt.o	(A copy of the old (broken) crypt.o 386 library)
#	NEWScrypt.o	(A copy of the new (fixed) Scrypt.o small module)
#	NEWMcrypt.o	(A copy of the new (fixed) Mcrypt.o middle module)
#	NEWLcrypt.o	(A copy of the new (fixed) Lcrypt.o large module)
#	NEWcrypt.o	(A copy of the new (fixed) Lcrypt.o 386 library)
#    The new [SML3]crypt.o will also be installed in /lib/[SML]libc.a and
#    /lib/386/libc.a
#
# This archive created: Fri Apr  1 12:33:07 1988
export PATH; PATH=/bin:$PATH
if test -f '386patch'
then
	echo shar: will not over-write existing file "'386patch'"
else
cat << \SHAR_EOF > '386patch'
begin 666 386patch
M                                                            
M                          ,      ']HC@8 H:!"%6&AN"X !D(#%1T:
M!55:"Q$=#%!'# L!0%H;!14514 %%15$1@P!'0=06QT1 %!!$0!LII )J3-5
M!  #!P4/P) )J>%3 P % P=?SY )J:D    '  :G/Y )J<-N!  ( 0@TKY((
M OW\_/O[_53+D T  P(#  ,"!T1!1$2^,Z0H"E4 /@(1!@$&%@%E!E@L%A$?
M#AQY!ED\$0L)!'0(5SH+#1$+"01T*HOO50$"    .@@8"#@(& @^"!@(. @8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__\67@   #EYY?O___]_PN;[____\'KU____7^?[__]=YOO__T?G^___
M%O____^AH*0V/#5BQO\:*F :+V :-& :0& :1V :4F :?&!:OJG[&L-@&NA@
M&O5@&O]@&PQ@&U1@&W]@6YRI_1NA8!NQ8.UNU?___OB@C)J+E)J&_______Y
?H)R-AH^+;_S____WH)J1G(V&CXN=_O___Z]U_?__B_B@
 
end
SHAR_EOF
fi # end of overwriting check
if test -f 'Lpatch'
then
	echo shar: will not over-write existing file "'Lpatch'"
else
cat << \SHAR_EOF > 'Lpatch'
begin 666 Lpatch
M                                                            
M                                                            
M                                        &P     U     !@     
M>                                                           
M                                                            
M                &                                           
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M  ";H[@#^0, 5>YPOPC/UI_/2)^Z]LOUBX2 51-G8 E>G(Y&"";=$=1^#H2#
MBAP7V)O5WHT8#JC,3]D"P_^+#IB?1AMUQ'^.+7B!3MZ*1Q2U)!P W@JXXE<O
MH7/&17"% .AZ(_\8Y'O,N-5=D8:A'XL=B46YJ "1^>^)SGN^&$0CXQCD>\RX
MU5V]AN)%< ^8NT<;Q%V$C3-M 2BRR__><U(./_^:L(Y 3[G<$3/HB'[N TT,
MIO82#A"*'W3: 4]',HNI& -?B(F2A:>#9Y.D0,%\_)LC]6'VYRNQ"7O@?$3"
MN_U6_OW9#PT             !@                                  
M    4                                             !.F^0 K@_Y
MB\([_&?_#0N#5QO_3U[Z?+9P"MB*"LB*#O")'=/;J@1_ );!RXU!S?P63I+4
M=S6. [!L=,#V4>'\(-?@)@\ .   1@  8.18, %,0X<3B$!:(3K366>)VYL+
M:E4MB$ [@%KCFU'4<$/;$W"TT#/@V]1PS]F;VU(/3[*>8N70.(E?HH44BM[U
M4WQVL]4U40 +<J,IB1SA17W- 6#Z AZ5 EM\30(#PL[2<V+W67R[^ZY'?J X
MBP\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EOF
fi # end of overwriting check
if test -f 'Mpatch'
then
	echo shar: will not over-write existing file "'Mpatch'"
else
cat << \SHAR_EOF > 'Mpatch'
begin 666 Mpatch
M                                                            
M                                                            
M                                        "      (      0     
M?                                                           
M                                                            
M                '                                           
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M  ";HT  :)P'54RF)\](!?^@P -65BNC 6@X"I@1V ->!MT1U'X.A(.*'!?8
MF]7>B1GY L/_BPZ8GT8;=<1_ABU\@+EPA!SH>R/^'^11;0CLN7*% >BU)0  
MWPJYY5<- ,/_H9.&H!]$&W9=@MEUS'N_&(LE  #?"KGE5PT P^.AOX;C1;\)
M>Z-\:K$ !MV.* #,?4*$((M L<$'?3+C1X@P]QEEVT\ 1O8  "@         
M  "63KB']^X!76B)@(N?"7CG?D$8=7:790.N\@ SBD;">_Z8^3OJ-7R@;_<7
M Y3>;K%S68MVN H FE=6*__=TRO_$@[8 \:-4D2AC@^?_,\&=T,[:C@&@NG'
MQ8 ( /=VL ]T(_[QZRC-N!6*S;S5=LWD8?P A""&,(:_@+BC@]!7#9//N,=N
M#>4B 5F*@8O( 4W2AJ"(0(C&>(R53'<%18M$Q'S/3*'QU$>^!O<89'MZ#DZ.
MFTE1U3-K0T(.3XB;23%K6UH.38F;$PEK$%&("VF'40!" ]HYB$ ZQ6+CT#N)
MVCP 0K+=662+VQ(UR=!X   !0ST%2^/;4TTV+M)XBIY\#-^PFEJ@1X@D22;2
M;C5KT'-B]UE\Z?NO1WY5D=)S8O=9?!T" \*<TG)B]ZR%LH?A1;&G_H#Y..HJ
M?-3W]X;!9&>@)P&9+P"X *  $ ^AB)^Q<!=_;#6UB0WQ1 MZJ'^DJ "J^4K\
MS>#+?781.H 6RX+; ,Q["WUFFXV);'+]HWH#'</% H0PB+<(X6I_;RITE,U#
MB)D '@&9S0 #7T$+_F?_(FN#8-L?BWW6$]\,.[N#7IR( 4>#J!97')C;H^%=
MC=9UKL3_*VSK(H/^%RL!W3D/;OJY0(/5C:\-#_=CH*OZ!SNOU/CWK[ATB89B
M6/!3U&"M1W:/Z'&6_JO[5^;G1O]&A4]<+7S!'*%"_DU#BXW$W2^F$5X(_T:+
M3@6S?X!ZHD+^S@?F1O^+U:ST@'MN=H+;?;BZ@#3_G-7Q"##VT6WW 4%F HDM
M<N[__+.@ H.)$-&FC@)6_9X*. :!> 1T@'7?">^N+: W,T#^?"%8(""(3"4R
M0/A\)KO!B;$8   "#@@ WPJY_O8_-H!VA22&H*C=2A9 H(,@F4>#_P;_#4+%
M??QEZL#=W0<61B@$>V719OZXA<3SJ @FD_W#+V[.  !'@]3YK8Y]_O@N=)!U
MX?2%JT)F#L6 N=F! O^N?4!T:'WV>B-Z0@"X]7L_N'I >@0#>.<"BC/X*)P>
MIE^'1A-XXID/_UG+=*+]!,?9F6>QFV6_FW^XFYG$%"+,5-ST>\^!XIH \P  
M@   M@  L@  FP !H@ )^,G+;!R= 9$  :   4( "4#)Q2W961:@6PJN67FR
M47)_G0"2  "?  !W  N=R<8PTEHTV5@MI5@:KU@5M5@.OEA]F%AAGEI=:EA(
M;EI'=UBT>UBM2EJ84UJ/7EJ#*UKZ/UC\#EK@&5KD\%LY^ULJQE,@!IP![0 !
M^@ !F  !@P !M@(!D ( >   5@ (K,O'O"I;J#%;K#A9FCQ;GP-;BPI9C^!9
MA>=;Z_-;YO5;VL%;U<93PQF<K-N[Q$&>PW#LH5;VH6>?Q!&;DV0D>O7D?0( 
2"5@Z'08&$A4-W@  $M5A<GD$
 
end
SHAR_EOF
fi # end of overwriting check
if test -f 'Spatch'
then
	echo shar: will not over-write existing file "'Spatch'"
else
cat << \SHAR_EOF > 'Spatch'
begin 666 Spatch
M                                                            
M                                                            
M                                 !@     ^      $     'P     
M                                                            
M                                                            
M         !P                                                 
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                        FZ-6
M &B<!U5,IB?/2'?_H.%5*O:*T0OL(('8ZUX$W1'4?@Z$@XH<%]B;U=R)&?L"
MP_^+#IB?1AMUQ'^&+WR N7"$'.A[(_X?Y%%M".RY<H4!Z+4E  #?"KGE5PT 
MP_^ADX:@'T0;=EV"V77,>[\8BR4  -\*N>57#0##XZ&_AN-%OPE[HWQJL0 &
MW8XH ,Q]0H0@BT"QP0=],N-'B##W&67;3P!&]@  *            )9.N(?W
M[@%=:(F BY\)>.=^01AU=I=E Z[R #.*1L)[_ICY.^HU?*!O]Q<#G-YNL7M9
MBP2X"E>^*__=TRO_$@[8 \:/4D2AC ^?_,\&=T,[:C@&@NG'Q8 & /=VO@]T
M(_[QZRC-N!6*S;S5=LWD8?P A""&,(:_@+BC@]!7#9//N,=N#>4B 5F*@8O(
M 4W2AJ"(0(C&>(R53'<%18M$Q'S/3*'QU$>^!O<89'MZ#DZ.FTE1U3-K0T(.
M3XB;23%K6UH.38F;$PEK$%&("VF'40!" ]HYB$ ZQ6+CT#N)VCP 0K+=662+
MVQ(UR=!X   !0ST%2^/;4TTV+M)XBIY\#-^PFEJ@1X@D22;2;C5KT'-B]UE\
MZ?NO1WY5D=)S8O=9?!T" \*<TG)B]ZR%LH?A1;&G_H#Y..HJ?-3W]X;!9&>@
M)P&9+P"X *  $ ^AB)^Q<!=_;#6UB0WQ1 MZJ'^DJ "J^4K\S>#+?781.H 6
MRX+; ,Q["WUFFXV);'+]HWH#'</% H0PB+<(X6I_;RITE,U#B)D '@&9S0 #
M7T,+_F?_(FN#8-L?BWW6&]\,.[N#7NR( 1#5U+:Z;G9;BZ/>/1?W&9/\Z\J#
M_A<K =TY#V[ZN4"#U8VO#0_W8Z"K^@<[K]3X]Z^X=(F$8ECR4]1@K4=VC^AQ
MEOZK^U>4YT9\@@:@J,(.+YR) 'WU@@DZD]Z/#N[_1H5.!;-_@'JB0O[.!^9&
M_XO5K/2 >VYV@MM]N+J -/^<U?$(,/C1;?D!068"B2UR[O_\LZ "@XD0T::.
M E;]G@HX!H%X!'2 ==\)[ZXMH#<S0/Y\(5@@((A,)3) ^'PFN\&)L1@   (.
M" #?"KG^]C\V@':%)(:@J-U*%D"@@R#K1X-\PGB/Q7WG?I&]W3%M/E"X _N!
MCOZXA<3SJ @FD_W%+V[.  !'@]3YK8Y]_O@N=)!UX?2%JT)F#L6 N=F! O^N
M?4!T:'WV>B-Z0@"X]7L_N'I >@0#>.<"BC/X*)P>IE^'1A-XXID/_UG#(*+]
M!,?7F6>'FV6%FW^.FYG.%"+:7 #">X?Y_)H G0  @@  B   D  !=0 !K !!
MZ,F#8A2= 8\  :(  40 043)Q27=60ZD6P*R67&V&6ASG0"T  ")  !I $.5
MR<8TUEHHW5@AJ5@>LU@)N5@"@EAQG%AF8EI1;EA,<EJ[>UBH?UBA3EJ<5UJ#
M(EJ'+UK^ UCP$EKD'5K8]%L]_ULNRALF&IP!]P !^  !G@ !C0 !L (!E@( 
M=@  4 ! K,O'LBQ;KC-;HCI9F#Y;G05;B0Q9C>)9^^E;Z?5;Y/M;V,-;R\0;
MPQN<W]F[Q#^>PW+LH53VH66?Q ^;VV0D>C3D<0( "5@Z'08&$A4-W   '-5A
#<GD$
 
end
SHAR_EOF
fi # end of overwriting check
if test -f 'xorit.c'
then
	echo shar: will not over-write existing file "'xorit.c'"
else
cat << \SHAR_EOF > 'xorit.c'
#include <stdio.h>

#define DEC(c)	(((c) - ' ') & 077)

#define xorit(ch) putchar((ch)^getc(orig))


main(argc, argv)
int argc;
char *argv[];
{
    int n;
    FILE *orig;
    char a, b, c, d;

    if (argc<3)
    {
	fprintf(stderr, "Usage: xorit <originalfile> <patchfile>\n");
	exit(-1);
    }

    if ((orig=fopen(argv[1], "r")) == NULL)
    {
	perror(argv[1]);
	exit(1);
    }

    if (freopen(argv[2], "r", stdin) == NULL)
    {
	perror(argv[2]);
	exit(1);
    }

    if (scanf("begin %*o %*s "))
    {
	fputs("xorit: bad uudecode input\n", stderr);
	exit(1);
    }

    while ((n=getchar()) != EOF && (n=DEC(n))!=0)
    {
	while (n>0)
	{
	    a = DEC(getchar());
	    b = DEC(getchar());
	    c = DEC(getchar());
	    d = DEC(getchar());
	    if (n-- > 0) xorit(a << 2 | b >> 4);
	    if (n-- > 0) xorit(b << 4 | c >> 2);
	    if (n-- > 0) xorit(c << 6 | d);
	}
	if ( (n=getchar()) != '\n' )
	{
	    fputs("xorit: bad uudecode input\n", stderr);
	    exit(1);
	}
    }

    exit(0);
}
SHAR_EOF
fi # end of overwriting check

set -e

echo "Extracting the old [SML ]crypt.o from [SML ]libc..."
ar x /lib/Slibcrypt.a Scrypt.o
mv Scrypt.o ORIGScrypt.o

ar x /lib/Mlibcrypt.a Mcrypt.o
mv Mcrypt.o ORIGMcrypt.o

ar x /lib/Llibcrypt.a Lcrypt.o
mv Lcrypt.o ORIGLcrypt.o

ar x /lib/386/Slibcrypt.a crypt.o
mv crypt.o ORIGcrypt.o

echo "Making the patch..."
cc -o xorit xorit.c
./xorit ORIGScrypt.o Spatch > Scrypt.o
./xorit ORIGMcrypt.o Mpatch > Mcrypt.o
./xorit ORIGLcrypt.o Lpatch > Lcrypt.o
./xorit ORIGcrypt.o 386patch > crypt.o

echo "Installing the new [SML ]crypt.o into [SML ]libc..."
ar r /lib/Slibcrypt.a Scrypt.o
mv Scrypt.o NEWScrypt.o
cp ORIGScrypt.o /lib		# Save a copy for future reference

ar r /lib/Mlibcrypt.a Mcrypt.o
mv Mcrypt.o NEWMcrypt.o
cp ORIGMcrypt.o /lib		# Save a copy for future reference

ar r /lib/Llibcrypt.a Lcrypt.o
mv Lcrypt.o NEWLcrypt.o
cp ORIGLcrypt.o /lib		# Save a copy for future reference

ar r /lib/386/Slibcrypt.a crypt.o
mv crypt.o NEWcrypt.o
cp ORIGcrypt.o /lib/386		# Save a copy for future reference

echo "Cleaning up..."
rm xorit xorit.c Spatch Mpatch Lpatch 386patch

echo "All done."

#	End of shell archive
exit 0
-- 
[  Keith   ]  UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!portnoy!ag
[Gabryelski]  INET: ag@portnoy.cts.com      ARPA: crash!portnoy!ag@nosc.mil