forked from TrueCloudLab/frostfs-node
[#1461] node: Do not accept lock object w/o expiration
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
de31bb27b6
commit
25826bd96d
1 changed files with 11 additions and 1 deletions
|
@ -260,9 +260,19 @@ func (v *FormatValidator) ValidateContent(o *object.Object) error {
|
|||
return errors.New("missing ID")
|
||||
}
|
||||
|
||||
// check that LOCK object has correct expiration epoch
|
||||
lockExp, err := expirationEpochAttribute(o)
|
||||
if err != nil {
|
||||
return fmt.Errorf("lock object expiration epoch: %w", err)
|
||||
}
|
||||
|
||||
if currEpoch := v.netState.CurrentEpoch(); lockExp <= currEpoch {
|
||||
return fmt.Errorf("lock object expiration: %d; current: %d", lockExp, currEpoch)
|
||||
}
|
||||
|
||||
var lock object.Lock
|
||||
|
||||
err := lock.Unmarshal(o.Payload())
|
||||
err = lock.Unmarshal(o.Payload())
|
||||
if err != nil {
|
||||
return fmt.Errorf("decode lock payload: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue