1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-19 14:57:04 +00:00

userdb: Use protocol buffers instead of our custom format

Protocol buffers are a more portable, practical and safe format for the user
database.
This commit is contained in:
Alberto Bertogli
2016-09-18 01:12:41 +01:00
parent 5c6fb934fe
commit 394067bbd3
12 changed files with 384 additions and 316 deletions

View File

@@ -29,23 +29,19 @@ func main() {
os.Exit(1)
}
db, ws, err := userdb.Load(*dbFname)
db, err := userdb.Load(*dbFname)
if err != nil {
fmt.Printf("error loading database: %v\n", err)
os.Exit(1)
}
for _, w := range ws {
fmt.Printf("warning: %v\n", w)
if *adduser != "" && os.IsNotExist(err) {
fmt.Printf("creating database\n")
} else {
fmt.Printf("error loading database: %v\n", err)
os.Exit(1)
}
}
if *adduser == "" {
fmt.Printf("database loaded\n")
if len(ws) == 0 {
os.Exit(0)
} else {
os.Exit(1)
}
return
}
if *password == "" {