X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=upload.go;h=e9581081da4026261a8429daaa50b184db36399e;hb=cc8232897ceab7f8dcfb7fce13de6ca75f1bdb74;hp=6a5e9bda003abb7ca15a842bbf39f17b697bad80;hpb=5f74f27dba4c477281305586ef96a39b4751851e;p=gocheese.git diff --git a/upload.go b/upload.go index 6a5e9bd..e958108 100644 --- a/upload.go +++ b/upload.go @@ -1,7 +1,7 @@ /* GoCheese -- Python private package repository and caching proxy -Copyright (C) 2019 Sergey Matveev - 2019 Elena Balakhonova +Copyright (C) 2019-2021 Sergey Matveev + 2019-2021 Elena Balakhonova This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,7 +39,9 @@ func serveUpload(w http.ResponseWriter, r *http.Request) { http.Error(w, "unauthenticated", http.StatusUnauthorized) return } - auther, ok := passwords[username] + PasswordsM.RLock() + auther, ok := Passwords[username] + PasswordsM.RUnlock() if !ok || !auther.Auth(password) { log.Println(r.RemoteAddr, "unauthenticated", username) http.Error(w, "unauthenticated", http.StatusUnauthorized)