+++ /dev/null
-/*
- Copyright (C) 2009-2012 Alexander Butenko <a.butenka@gmail.com>
- Copyright (C) 2009-2012 Christian Dywan <christian@twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-*/
-#include <string.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-#include <glib.h>
-#define BUF_SIZE 256
-
-typedef unsigned char uc;
-
-const char *iv ="12345678";
-
-gchar*
-formhistory_encrypt (const gchar* input,
- const gchar* key)
-{
- int outlen=0, auxlen=0;
- EVP_CIPHER_CTX ctx;
- size_t inputSize;
- char buff[BUF_SIZE];
-
- if (!input)
- return NULL;
-
- inputSize = strlen (input);
- memset (&buff[0], '\0', BUF_SIZE);
-
- EVP_CIPHER_CTX_init (&ctx);
- EVP_EncryptInit (&ctx, EVP_bf_cbc (), (unsigned char*)key, (unsigned char*)iv);
-
- if (EVP_EncryptUpdate (&ctx, (uc*)&buff, &outlen, (uc*)input, inputSize) != 1)
- return NULL;
- if (EVP_EncryptFinal (&ctx, (uc*)&buff + outlen, &auxlen) != 1)
- return NULL;
-
- outlen += auxlen;
- EVP_CIPHER_CTX_cleanup (&ctx);
- return g_base64_encode ((const guchar*)&buff, outlen);
-}
-
-gchar*
-formhistory_decrypt (const gchar* b64input,
- const gchar* key)
-{
- int outlen=0, auxlen=0;
- EVP_CIPHER_CTX ctx;
- char buff[BUF_SIZE];
- guchar* input;
- size_t inputSize;
-
- if (!b64input)
- return NULL;
-
- input = g_base64_decode (b64input, &inputSize);
- memset (&buff, 0, BUF_SIZE);
-
- EVP_CIPHER_CTX_init (& ctx);
- EVP_DecryptInit (& ctx, EVP_bf_cbc(), (unsigned char*)key, (uc*)iv);
-
- if (EVP_DecryptUpdate (& ctx, (uc*)&buff, &outlen, (uc*)input, inputSize) != 1)
- return NULL;
- if (EVP_DecryptFinal (& ctx, (uc*)&buff + outlen, &auxlen) != 1)
- return NULL;
-
- outlen += auxlen;
- g_free (input);
- EVP_CIPHER_CTX_cleanup (&ctx);
- return g_strndup (buff, outlen);
-}
#define MINCHARS 2
#define GTK_RESPONSE_IGNORE 99
#include "formhistory-frontend.h"
-#include "formhistory-crypt.h"
static void
formhistory_toggle_state_cb (GtkAction* action,
return ret;
}
+static gchar*
+formhistory_encrypt (const gchar* data,
+ const gchar* password)
+{
+ /* TODO: Implement persistent storage/ keyring support */
+ return NULL;
+}
+
static void
formhistory_remember_password_response (GtkWidget* infobar,
gint response_id,
if (response_id != GTK_RESPONSE_ACCEPT)
katze_assign (entry->form_data, g_strdup ("never"));
- encrypted_form = formhistory_encrypt (entry->form_data, entry->priv->master_password);
+ if ((encrypted_form = formhistory_encrypt (entry->form_data,
+ entry->priv->master_password)))
formhistory_update_database (entry->priv->db, entry->domain, "MidoriPasswordManager", encrypted_form);
-
g_free (encrypted_form);
}
WebKitWebPolicyDecision* decision,
MidoriExtension* extension)
{
- FormhistoryPasswordEntry* entry;
FormHistoryPriv* priv;
JSContextRef js_context;
gchar* value;
{
gchar* data;
gchar* domain;
-
- if (!priv->password_manager_enabled)
- break;
+ #if 0
+ FormhistoryPasswordEntry* entry;
+ #endif
domain = midori_uri_parse_hostname (webkit_web_frame_get_uri (web_frame), NULL);
data = formhistory_get_login_data (priv->db, domain);
g_free (domain);
break;
}
+ #if 0
entry = g_slice_new (FormhistoryPasswordEntry);
/* Domain and form data are freed from infopanel callback*/
entry->form_data = g_strdup (value);
entry->domain = domain;
entry->priv = priv;
g_object_set_data (G_OBJECT (web_view), "FormHistoryPasswordEntry", entry);
+ #endif
}
#endif
}
MidoriExtension* extension)
{
const gchar* page_uri;
- FormHistoryPriv* priv;
FormhistoryPasswordEntry* entry;
GtkWidget* view;
formhistory_setup_suggestions (web_view, js_context, extension);
#if WEBKIT_CHECK_VERSION (1, 3, 8)
- priv = g_object_get_data (G_OBJECT (extension), "priv");
- if (!priv->password_manager_enabled)
- return;
-
entry = g_object_get_data (G_OBJECT (web_view), "FormHistoryPasswordEntry");
if (entry)
{
}
#if WEBKIT_CHECK_VERSION (1, 3, 8)
+static gchar*
+formhistory_decrypt (const gchar* data,
+ const gchar* password)
+{
+ /* TODO: Implement persistent storage/ keyring support */
+ return NULL;
+}
+
static void
formhistory_fill_login_data (JSContextRef js_context,
FormHistoryPriv* priv,
if (!strncmp (data, "never", 5))
return;
+ #if 0
if (!formhistory_check_master_password (NULL, priv))
return;
+ #endif
if (!(decrypted_data = formhistory_decrypt (data, priv->master_password)))
return;
MidoriExtension* extension)
{
GtkWidget* web_view = midori_view_get_web_view (view);
- FormHistoryPriv* priv;
- priv = g_object_get_data (G_OBJECT (extension), "priv");
g_signal_connect (web_view, "window-object-cleared",
G_CALLBACK (formhistory_window_object_cleared_cb), extension);
g_signal_connect (web_view, "navigation-policy-decision-requested",
G_CALLBACK (formhistory_navigation_decision_cb), extension);
#if WEBKIT_CHECK_VERSION (1, 3, 8)
- if (!priv->password_manager_enabled)
- return;
g_signal_connect (web_view, "onload-event",
G_CALLBACK (formhistory_frame_loaded_cb), extension);
#endif
MidoriExtension* extension)
{
GtkWidget* web_view = midori_view_get_web_view (view);
- FormHistoryPriv* priv;
- priv = g_object_get_data (G_OBJECT (extension), "priv");
g_signal_handlers_disconnect_by_func (
web_view, formhistory_window_object_cleared_cb, extension);
g_signal_handlers_disconnect_by_func (
web_view, formhistory_navigation_decision_cb, extension);
#if WEBKIT_CHECK_VERSION (1, 3, 8)
- if (!priv->password_manager_enabled)
- return;
-
g_signal_handlers_disconnect_by_func (
web_view, formhistory_frame_loaded_cb, extension);
#endif
priv = formhistory_private_new ();
priv->master_password = NULL;
priv->master_password_canceled = 0;
- priv->password_manager_enabled = 1;
formhistory_construct_popup_gui (priv);
config_dir = midori_extension_get_config_dir (extension);