예제 #1
0
/* Restarts the scanner by reloading the configuration. */
static void
reload_openvassd ()
{
  struct arglist *preferences = NULL, *plugins;
  nvticache_t *nvti_cache;
  char *config_file;
  pid_t handler_pid;

  log_write ("Reloading the scanner.\n");
  /* Ignore SIGHUP while reloading. */
  openvas_signal (SIGHUP, SIG_IGN);

  handler_pid = loading_handler_start ();
  /* Free the nvti cache. */
  nvti_cache = arg_get_value (global_preferences, "nvticache");
  nvticache_free (nvti_cache);
  /* Reload config file. */
  config_file = arg_get_value (global_preferences, "config_file");
  preferences_init (config_file, &preferences);

  /* Reload the plugins */
  plugins = plugins_init (preferences);
  set_globals_from_preferences (preferences);
  plugins_free (global_plugins);
  global_plugins = plugins;
  loading_handler_stop (handler_pid);

  log_write ("Finished reloading the scanner.\n");
  reload = 0;
  openvas_signal (SIGHUP, sighup);
}
예제 #2
0
파일: main.c 프로젝트: Wordclock/firmware
/**
 * @brief Entry point to start execution at
 *
 * This is the main entry point where execution will start. It initializes the
 * hardware and enters an infinite loop handling any upcoming events not yet
 * covered.
 *
 * @note This function makes use of the attribute "OS_main". For details
 * refer to [1].
 *
 * [1]: http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
 *
 * @return Should never return anything
 */
__attribute__((OS_main)) int main()
{

    uart_init();

    log_main("Init...\n");

    preferences_init();

    #if (ENABLE_DCF_SUPPORT == 1)

        dcf77_init();

    #endif

    display_init();
    datetime_init();
    ldr_init();
    pwm_init();
    irmp_init();
    timer_init();
    user_init();

    sei();

    pwm_on();

    log_main("Init finished\n");

    while (1) {

        brightness_handle();
        datetime_handle();
        handle_ir_code();

        #if (ENABLE_UART_PROTOCOL == 1)

            uart_protocol_handle();

        #endif /* (ENABLE_UART_PROTOCOL == 1) */

        #if (ENABLE_DCF_SUPPORT == 1)

            datetime_t dt;

            // TODO: Make sure dcf77_getDateTime() validates its result
            if (dcf77_get_datetime(&dt)) {

                datetime_set(&dt);

            }

        #endif

    }

}
예제 #3
0
/**
 * @brief Initialize everything.
 *
 * @param stop_early 0: do some initialization, 1: no initialization.
 */
