+}
+
+
+//
+// Screen a process setup request for an existing process.
+// This usually means the client has called exec(2) and forgotten all about itself.
+// Though it could be a nefarious attempt to fool us...
+//
+void Process::reset(Port servicePort, TaskPort taskPort,
+ const ClientSetupInfo *info, const char *identity, const CommonCriteria::AuditToken &audit)
+{
+ if (servicePort != session().servicePort() || taskPort != mTaskPort) {
+ secdebug("SS", "Process %p(%d) reset mismatch (sp %d-%d, tp %d-%d) for %s",
+ this, pid(), servicePort.port(), session().servicePort().port(), taskPort.port(), mTaskPort.port(),
+ (identity && identity[0]) ? identity : "(unknown)");
+ CssmError::throwMe(CSSMERR_CSSM_ADDIN_AUTHENTICATE_FAILED); // liar
+ }
+
+ setup(info, identity);
+
+ secdebug("SS", "process %p(%d) has reset; now %sfor %s",
+ this, mPid, mByteFlipped ? "FLIP " : "",
+ (identity && identity[0]) ? identity : "(unknown)");
+}
+
+
+//
+// Common set processing
+//
+void Process::setup(const ClientSetupInfo *info, const char *identity)
+{
+ // process setup info
+ assert(info);
+ uint32 pversion;
+ if (info->order == 0x1234) { // right side up
+ pversion = info->version;
+ } else if (info->order == 0x34120000) { // flip side up
+ pversion = ntohl(info->version);
+ mByteFlipped = true;
+ } else // non comprende
+ CssmError::throwMe(CSSM_ERRCODE_INCOMPATIBLE_VERSION);
+
+ // check wire protocol version
+ if (pversion != SSPROTOVERSION)
+ CssmError::throwMe(CSSM_ERRCODE_INCOMPATIBLE_VERSION);