Unexport users map in htpasswd struct

This commit is contained in:
Michael Eischer
2022-06-21 00:18:05 +02:00
committed by Leo R. Lundgren
parent 6bc87b8e95
commit b0036d006b
+3 -3
View File
@@ -50,7 +50,7 @@ type HtpasswdFile struct {
path string path string
stat os.FileInfo stat os.FileInfo
throttle chan struct{} throttle chan struct{}
Users map[string]string users map[string]string
} }
// NewHtpasswdFromFile reads the users and passwords from a htpasswd file and returns them. If an error is encountered, // NewHtpasswdFromFile reads the users and passwords from a htpasswd file and returns them. If an error is encountered,
@@ -130,7 +130,7 @@ func (h *HtpasswdFile) Reload() error {
// Replace the Users map // Replace the Users map
h.mutex.Lock() h.mutex.Lock()
h.Users = users h.users = users
h.mutex.Unlock() h.mutex.Unlock()
_ = r.Close() _ = r.Close()
@@ -178,7 +178,7 @@ func (h *HtpasswdFile) Validate(user string, password string) bool {
_ = h.ReloadCheck() _ = h.ReloadCheck()
h.mutex.Lock() h.mutex.Lock()
realPassword, exists := h.Users[user] realPassword, exists := h.users[user]
h.mutex.Unlock() h.mutex.Unlock()
if !exists { if !exists {