diff options
author | Holger Levsen <holger@layer-acht.org> | 2014-10-17 14:06:28 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2014-10-17 14:06:28 +0200 |
commit | 6bfe6f31dba1d2fa648eebf9c1218c5bd01744ad (patch) | |
tree | 23f6fca847460c7919c848e74f623e088f377c3f /bin | |
parent | fa823e46ab653d2cacaf6aa7481f9a1917e789e1 (diff) | |
download | jenkins.debian.net-6bfe6f31dba1d2fa648eebf9c1218c5bd01744ad.tar.xz |
common-functions.sh: prevent running as root
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/common-functions.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/common-functions.sh b/bin/common-functions.sh index 45c16f0c..583d5b5c 100755 --- a/bin/common-functions.sh +++ b/bin/common-functions.sh @@ -11,6 +11,11 @@ common_cleanup(){ common_init() { # check whether this script has been started from /tmp already if [ "${0:0:5}" != "/tmp/" ] ; then + # check that we are not root + if [ $(id -u) -eq 0 ] ; then + echo "Do not run this as root." + exit 1 + fi # mktemp some place for us... TTT=$(mktemp --tmpdir=/tmp jenkins-script-XXXXXXXX) # prepare cleanup |