diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2014-05-26 13:11:59 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2014-05-26 13:11:59 +1200 |
commit | 45ddbe84d77f52d9ffe8f71096211dbbe5b1f606 (patch) | |
tree | 5325353daa326b14ec94e0023a9d8084281ed0af | |
parent | Defensive umask (diff) | |
download | nwatch-45ddbe84d77f52d9ffe8f71096211dbbe5b1f606.tar.gz nwatch-45ddbe84d77f52d9ffe8f71096211dbbe5b1f606.zip |
Don't create parent directories
Possible security implications
-rwxr-xr-x | bin/nwatch | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -34,9 +34,11 @@ hostlist=${1:?} cachedir=${2:?} latest=$cachedir/${self}.scan.latest -# Create the cachedir or give up -if ! mkdir -p "$cachedir" ; then - exit +# If the cachedir doesn't exist, attempt to create it, otherwise give up +if [[ -d "$cachedir" ]] ; then + if ! mkdir -- "$cachedir" ; then + exit + fi fi # Today's values |