summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysupgrade
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2019-04-26 06:13:48 +0000
committerflorian <florian@openbsd.org>2019-04-26 06:13:48 +0000
commit3859784b591d7527b2e497a3ea77143bd32c0c08 (patch)
treeec598fc42062b2dcd8540ef40de8ec42db7352b3 /usr.sbin/sysupgrade
parentAdditional devices that are supported by uslcom. (diff)
downloadwireguard-openbsd-3859784b591d7527b2e497a3ea77143bd32c0c08.tar.xz
wireguard-openbsd-3859784b591d7527b2e497a3ea77143bd32c0c08.zip
check owner and permission of download directory
Diffstat (limited to 'usr.sbin/sysupgrade')
-rw-r--r--usr.sbin/sysupgrade/sysupgrade.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh
index 21d1df6b6eb..fcafbaffaa6 100644
--- a/usr.sbin/sysupgrade/sysupgrade.sh
+++ b/usr.sbin/sysupgrade/sysupgrade.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: sysupgrade.sh,v 1.2 2019/04/25 22:12:11 naddy Exp $
+# $OpenBSD: sysupgrade.sh,v 1.3 2019/04/26 06:13:48 florian Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015 Robert Peichaer <rpe@openbsd.org>
@@ -97,9 +97,18 @@ else
URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/
fi
-# XXX be more paranoid who owns this directory
+if [[ -e ${SETSDIR} ]]; then
+ eval $(stat -s ${SETSDIR})
+ [[ $st_uid -eq 0 ]] ||
+ ug_err "${SETSDIR} needs to be owned by root:wheel"
+ [[ $st_gid -eq 0 ]] ||
+ ug_err "${SETSDIR} needs to be owned by root:wheel"
+ [[ $st_mode -eq 040755 ]] ||
+ ug_err "${SETSDIR} is not a directory with permissions 0755"
+else
+ mkdir -p ${SETSDIR}
+fi
-mkdir -p ${SETSDIR}
cd ${SETSDIR}
unpriv -f SHA256.sig ftp -Vmo SHA256.sig ${URL}SHA256.sig