avoid self-loops and cgi traps

master
KatolaZ 6 years ago
parent 41c081e96e
commit f9fe15e6a2
  1. 16
      burrow

@ -22,14 +22,26 @@
### ###
## function ## function
get_dirs(){ get_dirs(){
src_id="$1" src_type=$(echo "$1" | cut -d "|" -f 1)
src_sel=$(echo "$1" | cut -d "|" -f 2 | cut -d "?" -f 1)
src_host=$(echo "$1" | cut -d "|" -f 3)
src_port=$(echo "$1" | cut -d "|" -f 4)
src_id=$(echo "$1" | cut -d "|" -f 5)
##echo "src_sel: \"${src_sel}\"" >&2
OLDIFS=$IFS OLDIFS=$IFS
#IFS=$'\t\n' #IFS=$'\t\n'
IFS="|" IFS="|"
src_dir=$(echo "${src_id}" | cut -c -2) src_dir=$(echo "${src_id}" | cut -c -2)
touch "${src_dir}/${src_id}" touch "${src_dir}/${src_id}"
while read name sel host port; do while read name sel host port; do
##echo "sel: \"$sel\"" >&2
[ "$sel" = "Err" -o -z "$sel" ] && continue
TYPE=$(echo "$name" | cut -c 1) TYPE=$(echo "$name" | cut -c 1)
[ "$TYPE" = "i" ] && continue
dst_sel=$(echo "$sel" | cut -d "?" -f 1)
##echo "dst_sel: \"${dst_sel}\"" >&2
[ "${dst_sel}" = "${src_sel}" -a "${src_type}" = "$TYPE" \
-a "${src_host}" = "$host" -a "${src_port}" = "$port" ] && continue;
port=$(echo $port | sed -r -e 's/\r//g') port=$(echo $port | sed -r -e 's/\r//g')
dir_id=$(echo "${TYPE}|${sel}|${host}|${port}" | sed 's/^1||/1|\/|/g') dir_id=$(echo "${TYPE}|${sel}|${host}|${port}" | sed 's/^1||/1|\/|/g')
dest_id=$(echo "${dir_id}" | sha256sum | cut -d " " -f 1 ) dest_id=$(echo "${dir_id}" | sha256sum | cut -d " " -f 1 )
@ -91,6 +103,6 @@ echo "selector ${src_id} not found" >> logfile.txt
MYNAME=$(basename $0) MYNAME=$(basename $0)
if [ -z "${MYNAME##burrow}" ]; then if [ -z "${MYNAME##burrow}" ]; then
retrieve_selector "$SRC" | sed -r -e 's/\t/|/g' | get_dirs "${src_id}" retrieve_selector "$SRC" | sed -r -e 's/\t/|/g' | get_dirs "$SRC"
fi fi

Loading…
Cancel
Save