mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-17 22:31:23 +08:00
prevent nodes from changing address out of range or to .0 or .255 addresses
This commit is contained in:
@@ -82,7 +82,6 @@ func grpcAuthorize(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return status.Errorf(codes.Unauthenticated, "Unauthorized. Network does not exist: "+network)
|
||||
}
|
||||
emptynode := models.Node{}
|
||||
node, err := logic.GetNodeByIDorMacAddress(nodeID, mac, network)
|
||||
if database.IsEmptyRecord(err) {
|
||||
// == DELETE replace logic after 2 major version updates ==
|
||||
@@ -94,7 +93,7 @@ func grpcAuthorize(ctx context.Context) error {
|
||||
}
|
||||
return status.Errorf(codes.Unauthenticated, "Empty record")
|
||||
}
|
||||
if err != nil || node.MacAddress == emptynode.MacAddress {
|
||||
if err != nil || node.ID == "" {
|
||||
return status.Errorf(codes.Unauthenticated, "Node does not exist.")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user