"os"
"os/exec"
"path/filepath"
+ "reflect"
"strconv"
"strings"
"sync"
}
func publicKeyHandler(ctx ssh.Context, key ssh.PublicKey) bool {
+ // FIXME: the "ssh.Context" is not thread-safe, so db operations should use the immutable parent "Context"
+ // TODO: Remove after https://github.com/gliderlabs/ssh/pull/211
+ parentCtx := reflect.ValueOf(ctx).Elem().FieldByName("Context").Interface().(context.Context)
+
if log.IsDebug() { // <- FingerprintSHA256 is kinda expensive so only calculate it if necessary
log.Debug("Handle Public Key: Fingerprint: %s from %s", gossh.FingerprintSHA256(key), ctx.RemoteAddr())
}
// look for the exact principal
principalLoop:
for _, principal := range cert.ValidPrincipals {
- pkey, err := asymkey_model.SearchPublicKeyByContentExact(ctx, principal)
+ pkey, err := asymkey_model.SearchPublicKeyByContentExact(parentCtx, principal)
if err != nil {
if asymkey_model.IsErrKeyNotExist(err) {
log.Debug("Principal Rejected: %s Unknown Principal: %s", ctx.RemoteAddr(), principal)
log.Debug("Handle Public Key: %s Fingerprint: %s is not a certificate", ctx.RemoteAddr(), gossh.FingerprintSHA256(key))
}
- pkey, err := asymkey_model.SearchPublicKeyByContent(ctx, strings.TrimSpace(string(gossh.MarshalAuthorizedKey(key))))
+ pkey, err := asymkey_model.SearchPublicKeyByContent(parentCtx, strings.TrimSpace(string(gossh.MarshalAuthorizedKey(key))))
if err != nil {
if asymkey_model.IsErrKeyNotExist(err) {
log.Warn("Unknown public key: %s from %s", gossh.FingerprintSHA256(key), ctx.RemoteAddr())
if !setting.IsProd {
initTestQueueOnce()
}
- ctx.Data["Title"] = ctx.Tr("admin.monitor.queue")
+ ctx.Data["Title"] = ctx.Tr("admin.monitor.queues")
ctx.Data["PageIsAdminMonitorQueue"] = true
ctx.Data["Queues"] = queue.GetManager().ManagedQueues()
ctx.HTML(http.StatusOK, tplQueue)
"path"
"path/filepath"
"testing"
- "time"
"code.gitea.io/gitea/models/db"
packages_model "code.gitea.io/gitea/models/packages"
exitf("Environment variable $GITEA_ROOT not set")
}
- // Speedup tests that rely on the event source ticker.
- setting.UI.Notification.EventSourceUpdateTime = time.Second
+ // TODO: Speedup tests that rely on the event source ticker, confirm whether there is any bug or failure.
+ // setting.UI.Notification.EventSourceUpdateTime = time.Second
setting.IsInTesting = true
setting.AppWorkPath = giteaRoot