Fix the registry validator to match the docker daemon code, and add some tests.

Docker-DCO-1.1-Signed-off-by: Jake Moshenko <jake@devtable.com> (github: jakedt)