mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-18 20:47:58 +00:00
IdentityClaimProcessor rename support -> supportRim
This commit is contained in:
parent
b0712958b9
commit
7846b86010
@ -349,7 +349,7 @@ public class IdentityClaimProcessor extends AbstractProcessor {
|
|||||||
dv.getHw().getManufacturer(),
|
dv.getHw().getManufacturer(),
|
||||||
dv.getHw().getProductName());
|
dv.getHw().getProductName());
|
||||||
BaseReferenceManifest baseRim = null;
|
BaseReferenceManifest baseRim = null;
|
||||||
SupportReferenceManifest support = null;
|
SupportReferenceManifest supportRim = null;
|
||||||
EventLogMeasurements measurements;
|
EventLogMeasurements measurements;
|
||||||
boolean isReplacement = false;
|
boolean isReplacement = false;
|
||||||
String replacementRimId = "";
|
String replacementRimId = "";
|
||||||
@ -425,11 +425,11 @@ public class IdentityClaimProcessor extends AbstractProcessor {
|
|||||||
if (dv.getLogfileCount() > 0) {
|
if (dv.getLogfileCount() > 0) {
|
||||||
for (ByteString logFile : dv.getLogfileList()) {
|
for (ByteString logFile : dv.getLogfileList()) {
|
||||||
try {
|
try {
|
||||||
support =
|
supportRim =
|
||||||
(SupportReferenceManifest) referenceManifestRepository.findByHexDecHashAndRimType(
|
(SupportReferenceManifest) referenceManifestRepository.findByHexDecHashAndRimType(
|
||||||
Hex.encodeHexString(messageDigest.digest(logFile.toByteArray())),
|
Hex.encodeHexString(messageDigest.digest(logFile.toByteArray())),
|
||||||
ReferenceManifest.SUPPORT_RIM);
|
ReferenceManifest.SUPPORT_RIM);
|
||||||
if (support == null) {
|
if (supportRim == null) {
|
||||||
/*
|
/*
|
||||||
Either the logFile does not have a corresponding support RIM in the backend
|
Either the logFile does not have a corresponding support RIM in the backend
|
||||||
or it was deleted. The support RIM for a replacement base RIM is handled
|
or it was deleted. The support RIM for a replacement base RIM is handled
|
||||||
@ -439,28 +439,28 @@ public class IdentityClaimProcessor extends AbstractProcessor {
|
|||||||
Optional<ReferenceManifest> replacementRim =
|
Optional<ReferenceManifest> replacementRim =
|
||||||
referenceManifestRepository.findById(UUID.fromString(replacementRimId));
|
referenceManifestRepository.findById(UUID.fromString(replacementRimId));
|
||||||
if (replacementRim.isPresent()) {
|
if (replacementRim.isPresent()) {
|
||||||
support = (SupportReferenceManifest) replacementRim.get();
|
supportRim = (SupportReferenceManifest) replacementRim.get();
|
||||||
support.setDeviceName(dv.getNw().getHostname());
|
supportRim.setDeviceName(dv.getNw().getHostname());
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Unable to locate support RIM " + replacementRimId);
|
throw new Exception("Unable to locate support RIM " + replacementRimId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
support = new SupportReferenceManifest(
|
supportRim = new SupportReferenceManifest(
|
||||||
String.format("%s.rimel",
|
String.format("%s.rimel",
|
||||||
defaultClientName),
|
defaultClientName),
|
||||||
logFile.toByteArray());
|
logFile.toByteArray());
|
||||||
// this is a validity check
|
// this is a validity check
|
||||||
new TCGEventLog(support.getRimBytes());
|
new TCGEventLog(supportRim.getRimBytes());
|
||||||
// no issues, continue
|
// no issues, continue
|
||||||
support.setPlatformManufacturer(dv.getHw().getManufacturer());
|
supportRim.setPlatformManufacturer(dv.getHw().getManufacturer());
|
||||||
support.setPlatformModel(dv.getHw().getProductName());
|
supportRim.setPlatformModel(dv.getHw().getProductName());
|
||||||
support.setFileName(String.format("%s_[%s].rimel", defaultClientName,
|
supportRim.setFileName(String.format("%s_[%s].rimel", defaultClientName,
|
||||||
support.getHexDecHash().substring(
|
supportRim.getHexDecHash().substring(
|
||||||
support.getHexDecHash().length() - NUM_OF_VARIABLES)));
|
supportRim.getHexDecHash().length() - NUM_OF_VARIABLES)));
|
||||||
}
|
}
|
||||||
support.setDeviceName(dv.getNw().getHostname());
|
supportRim.setDeviceName(dv.getNw().getHostname());
|
||||||
this.referenceManifestRepository.save(support);
|
this.referenceManifestRepository.save(supportRim);
|
||||||
} else if (support.isArchived()) {
|
} else if (supportRim.isArchived()) {
|
||||||
/*
|
/*
|
||||||
This block accounts for RIMs that may have been soft-deleted (archived)
|
This block accounts for RIMs that may have been soft-deleted (archived)
|
||||||
in an older version of the ACA.
|
in an older version of the ACA.
|
||||||
@ -468,21 +468,21 @@ public class IdentityClaimProcessor extends AbstractProcessor {
|
|||||||
List<ReferenceManifest> rims = referenceManifestRepository.findByArchiveFlag(false);
|
List<ReferenceManifest> rims = referenceManifestRepository.findByArchiveFlag(false);
|
||||||
for (ReferenceManifest rim : rims) {
|
for (ReferenceManifest rim : rims) {
|
||||||
if (rim.isSupport() &&
|
if (rim.isSupport() &&
|
||||||
rim.getTagId().equals(support.getTagId()) &&
|
rim.getTagId().equals(supportRim.getTagId()) &&
|
||||||
rim.getCreateTime().after(support.getCreateTime())) {
|
rim.getCreateTime().after(supportRim.getCreateTime())) {
|
||||||
support.setDeviceName(null);
|
supportRim.setDeviceName(null);
|
||||||
support = (SupportReferenceManifest) rim;
|
supportRim = (SupportReferenceManifest) rim;
|
||||||
support.setDeviceName(dv.getNw().getHostname());
|
supportRim.setDeviceName(dv.getNw().getHostname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (support.isArchived()) {
|
if (supportRim.isArchived()) {
|
||||||
throw new Exception("Unable to locate an unarchived support RIM.");
|
throw new Exception("Unable to locate an unarchived support RIM.");
|
||||||
} else {
|
} else {
|
||||||
this.referenceManifestRepository.save(support);
|
this.referenceManifestRepository.save(supportRim);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
support.setDeviceName(dv.getNw().getHostname());
|
supportRim.setDeviceName(dv.getNw().getHostname());
|
||||||
this.referenceManifestRepository.save(support);
|
this.referenceManifestRepository.save(supportRim);
|
||||||
}
|
}
|
||||||
} catch (IOException ioEx) {
|
} catch (IOException ioEx) {
|
||||||
log.error(ioEx);
|
log.error(ioEx);
|
||||||
|
Loading…
Reference in New Issue
Block a user