Skip to content

Commit

Permalink
Fixup nil pointer error
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasScharpf committed Apr 18, 2024
1 parent fd05368 commit f45c526
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func validateConfig(c *Config) error {
"and 'tls_cert_file' specified.")
}

if c.AllowUnauthenticatedReads && c.TLSCaFile == "" && c.HtpasswdFile == "" && c.LDAP.URL == "" {
if c.AllowUnauthenticatedReads && c.TLSCaFile == "" && c.HtpasswdFile == "" && c.LDAP == nil {
return errors.New("AllowUnauthenticatedReads setting is only available when authentication is enabled")
}

Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func startHttpServer(c *config.Config, httpServer **http.Server,
statusHandler = h.VerifyClientCertHandler(statusHandler).ServeHTTP
} else if c.HtpasswdFile != "" {
statusHandler = basicAuthWrapper(statusHandler, &basicAuthenticator)
} else if c.LDAP.URL != "" {
} else if c.LDAP != nil {
statusHandler = ldapAuthWrapper(statusHandler, ldapAuthenticator)
}
}
Expand All @@ -303,7 +303,7 @@ func startHttpServer(c *config.Config, httpServer **http.Server,
middlewareHandler = h.VerifyClientCertHandler(middlewareHandler)
} else if c.HtpasswdFile != "" {
middlewareHandler = basicAuthWrapper(middlewareHandler.ServeHTTP, &basicAuthenticator)
} else if c.LDAP.URL != "" {
} else if c.LDAP != nil {
middlewareHandler = ldapAuthWrapper(middlewareHandler.ServeHTTP, ldapAuthenticator)
}
}
Expand Down

0 comments on commit f45c526

Please sign in to comment.