]> Cypherpunks.ru repositories - gocheese.git/blobdiff - passwd.go
Split pretty huge gocheese.go
[gocheese.git] / passwd.go
index 6fb75f57a192702bcc793495a9c44de708d163af..f6760d2910091bdcbefc301d2d85f29ae471512e 100644 (file)
--- 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)
        }