peek_packet.c: perform more validation and extract host= param
commit764d5c3e0109e7a4f90dca5351e2c03da15796b8
authorKyle J. McKay <mackyle@gmail.com>
Tue, 6 Oct 2020 07:33:49 +0000 (6 00:33 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Tue, 6 Oct 2020 07:33:49 +0000 (6 00:33 -0700)
treeeba377e209caea9dfd751c31f2b2c55cf53033d1
parent913b8351fe4a7bc29699bfb5b40adb6bbaae670d
peek_packet.c: perform more validation and extract host= param

Perform a bit more validation on the format of the initial incoming
git daemon request packet and reject poorly formatted packets or
packets with unwanted control characters.

Additionally, if the "host=" parameter is found (included since
ancient Git versions), extract and parse it and dump out one or two
extra shell-friendly lines to provide a lowercased version of the
host name and a range-checked port number.

Consumers of the `peek_packet` output will need to adapt to handle
the case in which more than one line is output.  This will normally
always happen now unless a very ancient version of Git was used as
the client.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
src/peek_packet.c