static int
init_openvassd (struct arglist *options, int first_pass, int stop_early,
                int dont_fork)
{
  int isck = -1;
  struct arglist *preferences = NULL;
  int scanner_port = GPOINTER_TO_SIZE (arg_get_value (options, "scanner_port"));
  char *config_file = arg_get_value (options, "config_file");
  struct addrinfo *addr = arg_get_value (options, "addr");

  preferences_init (config_file, &preferences);

  log_init (arg_get_value (preferences, "logfile"));
  if (dont_fork == FALSE)
    setup_legacy_log_handler (log_vwrite);

  if (!stop_early)
    {
      if (first_pass != 0)
        init_network (scanner_port, &isck, *addr);
    }

  if (first_pass && !stop_early)
    {
      openvas_signal (SIGSEGV, sighandler);
      openvas_signal (SIGCHLD, sighand_chld);
      openvas_signal (SIGTERM, sighandler);
      openvas_signal (SIGINT, sighandler);
      openvas_signal (SIGHUP, sighup);
      openvas_signal (SIGUSR1, sighandler);     /* openvassd dies, not its sons */
      openvas_signal (SIGPIPE, SIG_IGN);
    }

  arg_replace_value (options, "isck", ARG_INT, sizeof (gpointer),
                     GSIZE_TO_POINTER (isck));
  arg_replace_value (options, "preferences", ARG_ARGLIST, -1, preferences);
  set_globals_from_preferences (preferences);

  return 0;
}
예제 #4
0
void warlock_init (void)
{
#ifdef DEBUG
        g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
#endif
        preferences_init ();
        highlight_init ();
        preferences_dialog_init ();
        profile_dialog_init ();
        text_strings_dialog_init ();
        hand_init (warlock_get_widget ("left_hand_label"),
                        warlock_get_widget ("right_hand_label"));
        status_init (warlock_get_widget ("status_table"));
        compass_init (warlock_get_widget ("compass_table"));
        warlock_entry_init (warlock_get_widget ("warlock_entry"));
        macro_init ();
        macro_dialog_init ();
        warlock_time_init ();
        warlock_views_init ();
	warlock_log_init ();
        script_init ();
}
예제 #5
0
파일: main.c 프로젝트: jcape/gnoMint
int main (int   argc,
	  char *argv[])
{
        gchar *defaultfile = NULL;
	GOptionContext *ctx;
	GError *err = NULL;
	GOptionEntry entries[] = {
		{ NULL }
	};
	
	GtkWidget * recent_menu = NULL;
        gchar     * size_str = NULL;

#ifdef ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#endif

	g_set_application_name (PACKAGE);
	g_set_prgname (PACKAGE);

	tls_init ();

	g_thread_init (NULL);
	gtk_init (&argc, &argv);
	
	preferences_gui_set_csr_visible_callback (ca_update_csr_view);
	preferences_gui_set_revoked_visible_callback (ca_update_revoked_view);

        preferences_init (argc, argv);

	ctx = g_option_context_new (_("- A graphical Certification Authority manager"));
	g_option_context_add_main_entries (ctx, entries, GETTEXT_PACKAGE);
	if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
		g_print (_("Failed to initialize: %s\n"), err->message);
		g_error_free (err);
		return 1;
	}
	
	main_window_gtkb = gtk_builder_new();
	gtk_builder_add_from_file (main_window_gtkb, 
				   g_build_filename (PACKAGE_DATA_DIR, "gnomint", "main_window.ui", NULL),
				   NULL);

	csr_popup_menu_gtkb = gtk_builder_new();
	gtk_builder_add_from_file (csr_popup_menu_gtkb, 
				   g_build_filename (PACKAGE_DATA_DIR, "gnomint", "csr_popup_menu.ui", NULL),
				   NULL);

	cert_popup_menu_gtkb = gtk_builder_new();
	gtk_builder_add_from_file (cert_popup_menu_gtkb, 
				   g_build_filename (PACKAGE_DATA_DIR, "gnomint", "certificate_popup_menu.ui", NULL),
				   NULL);


        size_str = preferences_get_size ();
        if (size_str) {
                gchar ** result = NULL;
                guint width, height;

                result = g_strsplit_set (size_str, "(,)", -1);
                
                if (result[0] && result[1]) {
                        width = atoi (result[1]);
                        if (result[2]) {
                                height = atoi (result[2]);
                                gtk_window_resize (GTK_WINDOW(gtk_builder_get_object(main_window_gtkb, "main_window1")), width, height);
                        }

                }

                g_free (size_str);
                g_strfreev (result);
        }
        ca_update_revoked_view (preferences_get_revoked_visible(), FALSE);
        ca_update_csr_view (preferences_get_crq_visible(), FALSE);
        

	gtk_builder_connect_signals (main_window_gtkb, NULL);	       	
	gtk_builder_connect_signals (cert_popup_menu_gtkb, NULL);	       	
	gtk_builder_connect_signals (csr_popup_menu_gtkb, NULL);	       	

	recent_manager = gtk_recent_manager_get_default ();
	recent_menu = __recent_create_menu();
	g_signal_connect (G_OBJECT (recent_menu), "item-activated",
			  G_CALLBACK (on_open_recent_activate), NULL);
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (gtk_builder_get_object (main_window_gtkb, "openrecentsmenuitem")), recent_menu);


	__disable_widget ("new_certificate1");
	__disable_widget ("save_as1");
	__disable_widget ("properties1");
	__disable_widget ("preferences1");

	dialog_establish_refresh_function (ca_refresh_model_callback);
	

	if (argc >= 2 && ca_open (g_strdup(argv[1]), TRUE)) {
                /* The file has opened OK */
		__recent_add_utf8_filename (argv[1]);
        } else {
                /* No arguments, or failure when opening file */
                defaultfile = g_build_filename (g_get_home_dir(), ".gnomint", "default.gnomint", NULL);
		__recent_add_utf8_filename (defaultfile);
                ca_open (defaultfile, TRUE);
        }

	gtk_main ();

	return 0;
}