Exemplo n.º 1
0
int main() {
  // read SMTPHELOHOST from environment
  const char* hostname = getenv("SMTPHELOHOST");

  // skip this test for RELAYCLIENT
  // skip this test for TRUSTCLIENT
  // skip this test if there is no badhelo file
  if ( (getenv("RELAYCLIENT")) || (getenv("TRUSTCLIENT")) || (access("/var/qmail/control/badhelo", R_OK) == -1 ) ) {
    printf("\n");
    exit(0);
  }

  // check for empty hostname
  if (hostname == NULL) {
    printf("E550 No hostname provided in HELO/EHLO\n");
    exit(0);
  }

  // search through badhelo file
  if (search_in_file("/var/qmail/control/badhelo",hostname)) {
    fprintf(stderr, "%d Found %s in badhelo list !\n", getpid(), hostname);
    sleep(5);
    printf("E550 Bad hostname [%s]\n", hostname);
    exit(0);
  }

  // default last action
  printf("\n");
  exit(0);
}
Exemplo n.º 2
0
void search_in_dir(const gchar* dirname, const gchar* search_text, SearchTools* self) {
	GDir* dir = g_dir_open(dirname, 0, 0);
	if( !dir )
		return;

	for(;;) {
		gchar* filename;
		const gchar* fname = g_dir_read_name(dir);
		if( !fname )
			break;

		if( fname[0]=='.' )
			continue;

		filename = g_build_filename(dirname, fname, NULL);
		if( g_file_test(filename, G_FILE_TEST_IS_DIR) ) {
			search_in_dir(filename, search_text, self);
		} else {
			search_in_file(filename, search_text, self);
		}
		g_free(filename);
	}
	g_dir_close(dir);
}
Exemplo n.º 3
0
void Http_config::init(string file)
{
	search_in_file(file, "working_directory", working_directory);
	search_in_file(file, "log_file", log_file);
	search_in_file(file, "worker_processes", worker_processes);
}
Exemplo n.º 4
0
int octopus_check_sternheimer_convergence(char *output_file){
  return search_in_file(output_file, "ALL STERNHEIMER LINEAR SYSTEMS CONVERGED");
}
Exemplo n.º 5
0
int octopus_check_convergence(char *output_file){
  return search_in_file(output_file, "SCF converged in");
}