From 442fd748f6ef1215fb859d8aefe6c817988d189a Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 28 Oct 2019 15:08:45 -0600 Subject: caddyhttp: Minor cleanup and fix nil pointer deref in caddyfile adapter --- modules/caddyhttp/caddyauth/command.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/caddyhttp/caddyauth') diff --git a/modules/caddyhttp/caddyauth/command.go b/modules/caddyhttp/caddyauth/command.go index c110001..70a11a0 100644 --- a/modules/caddyhttp/caddyauth/command.go +++ b/modules/caddyhttp/caddyauth/command.go @@ -56,6 +56,10 @@ func cmdHashPassword(fs caddycmd.Flags) (int, error) { plaintext := []byte(fs.String("plaintext")) salt := []byte(fs.String("salt")) + if len(plaintext) == 0 { + return caddy.ExitCodeFailedStartup, fmt.Errorf("password is required") + } + var hash []byte var err error switch algorithm { -- cgit v1.2.3