From 20e095019a2e704804080e73b3382053e230a67d Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Wed, 22 May 2024 20:48:51 -0300 Subject: [PATCH] Prevent root using clone|pull|checkout commands --- libexec/portzap/portzap-checkout | 5 +++++ libexec/portzap/portzap-clone | 5 +++++ libexec/portzap/portzap-pull | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/libexec/portzap/portzap-checkout b/libexec/portzap/portzap-checkout index b183a72..4210d32 100644 --- a/libexec/portzap/portzap-checkout +++ b/libexec/portzap/portzap-checkout @@ -24,6 +24,11 @@ printerr() { ## # main +if [ "$(id -u)" = "0" ]; then + printerr "you must be a user other than root" + exit 1 +fi + if ! "${libexec}"/isportzap-member; then printerr "$(id -un) is not a member of _portzap" exit 1 diff --git a/libexec/portzap/portzap-clone b/libexec/portzap/portzap-clone index 64e9b25..67a2464 100755 --- a/libexec/portzap/portzap-clone +++ b/libexec/portzap/portzap-clone @@ -25,6 +25,11 @@ printerr() { ## # main +if [ "$(id -u)" = "0" ]; then + printerr "you must be a user other than root" + exit 1 +fi + if ! "${libexec}"/isportzap-member; then printerr "$(id -un) is not a member of _portzap" exit 1 diff --git a/libexec/portzap/portzap-pull b/libexec/portzap/portzap-pull index f3f0e67..ce4e134 100755 --- a/libexec/portzap/portzap-pull +++ b/libexec/portzap/portzap-pull @@ -23,6 +23,11 @@ printerr() { ## # main +if [ "$(id -u)" = "0" ]; then + printerr "you must be a user other than root" + exit 1 +fi + if ! "${libexec}"/isportzap-member; then printerr "$(id -un) is not a member of _portzap" exit 1