//
#include "requirement.h"
#include "reqinterp.h"
+#include "codesigning_dtrace.h"
#include <security_utilities/errors.h>
#include <security_utilities/unix++.h>
#include <security_utilities/logging.h>
//
void Requirement::validate(const Requirement::Context &ctx, OSStatus failure /* = errSecCSReqFailed */) const
{
+ CODESIGN_EVAL_REQINT_START((void*)this, this->length());
switch (kind()) {
case exprForm:
- if (!Requirement::Interpreter(this, &ctx).evaluate())
+ if (Requirement::Interpreter(this, &ctx).evaluate()) {
+ CODESIGN_EVAL_REQINT_END(0);
+ return;
+ } else {
+ CODESIGN_EVAL_REQINT_END(failure);
MacOSError::throwMe(failure);
- return;
+ }
default:
- secdebug("reqval", "unrecognized requirement kind %d", kind());
+ CODESIGN_EVAL_REQINT_END(errSecCSReqUnsupported);
MacOSError::throwMe(errSecCSReqUnsupported);
}
}
#endif //TEST_APPLE_ANCHOR
+//
+// InternalRequirements
+//
+void InternalRequirements::operator () (const Requirements *given, const Requirements *defaulted)
+{
+ if (defaulted) {
+ this->add(defaulted);
+ ::free((void *)defaulted); // was malloc(3)ed by DiskRep
+ }
+ if (given)
+ this->add(given);
+ mReqs = make();
+}
+
//
// Debug dump support