X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=passwd.go;h=f6760d2910091bdcbefc301d2d85f29ae471512e;hb=870decf5b24cae444450c4105ad807b44b6676ca;hp=6fb75f57a192702bcc793495a9c44de708d163af;hpb=bcfc26f87e27a5d749eeed3194681e8018df4c5b;p=gocheese.git diff --git a/passwd.go b/passwd.go index 6fb75f5..f6760d2 100644 --- a/passwd.go +++ b/passwd.go @@ -22,9 +22,16 @@ import ( "errors" "io/ioutil" "log" + "os" "strings" ) +var passwords map[string]Auther = make(map[string]Auther) + +type Auther interface { + Auth(password string) bool +} + func strToAuther(verifier string) (string, Auther, error) { st := strings.SplitN(verifier, "$", 3) if len(st) != 3 || st[0] != "" { @@ -46,6 +53,9 @@ func strToAuther(verifier string) (string, Auther, error) { func refreshPasswd() { passwd, err := ioutil.ReadFile(*passwdPath) + if os.IsNotExist(err) { + return + } if err != nil { log.Fatal(err) }