Don't lose my work

This commit is contained in:
Neil Alexander 2022-07-24 10:23:25 +01:00
parent 41b4bf69cf
commit 5616b9fc84
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
6 changed files with 140 additions and 124 deletions

View file

@ -1,6 +1,7 @@
package core
import (
"bytes"
"crypto/ed25519"
"encoding/hex"
"errors"
@ -215,12 +216,10 @@ func (intf *link) handler() (chan struct{}, error) {
}
}
// Check if we're authorized to connect to this key / IP
intf.links.core.config.RLock()
allowed := intf.links.core.config.AllowedPublicKeys
intf.links.core.config.RUnlock()
allowed := intf.links.core.config._allowedPublicKeys
isallowed := len(allowed) == 0
for _, k := range allowed {
if k == hex.EncodeToString(meta.key) { // TODO: this is yuck
for k := range allowed {
if bytes.Equal(k[:], meta.key) {
isallowed = true
break
}