diff options
-rw-r--r-- | cmd/atlas-import/main.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/atlas-import/main.go b/cmd/atlas-import/main.go index 143b500..24e2d81 100644 --- a/cmd/atlas-import/main.go +++ b/cmd/atlas-import/main.go @@ -4,6 +4,8 @@ package main import ( "bytes" "context" + "crypto/sha1" + "encoding/hex" "fmt" "net/netip" "os" @@ -163,7 +165,7 @@ func insertP(n *nsacct, p *pdatadb.DB) (bool, error) { var pd pdata.Pdata if err := pd.UnmarshalBinary(n.PersistentDataBaseline); err == nil { if len(pd.ExtraData) < 140 { - if !bytes.Equal(n.PersistentDataBaseline, pdata.DefaultPdata) { + if !bytes.Equal(n.PersistentDataBaseline, pdata.DefaultPdata) && isOldDefaultPdata(n.PersistentDataBaseline) { if sz, err := p.SetPdata(n.ID, n.PersistentDataBaseline); err != nil { return false, err } else if sz > 2200 { @@ -179,3 +181,8 @@ func insertP(n *nsacct, p *pdatadb.DB) (bool, error) { } return false, nil } + +func isOldDefaultPdata(b []byte) bool { + ss := sha1.Sum(b) + return hex.EncodeToString(ss[:]) == "9dab70c01c475bf976689d4af525aa39db6d73bc" +} |