]> Cypherpunks.ru repositories - gocheese.git/blobdiff - upload.go
FIFO-based password management
[gocheese.git] / upload.go
index 59c18404396905d6bb13b0f539e74fd211ea4014..e9581081da4026261a8429daaa50b184db36399e 100644 (file)
--- a/upload.go
+++ b/upload.go
@@ -1,7 +1,7 @@
 /*
 GoCheese -- Python private package repository and caching proxy
-Copyright (C) 2019-2020 Sergey Matveev <stargrave@stargrave.org>
-              2019-2020 Elena Balakhonova <balakhonova_e@riseup.net>
+Copyright (C) 2019-2021 Sergey Matveev <stargrave@stargrave.org>
+              2019-2021 Elena Balakhonova <balakhonova_e@riseup.net>
 
 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)