1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Search for index.txt and changes.csv in csaf folder, too.

This commit is contained in:
Sascha L. Teichmann 2021-12-16 03:17:37 +01:00
parent deaf8a5722
commit 68cab9ec58

View file

@ -471,8 +471,11 @@ func (p *processor) checkIndex(base string, mask whereType) error {
return errContinue return errContinue
} }
if res.StatusCode != http.StatusOK { if res.StatusCode != http.StatusOK {
p.badIndex("Fetching %s failed. Status code %d (%s)", // It's optional
index, res.StatusCode, res.Status) if res.StatusCode != http.StatusNotFound {
p.badIndex("Fetching %s failed. Status code %d (%s)",
index, res.StatusCode, res.Status)
}
return errContinue return errContinue
} }
@ -503,8 +506,11 @@ func (p *processor) checkChanges(base string, mask whereType) error {
return errContinue return errContinue
} }
if res.StatusCode != http.StatusOK { if res.StatusCode != http.StatusOK {
p.badChange("Fetching %s failed. Status code %d (%s)", if res.StatusCode != http.StatusNotFound {
changes, res.StatusCode, res.Status) // It's optional
p.badChange("Fetching %s failed. Status code %d (%s)",
changes, res.StatusCode, res.Status)
}
return errContinue return errContinue
} }
@ -587,20 +593,23 @@ func (p *processor) checkCSAFs(domain string) error {
var feeds [][]csaf.Feed var feeds [][]csaf.Feed
if err := util.ReMarshalJSON(&feeds, rolie); err != nil { if err := util.ReMarshalJSON(&feeds, rolie); err != nil {
p.badProviderMetadata("ROLIE feeds are not compatible: %v.", err) p.badProviderMetadata("ROLIE feeds are not compatible: %v.", err)
goto noRolie } else if err := p.processFeeds(domain, feeds); err != nil {
} if err != errContinue {
if err := p.processFeeds(domain, feeds); err != nil { return err
if err == errContinue {
goto noRolie
} }
return err
} }
} }
noRolie:
// No rolie feeds // No rolie feeds
// TODO: Implement me! base := "https://" + domain + "/.well-known/csaf"
if err := p.checkIndex(base, indexMask); err != nil && err != errContinue {
return err
}
if err := p.checkChanges(base, changesMask); err != nil && err != errContinue {
return err
}
return nil return nil
} }