mirror of
https://github.com/netbirdio/netbird.git
synced 2025-02-16 18:21:24 +01:00
Reject adding peer if already exists with the pub key (#925)
This commit is contained in:
parent
b2447cd9a3
commit
612ae253fe
@ -495,6 +495,11 @@ func (am *DefaultAccountManager) AddPeer(setupKey, userID string, peer *Peer) (*
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
_, err = account.FindPeerByPubKey(peer.Key)
|
||||
if err == nil {
|
||||
return nil, nil, status.Errorf(status.PreconditionFailed, "peer has been already registered")
|
||||
}
|
||||
|
||||
opEvent := &activity.Event{
|
||||
Timestamp: time.Now().UTC(),
|
||||
AccountID: account.Id,
|
||||
|
Loading…
Reference in New Issue
Block a user