mirror of
https://github.com/MegaManSec/SSH-Snake.git
synced 2024-12-04 20:30:37 +01:00
An empty filename or directory is not allowed.
This commit is contained in:
parent
b09bee2041
commit
d803989131
@ -1063,6 +1063,7 @@ done
|
||||
is_file() {
|
||||
local filename
|
||||
filename="$1"
|
||||
[[ -z "$filename" ]] && return 1
|
||||
[[ -v 'files["$filename"]' || ${#files["$filename"]} -gt 0 ]] && return 0
|
||||
[[ -v 'not_files["$filename"]' || ${#not_files["$filename"]} -gt 0 ]] && return 1
|
||||
${s} test -s "$filename" && ${s} test -r "$filename" && ${s} test -f "$filename" && files["$filename"]=1 && return 0
|
||||
@ -1072,6 +1073,7 @@ return 1
|
||||
is_dir() {
|
||||
local dir_name
|
||||
dir_name="$1"
|
||||
[[ -z "$dir_name" ]] && return 1
|
||||
[[ -v 'folders["$dir_name"]' || ${#folders["$dir_name"]} -gt 0 ]] && return 0
|
||||
[[ -v 'not_folders["$dir_name"]' || ${#not_folders["$dir_name"]} -gt 0 ]] && return 1
|
||||
${s} test -d "$dir_name" && ${s} test -r "$dir_name" && folders["$dir_name"]=1 && return 0
|
||||
|
4
Snake.sh
4
Snake.sh
@ -1785,6 +1785,8 @@ is_file() {
|
||||
|
||||
filename="$1"
|
||||
|
||||
[[ -z "$filename" ]] && return 1
|
||||
|
||||
[[ -v 'files["$filename"]' || ${#files["$filename"]} -gt 0 ]] && return 0
|
||||
[[ -v 'not_files["$filename"]' || ${#not_files["$filename"]} -gt 0 ]] && return 1
|
||||
|
||||
@ -1800,6 +1802,8 @@ is_dir() {
|
||||
|
||||
dir_name="$1"
|
||||
|
||||
[[ -z "$dir_name" ]] && return 1
|
||||
|
||||
[[ -v 'folders["$dir_name"]' || ${#folders["$dir_name"]} -gt 0 ]] && return 0
|
||||
[[ -v 'not_folders["$dir_name"]' || ${#not_folders["$dir_name"]} -gt 0 ]] && return 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user