Subject: bin/20196: etcupdate -a compares "md5" output to "sum" output
To: None <gnats-bugs@gnats.netbsd.org>
From: Christopher Richards <richards+netbsd@CS.Princeton.EDU>
List: netbsd-bugs
Date: 02/04/2003 03:19:46
>Number:         20196
>Category:       bin
>Synopsis:       etcupdate -a compares "md5" output to "sum" output
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 04 00:20:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Christopher Richards
>Release:        NetBSD 1.6_STABLE
>Organization:
 
>Environment:
	
	
System: NetBSD zembla.Princeton.EDU 1.6_STABLE NetBSD 1.6_STABLE (ZEMBLA) #46: Thu Jan 30 01:03:21 EST 2003 richards@zembla.Princeton.EDU:/home/richards/z/src/kern i386
Architecture: i386
Machine: i386
>Description:
	Running "etcupdate -a" stores checksums in MD5 format.  These
	checksums are compared to checksums in "sum" format, however, so
	the comparison is always false, rendering "-a" a nop.
	
>How-To-Repeat:
	Code inspection.
	
>Fix:
	Patch follows.  (Should apply to -current, too.)

Index: usr.sbin/etcupdate/etcupdate
===================================================================
RCS file: /cvsroot/src/usr.sbin/etcupdate/etcupdate,v
retrieving revision 1.3.2.5
diff -u -b -r1.3.2.5 etcupdate
--- usr.sbin/etcupdate/etcupdate	2003/01/27 06:44:39	1.3.2.5
+++ usr.sbin/etcupdate/etcupdate	2003/02/04 08:10:02
@@ -164,7 +164,7 @@
 	fi
 
 	if [ "${AUTOMATIC}" = "YES" -a -f "/etc/etcupdate/${1}"  ] ; then
-		SUM1=`sum "${1}"`
+		SUM1=`md5 "${1}"`
 		SUM2=`cat "/etc/etcupdate/${1}"`
 		if [ "${SUM1}" = "${SUM2}" ] ; then
 			install_file "${1}"

>Release-Note:
>Audit-Trail:
>Unformatted: