2 # deny-rsync [message]: send an rsync-protocol error message
5 exit_code=4 # same as a daemon that refuses an option
7 # byte_escape 29 ==> \035
9 octbyte="000$(bc <<<"obase=8; $1")"
10 echo -n "\\${octbyte: -3}"
14 if [ "${#msg}" -gt 255 ]; then
15 # message is too long for this naive script to handle
19 # send protocol version
20 echo -ne "$(byte_escape $protocol_version)\\000\\000\\000"
23 echo -ne "\\000\\000\\000\\000"
25 # the following is equivalent to rwrite(FERROR, $msg)
26 # message header: length 17; MPLEX_BASE + code FERROR
27 echo -ne "$(byte_escape ${#msg})\\000\\000\\010"