caddyhttp: Minor cleanup and fix nil pointer deref in caddyfile adapter

This commit is contained in:
Matthew Holt
2019-10-28 15:08:45 -06:00
parent b00dfd3965
commit 442fd748f6
3 changed files with 20 additions and 5 deletions

View File

@@ -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 {