Example #1
0
float Fontinfo::StringAdvance(const char* string)
{
    // This relates to display, so we take ligatures into account.
    doSize();
    wchar unicode, next;
    int cb, nextcb;
    float orig_x   = pos_x;
    int   orig_mod = font_size_mod, orig_style = style, orig_y = pos_y;
    unicode = file_encoding->DecodeWithLigatures(string, *this, cb);
    while (*string) {
        next = file_encoding->DecodeWithLigatures(string + cb, *this, nextcb);
        if (!processCode(string)) {
            if (is_bidirect)
                pos_x -= GlyphAdvance(unicode, next);
            else
                pos_x += GlyphAdvance(unicode, next);
        }
        string += cb;
        unicode = next;
	cb = nextcb;
    }
    float rv = pos_x - orig_x;
    font_size_mod = orig_mod;
    style = orig_style;
    pos_x = orig_x;
    pos_y = orig_y;
    return rv;
}
Example #2
0
ClientIdentification::GuestState *ClientIdentification::current() const
{
	// if we have no client identification, we can't find a current guest either
	if (!processCode())
		return NULL;

	SecGuestRef guestRef = Server::connection().guestRef();
	
	// try to deliver an already-cached entry
	{
		StLock<Mutex> _(mLock);
		GuestMap::iterator it = mGuests.find(guestRef);
		if (it != mGuests.end())
			return &it->second;
	}

	// okay, make a new one (this may take a while)
	CFRef<CFDictionaryRef> attributes = (guestRef == kSecNoGuest)
		? NULL
		: makeCFDictionary(1, kSecGuestAttributeCanonical, CFTempNumber(guestRef).get());
	Server::active().longTermActivity();
	CFRef<SecCodeRef> code;
	switch (OSStatus rc = SecCodeCopyGuestWithAttributes(processCode(),
		attributes, kSecCSDefaultFlags, &code.aref())) {
	case noErr:
		break;
	case errSecCSUnsigned:			// not signed; clearly not a host
	case errSecCSNotAHost:			// signed but not marked as a (potential) host
		code = mClientProcess;
		break;
	case errSecCSNoSuchCode:		// potential host, but...
		if (guestRef == kSecNoGuest) {	//  ... no guests (yet), so return the process
			code = mClientProcess;
			break;
		}
		// else fall through		//  ... the guest we expected to be there isn't
	default:
		MacOSError::throwMe(rc);
	}
	StLock<Mutex> _(mLock);
	GuestState &slot = mGuests[guestRef];
	if (!slot.code)	// if another thread didn't get here first...
		slot.code = code;
	return &slot;
}
Example #3
0
//
// Screen a process setup request for an existing process.
// This means the client has requested intialization even though we remember having
// talked to it in the past. This could either be an exec(2), or the client could just
// have forgotten all about its securityd client state. Or it could be an attack...
//
void Process::reset(TaskPort taskPort, const ClientSetupInfo *info, const CommonCriteria::AuditToken &audit)
{
	StLock<Mutex> _(*this);
	if (taskPort != mTaskPort) {
		secnotice("SS", "Process %p(%d) reset mismatch (tp %d-%d)",
			this, pid(), taskPort.port(), mTaskPort.port());
		//@@@ CssmError::throwMe(CSSM_ERRCODE_VERIFICATION_FAILURE);		// liar
	}
	setup(info);
	CFCopyRef<SecCodeRef> oldCode = processCode();

	ClientIdentification::setup(this->pid());	// re-constructs processCode()
	if (CFEqual(oldCode, processCode())) {
        secnotice("SS", "%p Client reset amnesia", this);
	} else {
        secnotice("SS", "%p Client reset full", this);
		CodeSigningHost::reset();
	}
}
Example #4
0
//This will return whether we should continue our work
bool Command::parseCommand(int argc, char *argv[]){
    fprintf(stderr, "\n");
    fprintf(stderr, "Program: shrek (Tool for SNP heritability estimation)\n");
    fprintf(stderr, "Version: %f\n\n", m_version);
    if(argc <= 1) usage();
    else{
        return processCode(argc, argv);
    }
    return false;
}
Example #5
0
File: exec.c Project: phyrrus9/lang
bool exec(struct AST_block *ptr) {
	ip = ptr->head;
	return processCode();
}