1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

chasquid-util: Create the domain directory when adding a user

When adding a user, chasquid-util should create the domain directory if
it doesn't exist, but currently doesn't do that.

This patch fixes this by adding the missing os.MkdirAll call.

Thanks to Martin Ferrari for the bug report!
This commit is contained in:
Alberto Bertogli
2016-11-22 20:25:30 +00:00
parent 279fff3cf8
commit 170aaaf490

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"syscall"
"bytes"
@@ -86,6 +87,7 @@ func userDBFromArgs(create bool) (string, string, *userdb.DB) {
if err != nil {
if create && os.IsNotExist(err) {
fmt.Println("Creating database")
os.MkdirAll(filepath.Dir(userDBForDomain(domain)), 0755)
} else {
Fatalf("Error loading database: %v", err)
}