This commit is contained in:
Lennart J. Kurzweg (Nx2)
2026-04-23 17:32:30 +02:00
parent f66f58f67f
commit f61e014d2a
5 changed files with 46 additions and 61 deletions

View File

@@ -8,7 +8,6 @@ import (
"log"
"net/http"
"net/url"
"os/exec"
"path"
"slices"
"strings"
@@ -140,16 +139,9 @@ func (b *DBBackend) initSchema(ctx context.Context) error {
}
func (b *DBBackend) resolvePassword(u config.User) (string, error) {
var raw string
if u.PasswordCmd != "" {
cmd := exec.Command("sh", "-c", u.PasswordCmd)
out, err := cmd.Output()
if err != nil {
return "", fmt.Errorf("failed to run password command for %s: %v", u.Name, err)
}
raw = strings.TrimSpace(string(out))
} else {
raw = u.Password
raw, err := config.ResolvePassword(u.Password, u.PasswordCmd)
if err != nil {
return "", fmt.Errorf("failed to resolve password for %s: %v", u.Name, err)
}
// If it already looks like a bcrypt hash, return as is.