|
|
@ -51,7 +51,7 @@ func ParseHtpasswd(htpasswdBytes []byte) (Passwds, error) { |
|
|
|
_, exists := passwords[parts[0]] |
|
|
|
_, exists := passwords[parts[0]] |
|
|
|
|
|
|
|
|
|
|
|
if exists { |
|
|
|
if exists { |
|
|
|
err = errors.New("invalid htpasswords file - user " + |
|
|
|
err = errors.New("invalid htpasswd file - user " + |
|
|
|
parts[0] + " defined more than once") |
|
|
|
parts[0] + " defined more than once") |
|
|
|
return passwords, err |
|
|
|
return passwords, err |
|
|
|
} |
|
|
|
} |
|
|
@ -163,7 +163,7 @@ func (pp Passwds) VerifyUser(user, passwd string) error { |
|
|
|
return alg.Match(passwd, pp[user]) |
|
|
|
return alg.Match(passwd, pp[user]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Write will cwrite the Passwd object to the given file
|
|
|
|
// Write will write the Passwd object to the given file
|
|
|
|
func (pp Passwds) Write(file string) error { |
|
|
|
func (pp Passwds) Write(file string) error { |
|
|
|
return os.WriteFile(file, pp.Bytes(), os.ModePerm) |
|
|
|
return os.WriteFile(file, pp.Bytes(), os.ModePerm) |
|
|
|
} |
|
|
|
} |
|
|
|