From 7825657f10ed93c6b2eeac5340d75a099224813a Mon Sep 17 00:00:00 2001 From: ajacoutot Date: Fri, 29 Aug 2008 08:17:28 +0000 Subject: [PATCH] - prevent sysmerge from installing a virgin master.passwd and group files (only allow delete or merge+install); requested by nick@ no objections from laurent@ krw@ oga@ ok sthen@ nick@ --- usr.sbin/sysmerge/sysmerge.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh index b04bd339cb6..99058b2181c 100644 --- a/usr.sbin/sysmerge/sysmerge.sh +++ b/usr.sbin/sysmerge/sysmerge.sh @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: sysmerge.sh,v 1.19 2008/07/21 08:28:55 ajacoutot Exp $ +# $OpenBSD: sysmerge.sh,v 1.20 2008/08/29 08:17:28 ajacoutot Exp $ # # This script is based on the FreeBSD mergemaster script, written by # Douglas Barton @@ -255,7 +255,9 @@ diff_loop() { if [ -z "${BATCHMODE}" ]; then echo " Use 'd' to delete the temporary ${COMPFILE}" - echo " Use 'i' to install the temporary ${COMPFILE}" + if [ "${COMPFILE}" != "./etc/master.passwd" -a "${COMPFILE}" != "./etc/group" ]; then + echo " Use 'i' to install the temporary ${COMPFILE}" + fi if [ -z "${NO_INSTALLED}" -a -z "${IS_BINFILE}" ]; then echo " Use 'm' to merge the temporary and installed versions" echo " Use 'v' to view the diff results again" @@ -275,12 +277,18 @@ diff_loop() { echo "\n===> Deleting ${COMPFILE}" ;; [iI]) - echo "" - if mm_install "${COMPFILE}"; then - echo "===> ${COMPFILE} installed successfully" + if [ "${COMPFILE}" != "./etc/master.passwd" -a "${COMPFILE}" != "./etc/group" ]; then + echo "" + if mm_install "${COMPFILE}"; then + echo "===> ${COMPFILE} installed successfully" + else + echo " *** WARNING: Problem installing ${COMPFILE}, it will remain to merge by hand" + fi else - echo " *** WARNING: Problem installing ${COMPFILE}, it will remain to merge by hand" + echo "invalid choice: ${HANDLE_COMPFILE}\n" + HANDLE_COMPFILE="todo" fi + ;; [mM]) if [ -z "${NO_INSTALLED}" -a -z "${IS_BINFILE}" ]; then -- 2.20.1