Initial commit
This commit is contained in:
26
lib.sh
Normal file
26
lib.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
abort() {
|
||||
echo "$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
info() {
|
||||
if [ -z "$quiet" ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
verbose() {
|
||||
if [ -n "$verbose" ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
checkPathComponent() {
|
||||
local msg="Dangerous path component discovered: $1"
|
||||
if [ "$1" = "." -o "$1" = ".." ]; then
|
||||
abort "$msg"
|
||||
fi
|
||||
if echo "$1" | grep --quiet -F "/"; then
|
||||
abort "$msg"
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user