diff options
Diffstat (limited to 'auth_files.go')
-rw-r--r-- | auth_files.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/auth_files.go b/auth_files.go index 22b1e60..78adbac 100644 --- a/auth_files.go +++ b/auth_files.go @@ -188,6 +188,22 @@ func (a authFiles) ExportBans() ([]ban, error) { func (a authFiles) updateTimestamp(name string) { os.Mkdir(Path("auth"), 0700) + path := Path("auth/", name, "/timestamp") + + _, err := os.Stat(path) + if err != nil { + if os.IsNotExist(err) { + f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0600) + if err != nil { + return + } + + f.Close() + } + + return + } + t := time.Now().Local() - os.Chtimes(Path("auth/", name, "/timestamp"), t, t) + os.Chtimes(path, t, t) } |