예제 #1
0
파일: simple.c 프로젝트: ChrisX34/stuff
int main(void)
{
	int i;
	ENTER();

#ifdef DEBUG
	/*
	 * When debugging, this allows us to print function names
	 * in our frame stack printouts.
	 */
	register_symbol("spurious", spurious);
	register_symbol("add", add);
	register_symbol("caller", caller);
#endif

	for (i = 0; i < NUMTHREADS; i++)
		new_thread(caller, sizeof(struct caller_frame));
	while (step_thread(1000) == 0);
	printf("\nAll is well\n");
	LEAVE();
	return 0;
}
예제 #2
0
파일: asmsx.c 프로젝트: oboroc/misc
/* Register standard BIOS routines */
void msx_bios(void)
{
	bios = 1;

	/* BIOS routines */
	register_symbol("CHKRAM", 0x0000, 0);
	register_symbol("SYNCHR", 0x0008, 0);
	register_symbol("RDSLT", 0x000c, 0);
	register_symbol("CHRGTR", 0x0010, 0);
	register_symbol("WRSLT", 0x0014, 0);
	register_symbol("OUTDO", 0x0018, 0);
	register_symbol("CALSLT", 0x001c, 0);
	register_symbol("DCOMPR", 0x0020, 0);
	register_symbol("ENASLT", 0x0024, 0);
	register_symbol("GETYPR", 0x0028, 0);
	register_symbol("CALLF", 0x0030, 0);
	register_symbol("KEYINT", 0x0038, 0);
	register_symbol("INITIO", 0x003b, 0);
	register_symbol("INIFNK", 0x003e, 0);
	register_symbol("DISSCR", 0x0041, 0);
	register_symbol("ENASCR", 0x0044, 0);
	register_symbol("WRTVDP", 0x0047, 0);
	register_symbol("RDVRM", 0x004a, 0);
	register_symbol("WRTVRM", 0x004d, 0);
	register_symbol("SETRD", 0x0050, 0);
	register_symbol("SETWRT", 0x0053, 0);
	register_symbol("FILVRM", 0x0056, 0);
	register_symbol("LDIRMV", 0x0059, 0);
	register_symbol("LDIRVM", 0x005c, 0);
	register_symbol("CHGMOD", 0x005f, 0);
	register_symbol("CHGCLR", 0x0062, 0);
	register_symbol("NMI", 0x0066, 0);
	register_symbol("CLRSPR", 0x0069, 0);
	register_symbol("INITXT", 0x006c, 0);
	register_symbol("INIT32", 0x006f, 0);
	register_symbol("INIGRP", 0x0072, 0);
	register_symbol("INIMLT", 0x0075, 0);
	register_symbol("SETTXT", 0x0078, 0);
	register_symbol("SETT32", 0x007b, 0);
	register_symbol("SETGRP", 0x007e, 0);
	register_symbol("SETMLT", 0x0081, 0);
	register_symbol("CALPAT", 0x0084, 0);
	register_symbol("CALATR", 0x0087, 0);
	register_symbol("GSPSIZ", 0x008a, 0);
	register_symbol("GRPPRT", 0x008d, 0);
	register_symbol("GICINI", 0x0090, 0);
	register_symbol("WRTPSG", 0x0093, 0);
	register_symbol("RDPSG", 0x0096, 0);
	register_symbol("STRTMS", 0x0099, 0);
	register_symbol("CHSNS", 0x009c, 0);
	register_symbol("CHGET", 0x009f, 0);
	register_symbol("CHPUT", 0x00a2, 0);
	register_symbol("LPTOUT", 0x00a5, 0);
	register_symbol("LPTSTT", 0x00a8, 0);
	register_symbol("CNVCHR", 0x00ab, 0);
	register_symbol("PINLIN", 0x00ae, 0);
	register_symbol("INLIN", 0x00b1, 0);
	register_symbol("QINLIN", 0x00b4, 0);
	register_symbol("BREAKX", 0x00b7, 0);
	register_symbol("ISCNTC", 0x00ba, 0);
	register_symbol("CKCNTC", 0x00bd, 0);
	register_symbol("BEEP", 0x00c0, 0);
	register_symbol("CLS", 0x00c3, 0);
	register_symbol("POSIT", 0x00c6, 0);
	register_symbol("FNKSB", 0x00c9, 0);
	register_symbol("ERAFNK", 0x00cc, 0);
	register_symbol("DSPFNK", 0x00cf, 0);
	register_symbol("TOTEXT", 0x00d2, 0);
	register_symbol("GTSTCK", 0x00d5, 0);
	register_symbol("GTTRIG", 0x00d8, 0);
	register_symbol("GTPAD", 0x00db, 0);
	register_symbol("GTPDL", 0x00de, 0);
	register_symbol("TAPION", 0x00e1, 0);
	register_symbol("TAPIN", 0x00e4, 0);
	register_symbol("TAPIOF", 0x00e7, 0);
	register_symbol("TAPOON", 0x00ea, 0);
	register_symbol("TAPOUT", 0x00ed, 0);
	register_symbol("TAPOOF", 0x00f0, 0);
	register_symbol("STMOTR", 0x00f3, 0);
	register_symbol("LFTQ", 0x00f6, 0);
	register_symbol("PUTQ", 0x00f9, 0);
	register_symbol("RIGHTC", 0x00fc, 0);
	register_symbol("LEFTC", 0x00ff, 0);
	register_symbol("UPC", 0x0102, 0);
	register_symbol("TUPC", 0x0105, 0);
	register_symbol("DOWNC", 0x0108, 0);
	register_symbol("TDOWNC", 0x010b, 0);
	register_symbol("SCALXY", 0x010e, 0);
	register_symbol("MAPXYC", 0x0111, 0);
	register_symbol("FETCHC", 0x0114, 0);
	register_symbol("STOREC", 0x0117, 0);
	register_symbol("SETATR", 0x011a, 0);
	register_symbol("READC", 0x011d, 0);
	register_symbol("SETC", 0x0120, 0);
	register_symbol("NSETCX", 0x0123, 0);
	register_symbol("GTASPC", 0x0126, 0);
	register_symbol("PNTINI", 0x0129, 0);
	register_symbol("SCANR", 0x012c, 0);
	register_symbol("SCANL", 0x012f, 0);
	register_symbol("CHGCAP", 0x0132, 0);
	register_symbol("CHGSND", 0x0135, 0);
	register_symbol("RSLREG", 0x0138, 0);
	register_symbol("WSLREG", 0x013b, 0);
	register_symbol("RDVDP", 0x013e, 0);
	register_symbol("SNSMAT", 0x0141, 0);
	register_symbol("PHYDIO", 0x0144, 0);
	register_symbol("FORMAT", 0x0147, 0);
	register_symbol("ISFLIO", 0x014a, 0);
	register_symbol("OUTDLP", 0x014d, 0);
	register_symbol("GETVCP", 0x0150, 0);
	register_symbol("GETVC2", 0x0153, 0);
	register_symbol("KILBUF", 0x0156, 0);
	register_symbol("CALBAS", 0x0159, 0);
	register_symbol("SUBROM", 0x015c, 0);
	register_symbol("EXTROM", 0x015f, 0);
	register_symbol("CHKSLZ", 0x0162, 0);
	register_symbol("CHKNEW", 0x0165, 0);
	register_symbol("EOL", 0x0168, 0);
	register_symbol("BIGFIL", 0x016b, 0);
	register_symbol("NSETRD", 0x016e, 0);
	register_symbol("NSTWRT", 0x0171, 0);
	register_symbol("NRDVRM", 0x0174, 0);
	register_symbol("NWRVRM", 0x0177, 0);
	register_symbol("RDBTST", 0x017a, 0);
	register_symbol("WRBTST", 0x017d, 0);
	register_symbol("CHGCPU", 0x0180, 0);
	register_symbol("GETCPU", 0x0183, 0);
	register_symbol("PCMPLY", 0x0186, 0);
	register_symbol("PCMREC", 0x0189, 0);
}
예제 #3
0
파일: dkim_check.c 프로젝트: wiedi/rspamd
gint
dkim_module_config (struct rspamd_config *cfg)
{
	const ucl_object_t *value;
	gint res = TRUE;
	guint cache_size, cache_expire;
	gboolean got_trusted = FALSE;

	dkim_module_ctx->whitelist_ip = radix_create_compressed ();

	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim", "symbol_reject")) != NULL) {
		dkim_module_ctx->symbol_reject = ucl_obj_tostring (value);
	}
	else {
		dkim_module_ctx->symbol_reject = DEFAULT_SYMBOL_REJECT;
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim",
		"symbol_tempfail")) != NULL) {
		dkim_module_ctx->symbol_tempfail = ucl_obj_tostring (value);
	}
	else {
		dkim_module_ctx->symbol_tempfail = DEFAULT_SYMBOL_TEMPFAIL;
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim", "symbol_allow")) != NULL) {
		dkim_module_ctx->symbol_allow = ucl_obj_tostring (value);
	}
	else {
		dkim_module_ctx->symbol_allow = DEFAULT_SYMBOL_ALLOW;
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim",
		"dkim_cache_size")) != NULL) {
		cache_size = ucl_obj_toint (value);
	}
	else {
		cache_size = DEFAULT_CACHE_SIZE;
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim",
		"dkim_cache_expire")) != NULL) {
		cache_expire = ucl_obj_todouble (value);
	}
	else {
		cache_expire = DEFAULT_CACHE_MAXAGE;
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim", "time_jitter")) != NULL) {
		dkim_module_ctx->time_jitter = ucl_obj_todouble (value);
	}
	else {
		dkim_module_ctx->time_jitter = DEFAULT_TIME_JITTER;
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim", "whitelist")) != NULL) {
		if (!rspamd_map_add (cfg, ucl_obj_tostring (value),
			"DKIM whitelist", rspamd_radix_read, rspamd_radix_fin,
			(void **)&dkim_module_ctx->whitelist_ip)) {
			radix_add_generic_iplist (ucl_obj_tostring (value),
				&dkim_module_ctx->whitelist_ip);
		}
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim", "domains")) != NULL) {
		if (!rspamd_map_add (cfg, ucl_obj_tostring (value),
			"DKIM domains", rspamd_kv_list_read, rspamd_kv_list_fin,
			(void **)&dkim_module_ctx->dkim_domains)) {
			msg_warn ("cannot load dkim domains list from %s",
				ucl_obj_tostring (value));
		}
		else {
			got_trusted = TRUE;
		}
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim",
		"strict_multiplier")) != NULL) {
		dkim_module_ctx->strict_multiplier = ucl_obj_toint (value);
	}
	else {
		dkim_module_ctx->strict_multiplier = 1;
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim", "trusted_only")) != NULL) {
		dkim_module_ctx->trusted_only = ucl_obj_toboolean (value);
	}
	else {
		dkim_module_ctx->trusted_only = FALSE;
	}
	if ((value =
		rspamd_config_get_module_opt (cfg, "dkim", "skip_multi")) != NULL) {
		dkim_module_ctx->skip_multi = ucl_obj_toboolean (value);
	}
	else {
		dkim_module_ctx->skip_multi = FALSE;
	}

	if (dkim_module_ctx->trusted_only && !got_trusted) {
		msg_err (
			"trusted_only option is set and no trusted domains are defined; disabling dkim module completely as it is useless in this case");
	}
	else {
		register_symbol (&cfg->cache,
			dkim_module_ctx->symbol_reject,
			1,
			dkim_symbol_callback,
			NULL);
		register_virtual_symbol (&cfg->cache,
			dkim_module_ctx->symbol_tempfail,
			1);
		register_virtual_symbol (&cfg->cache,
			dkim_module_ctx->symbol_allow,
			1);

		dkim_module_ctx->dkim_hash = rspamd_lru_hash_new (
				cache_size,
				cache_expire,
				g_free,
				(GDestroyNotify)rspamd_dkim_key_free);


#ifndef HAVE_OPENSSL
		msg_warn (
			"openssl is not found so dkim rsa check is disabled, only check body hash, it is NOT safe to trust these results");
#endif
	}

	return res;
}