Esempio n. 1
0
void gui_init ()
{
	char line[1024], w1[1024], w2[1024];
	int flush_on = 0;
	int flush_time = 100;
	int imalive_on = 0;
	int imalive_time = 30;
	char **argv;
	int *argc;
	FILE *fp;
	int i;

	IMPORT_SYMBOL(argc, 2);
	IMPORT_SYMBOL(argv, 3);
	IMPORT_SYMBOL(gettick, 5);
	IMPORT_SYMBOL(add_timer_interval, 8);
	IMPORT_SYMBOL(add_timer_func_list, 9);

	do {
		fp = fopen("plugins/gui.conf","r");
		if (fp == NULL)
			break;

		while(fgets(line, sizeof(line), fp))
		{
			if (line[0] == '/' && line[1] == '/')
				continue;
			if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2) {
				if(strcmpi(w1,"imalive_on")==0){
					imalive_on = atoi(w2);
				} else if(strcmpi(w1,"imalive_time")==0){
					imalive_time = atoi(w2);
				} else if(strcmpi(w1,"flush_on")==0){
					flush_on = atoi(w2);
				} else if(strcmpi(w1,"flush_time")==0){
					flush_time = atoi(w2);
				}
			}
		}
		fclose(fp);
	} while (0);

	for (i = 1; i < *argc ; i++)
		if (strcmp(argv[i], "--gui") == 0)
			flush_on = imalive_on = 1;

	if (flush_on) {
		add_timer_func_list(flush_timer, "flush_timer");
		add_timer_interval(gettick()+1000,flush_timer,0,0,flush_time);
	}
	if (imalive_on) {
		add_timer_func_list(imalive_timer, "imalive_timer");
		add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000);
	}
}
Esempio n. 2
0
/*=========================================
 *	Register the signal handlers
 *-----------------------------------------
 */
int sig_init ()
{
	void (*func)(int) = sig_dump;
#ifdef CYGWIN	// test if dumper is enabled
	char *buf = getenv ("CYGWIN");
	if (buf && strstr(buf, "error_start") != NULL)
		func = SIG_DFL;
#endif

	IMPORT_SYMBOL(server_name, 1);
	IMPORT_SYMBOL(getrevision, 6);
	IMPORT_SYMBOL(getuptime, 11);

	compat_signal(SIGSEGV, func);
	compat_signal(SIGFPE, func);
	compat_signal(SIGILL, func);
	compat_signal(SIGBUS, func);

	return 1;
}
Esempio n. 3
0
static typeof(&pam_authenticate) dlpam_authenticate;
static typeof(&pam_setcred) dlpam_setcred;
static typeof(&pam_acct_mgmt) dlpam_acct_mgmt;
static typeof(&pam_strerror) dlpam_strerror;
#if 0  /* These three functions are not used yet */
static typeof(&pam_open_session) dlpam_open_session;
static typeof(&pam_close_session) dlpam_close_session;
static typeof(&pam_chauthtok) dlpam_chauthtok;
#endif

static struct {
   void       **procaddr;
   const char  *procname;
} authPAMImported[] = {
#define IMPORT_SYMBOL(x) { (void **)&dl##x, #x }
   IMPORT_SYMBOL(pam_start),
   IMPORT_SYMBOL(pam_end),
   IMPORT_SYMBOL(pam_authenticate),
   IMPORT_SYMBOL(pam_setcred),
   IMPORT_SYMBOL(pam_acct_mgmt),
   IMPORT_SYMBOL(pam_strerror),
#undef IMPORT_SYMBOL
};

static void *authPamLibraryHandle = NULL;


/*
 *----------------------------------------------------------------------
 *
 * AuthLoadPAM --