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

chasquid-util: Handle usernames without domain

Usernames must be of the form user@domain. When the domain is missing,
this patch makes chasquid-util emit a friendly error (instead of
crashing).
This commit is contained in:
Alberto Bertogli
2017-04-10 19:22:40 +01:00
parent b86463f123
commit c4255933bd

View File

@@ -82,6 +82,9 @@ func userDBForDomain(domain string) string {
func userDBFromArgs(create bool) (string, string, *userdb.DB) {
username := args["<username>"].(string)
user, domain := envelope.Split(username)
if domain == "" {
Fatalf("Domain missing, username should be of the form 'user@domain'")
}
db, err := userdb.Load(userDBForDomain(domain))
if err != nil {