russ/lacquer — pull request #15 by redterror (2012-10-05 19:27:03+00:00)
Title: Fix an extra newline in the auth challenge construction

Quoting the Varnish CLI docs (https://www.varnish-cache.org/trac/wiki/CLI), the auth challenge reply has a small bug:

The authenticator is calculated by applying the SHA256 function to the following byte sequence:

Challenge string
Newline (0x0a) character.
Contents of the secret file
Challenge string
Newline (0x0a) character.

The current implementation has an extra newline between the secret and the salt. This is probably masked by an oft-occurring extra newline most people's editors put in a file that just has one line. If you use an automated tool like chef to write out this file from a string, the extra newline isn't there and you are left wondering why your perfectly equal strings result in an auth failure. :)