Ejemplo n.º 1
0
static gboolean
gui_exit_callback (Gimp     *gimp,
                   gboolean  force)
{
  GimpGuiConfig  *gui_config = GIMP_GUI_CONFIG (gimp->config);

  if (gimp->be_verbose)
    g_print ("EXIT: %s\n", G_STRFUNC);

  if (! force && gimp_displays_dirty (gimp))
    {
      GdkScreen *screen;
      gint       monitor;

      monitor = gimp_get_monitor_at_pointer (&screen);

      gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
                                        screen, monitor,
                                        "gimp-quit-dialog", -1);

      return TRUE; /* stop exit for now */
    }

  gimp->message_handler = GIMP_CONSOLE;

  gui_unique_exit ();

  if (gui_config->save_session_info)
    session_save (gimp, FALSE);

  color_history_save (gimp);

  if (gui_config->save_accels)
    menus_save (gimp, FALSE);

  if (gui_config->save_device_status)
    gimp_devices_save (gimp, FALSE);

  if (TRUE /* gui_config->save_controllers */)
    gimp_controllers_save (gimp);

  g_signal_handlers_disconnect_by_func (gimp_get_user_context (gimp),
                                        gui_display_changed,
                                        gimp);

  gimp_displays_delete (gimp);

  gimp_tools_save (gimp, gui_config->save_tool_options, FALSE);
  gimp_tools_exit (gimp);

  gimp_language_store_parser_clean ();

  return FALSE; /* continue exiting */
}
Ejemplo n.º 2
0
unsigned long long lastpass_get_blob_version(struct session *session, unsigned const char key[KDF_HASH_LEN])
{
	_cleanup_free_ char *reply = NULL;
	unsigned long long version;

	reply = http_post_lastpass("login_check.php", session->sessionid, NULL, NULL);
	if (!reply)
		return 0;
	version = xml_login_check(reply, session);
	if (version)
		session_save(session, key);
	return version;
}
Ejemplo n.º 3
0
Archivo: conf.c Proyecto: erikg/bmud
void
apply_cb (GtkWidget * crap, gpointer * nothing)
{
    int x;

    if (this_panel_cb)
	this_panel_cb ();

    /*
     * pack the new font 
     */
    if (fntname != NULL)
    {

/*		if(mud->disp_font_name)
			g_free(mud->disp_font_name);
*/
	mud->disp_font_name = g_strdup (fntname);
    }

/*	g_free(mud->disp_font);	*/
    mud->disp_font = gdk_font_load (mud->disp_font_name);

    /*
     * pack the colors 
     */
    for (x = 0; x < 9; ++x)
    {				/* unrolled. 2 isn't 'nuff for a loop. */
	memcpy (&color[x][0], &ccol[x][0], sizeof (GdkColor));
	memcpy (&color[x][1], &ccol[x][1], sizeof (GdkColor));
    }

    color_save ();
    session_save ();

    return;
}
Ejemplo n.º 4
0
int cmd_login(int argc, char **argv)
{
    static struct option long_options[] = {
        {"trust", no_argument, NULL, 't'},
        {"plaintext-key", no_argument, NULL, 'P'},
        {"force", no_argument, NULL, 'f'},
        {"color", required_argument, NULL, 'C'},
        {0, 0, 0, 0}
    };
    int option;
    int option_index;
    bool trust = false;
    bool plaintext_key = false;
    bool force = false;
    char *username;
    _cleanup_free_ char *error = NULL;
    _cleanup_free_ char *password = NULL;
    int iterations;
    struct session *session;
    unsigned char key[KDF_HASH_LEN];
    char hex[KDF_HEX_LEN];

    while ((option = getopt_long(argc, argv, "f", long_options, &option_index)) != -1) {
        switch (option) {
        case 't':
            trust = true;
            break;
        case 'P':
            plaintext_key = true;
            break;
        case 'f':
            force = true;
            break;
        case 'C':
            terminal_set_color_mode(
                parse_color_mode_string(optarg));
            break;
        case '?':
        default:
            die_usage(cmd_login_usage);
        }
    }
    if (argc - optind != 1)
        die_usage(cmd_login_usage);

    if (!force && plaintext_key && !ask_yes_no(false, "You have used the --plaintext-key option. This option will greatly reduce the security of your passwords. You are advised, instead, to use the agent, whose timeout can be disabled by settting LPASS_AGENT_TIMEOUT=0. Are you sure you would like to do this?"))
        die("Login aborted. Try again without --plaintext-key.");

    username = argv[optind];
    iterations = lastpass_iterations(username);
    if (!iterations)
        die("Unable to fetch iteration count. Check your internet connection and be sure your username is valid.");

    do {
        free(password);
        password = password_prompt("Master Password", error, "Please enter the LastPass master password for <%s>.", username);
        if (!password)
            die("Failed to enter correct password.");

        kdf_login_key(username, password, iterations, hex);
        kdf_decryption_key(username, password, iterations, key);

        free(error);
        error = NULL;
        session = lastpass_login(username, hex, key, iterations, &error, trust);
    } while (!session_is_valid(session));

    config_unlink("plaintext_key");
    if (plaintext_key)
        config_write_buffer("plaintext_key", (char *)key, KDF_HASH_LEN);

    agent_save(username, iterations, key);

    session_save(session, key);
    session_free(session);
    session = NULL;

    terminal_printf(TERMINAL_FG_GREEN TERMINAL_BOLD "Success" TERMINAL_RESET ": Logged in as " TERMINAL_UNDERLINE "%s" TERMINAL_RESET ".\n", username);

    return 0;
}
Ejemplo n.º 5
0
int QPhotorec::photorec(alloc_data_t *list_search_space)
{
  pstatus_t ind_stop=PSTATUS_OK;
  const unsigned int blocksize_is_known=params->blocksize;
  params_reset(params, options);
  /* make the first recup_dir */
  params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num);
  for(params->pass=0; params->status!=STATUS_QUIT; params->pass++)
  {
    timer->start();
    switch(params->status)
    {
      case STATUS_UNFORMAT:
	/* FIXME */
	break;
      case STATUS_FIND_OFFSET:
	{
	  uint64_t start_offset=0;
	  if(blocksize_is_known>0)
	  {
	    ind_stop=PSTATUS_OK;
	    if(!td_list_empty(&list_search_space->list))
	      start_offset=(td_list_entry(list_search_space->list.next, alloc_data_t, list))->start % params->blocksize;
	  }
	  else
	  {
	    ind_stop=photorec_find_blocksize(list_search_space);
	    params->blocksize=find_blocksize(list_search_space, params->disk->sector_size, &start_offset);
	  }
	  update_blocksize(params->blocksize, list_search_space, start_offset);
	}
	break;  
      case STATUS_EXT2_ON_BF:
      case STATUS_EXT2_OFF_BF:
	/* FIXME */
	break;
      default:
	ind_stop=photorec_aux(list_search_space);
	break;
    }
    timer->stop();
    qphotorec_search_updateUI();
    session_save(list_search_space, params, options);
    switch(ind_stop)
    {
      case PSTATUS_EACCES:
	{
	  int ret=QMessageBox::warning(this,
	      tr("QPhotoRec: Failed to create file!"),
	      tr("Failed to create file! Please choose another destination"),
	      QMessageBox::Ok| QMessageBox::Cancel, QMessageBox::Ok);
	  if(ret==QMessageBox::Cancel)
	  {
	    params->status=STATUS_QUIT;
	  }
	  else
	  {
	    setExistingDirectory();
	    free(params->recup_dir);
	    QByteArray byteArray = (directoryLabel->text() + "/" + DEFAULT_RECUP_DIR).toUtf8();
	    params->recup_dir=strdup(byteArray.constData());
	    params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num);
	  }
	}
	break;
      case PSTATUS_ENOSPC:
	{
	  int ret=QMessageBox::warning(this,
	      tr("QPhotoRec: Not enough space!"),
	      tr("There is not enough space left! Please free disk space and/or choose another destination"),
	      QMessageBox::Ok| QMessageBox::Cancel, QMessageBox::Ok);
	  if(ret==QMessageBox::Cancel)
	  {
	    params->status=STATUS_QUIT;
	  }
	  else
	  {
	    setExistingDirectory();
	    free(params->recup_dir);
	    QByteArray byteArray = (directoryLabel->text() + "/" + DEFAULT_RECUP_DIR).toUtf8();
	    params->recup_dir=strdup(byteArray.constData());
	    params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num);
	  }
	}
break;
      case PSTATUS_OK:
	status_inc(params, options);
	if(params->status==STATUS_QUIT)
	  unlink("photorec.ses");
	break;
      case PSTATUS_STOP:
	params->status=STATUS_QUIT;
	break;
    }
    update_stats(params->file_stats, list_search_space);
    qphotorec_search_updateUI();
  }
  free_search_space(list_search_space);
  free_header_check();
  free(params->file_stats);
  params->file_stats=NULL;
  return 0;
}
Ejemplo n.º 6
0
int      session_close( Session* s ){
    struct timeval tv;
    gettimeofday( &tv, NULL );
    s->closed_at = tv.tv_sec;
    return session_save( s );
}