summaryrefslogtreecommitdiff
path: root/lib/sync
diff options
context:
space:
mode:
authorGabriel Ivascu <gabrielivascu@gnome.org>2017-08-27 00:11:06 +0300
committerGabriel Ivascu <gabrielivascu@gnome.org>2017-08-27 20:39:53 +0300
commit3960972797cc09fbe3e608f57231d77e040f0566 (patch)
treedb3d6507d8adb2bb7472b1a9d1ad60cb99ae5d0f /lib/sync
parent5c739e0e62dcc6a5e4975a41834a672148acf3d1 (diff)
downloadepiphany-3960972797cc09fbe3e608f57231d77e040f0566.tar.gz
password-manager: Handle security origins only (no more URIs)
Change the API of EphyPasswordManager to handle security origins only, thus clearing possible confusions about whether to call functions with URIs or origins. Also fix bad variable naming: "hostname" -> "origin". https://bugzilla.gnome.org/show_bug.cgi?id=786818
Diffstat (limited to 'lib/sync')
-rw-r--r--lib/sync/ephy-password-manager.c127
-rw-r--r--lib/sync/ephy-password-manager.h12
-rw-r--r--lib/sync/ephy-password-record.c49
-rw-r--r--lib/sync/ephy-password-record.h4
4 files changed, 94 insertions, 98 deletions
diff --git a/lib/sync/ephy-password-manager.c b/lib/sync/ephy-password-manager.c
index a025c0e1d..fa1cd5239 100644
--- a/lib/sync/ephy-password-manager.c
+++ b/lib/sync/ephy-password-manager.c
@@ -25,7 +25,6 @@
#include "ephy-settings.h"
#include "ephy-sync-utils.h"
#include "ephy-synchronizable-manager.h"
-#include "ephy-uri-helpers.h"
#include <glib/gi18n.h>
#include <stdio.h>
@@ -37,7 +36,7 @@ ephy_password_manager_get_password_schema (void)
"org.epiphany.FormPassword", SECRET_SCHEMA_NONE,
{
{ ID_KEY, SECRET_SCHEMA_ATTRIBUTE_STRING },
- { HOSTNAME_KEY, SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { ORIGIN_KEY, SECRET_SCHEMA_ATTRIBUTE_STRING },
{ TARGET_ORIGIN_KEY, SECRET_SCHEMA_ATTRIBUTE_STRING },
{ USERNAME_FIELD_KEY, SECRET_SCHEMA_ATTRIBUTE_STRING },
{ PASSWORD_FIELD_KEY, SECRET_SCHEMA_ATTRIBUTE_STRING },
@@ -184,7 +183,7 @@ replace_record_async_data_free (ReplaceRecordAsyncData *data)
static GHashTable *
get_attributes_table (const char *id,
- const char *uri,
+ const char *origin,
const char *target_origin,
const char *username,
const char *username_field,
@@ -197,14 +196,14 @@ get_attributes_table (const char *id,
g_hash_table_insert (attributes,
g_strdup (ID_KEY),
g_strdup (id));
- if (uri)
+ if (origin)
g_hash_table_insert (attributes,
- g_strdup (HOSTNAME_KEY),
- ephy_uri_to_security_origin (uri));
+ g_strdup (ORIGIN_KEY),
+ g_strdup (origin));
if (target_origin)
g_hash_table_insert (attributes,
g_strdup (TARGET_ORIGIN_KEY),
- ephy_uri_to_security_origin (target_origin));
+ g_strdup (target_origin));
if (username)
g_hash_table_insert (attributes,
g_strdup (USERNAME_KEY),
@@ -242,7 +241,7 @@ ephy_password_manager_cache_clear (EphyPasswordManager *self)
static void
ephy_password_manager_cache_remove (EphyPasswordManager *self,
- const char *hostname,
+ const char *origin,
const char *username)
{
GList *usernames;
@@ -251,23 +250,23 @@ ephy_password_manager_cache_remove (EphyPasswordManager *self,
g_assert (EPHY_IS_PASSWORD_MANAGER (self));
g_assert (self->cache);
- if (!hostname || !username)
+ if (!origin || !username)
return;
- usernames = g_hash_table_lookup (self->cache, hostname);
+ usernames = g_hash_table_lookup (self->cache, origin);
if (usernames) {
for (GList *l = usernames; l && l->data; l = l->next) {
if (g_strcmp0 (username, l->data))
new_usernames = g_list_prepend (new_usernames, g_strdup (l->data));
}
- g_hash_table_replace (self->cache, g_strdup (hostname), new_usernames);
+ g_hash_table_replace (self->cache, g_strdup (origin), new_usernames);
g_list_free_full (usernames, g_free);
}
}
static void
ephy_password_manager_cache_add (EphyPasswordManager *self,
- const char *hostname,
+ const char *origin,
const char *username)
{
GList *usernames;
@@ -275,16 +274,16 @@ ephy_password_manager_cache_add (EphyPasswordManager *self,
g_assert (EPHY_IS_PASSWORD_MANAGER (self));
g_assert (self->cache);
- if (!hostname || !username)
+ if (!origin || !username)
return;
- usernames = g_hash_table_lookup (self->cache, hostname);
+ usernames = g_hash_table_lookup (self->cache, origin);
for (GList *l = usernames; l && l->data; l = l->next) {
if (!g_strcmp0 (username, l->data))
return;
}
usernames = g_list_prepend (usernames, g_strdup (username));
- g_hash_table_replace (self->cache, g_strdup (hostname), usernames);
+ g_hash_table_replace (self->cache, g_strdup (origin), usernames);
}
static void
@@ -295,10 +294,10 @@ populate_cache_cb (GList *records,
for (GList *l = records; l && l->data; l = l->next) {
EphyPasswordRecord *record = EPHY_PASSWORD_RECORD (l->data);
- const char *hostname = ephy_password_record_get_hostname (record);
+ const char *origin = ephy_password_record_get_origin (record);
const char *username = ephy_password_record_get_username (record);
- ephy_password_manager_cache_add (self, hostname, username);
+ ephy_password_manager_cache_add (self, origin, username);
}
g_list_free_full (records, g_object_unref);
@@ -341,20 +340,13 @@ ephy_password_manager_new (void)
}
GList *
-ephy_password_manager_get_cached_users_for_uri (EphyPasswordManager *self,
- const char *uri)
+ephy_password_manager_get_cached_users (EphyPasswordManager *self,
+ const char *origin)
{
- GList *list;
- char *hostname;
-
g_return_val_if_fail (EPHY_IS_PASSWORD_MANAGER (self), NULL);
- g_return_val_if_fail (uri, NULL);
-
- hostname = ephy_uri_to_security_origin (uri);
- list = g_hash_table_lookup (self->cache, hostname);
- g_free (hostname);
+ g_return_val_if_fail (origin, NULL);
- return list;
+ return g_hash_table_lookup (self->cache, origin);
}
static void
@@ -381,7 +373,7 @@ store_internal (const char *password,
{
SecretValue *value;
GTask *task;
- const char *hostname;
+ const char *origin;
const char *username;
char *label;
@@ -390,22 +382,22 @@ store_internal (const char *password,
task = g_task_new (NULL, NULL, callback, user_data);
value = secret_value_new (password, -1, "text/plain");
- hostname = g_hash_table_lookup (attributes, HOSTNAME_KEY);
+ origin = g_hash_table_lookup (attributes, ORIGIN_KEY);
username = g_hash_table_lookup (attributes, USERNAME_KEY);
if (username) {
/* Translators: The first %s is the username and the second one is the
* security origin where this is happening. Example: gnome@gmail.com and
* https://mail.google.com. */
- label = g_strdup_printf (_("Password for %s in a form in %s"), username, hostname);
+ label = g_strdup_printf (_("Password for %s in a form in %s"), username, origin);
} else {
/* Translators: The %s is the security origin where this is happening.
* Example: https://mail.google.com. */
- label = g_strdup_printf (_("Password in a form in %s"), hostname);
+ label = g_strdup_printf (_("Password in a form in %s"), origin);
}
LOG ("Storing password record for (%s, %s, %s, %s)",
- hostname, username,
+ origin, username,
(char *)g_hash_table_lookup (attributes, USERNAME_FIELD_KEY),
(char *)g_hash_table_lookup (attributes, PASSWORD_FIELD_KEY));
@@ -424,16 +416,16 @@ ephy_password_manager_store_record (EphyPasswordManager *self,
EphyPasswordRecord *record)
{
GHashTable *attributes;
- const char *hostname;
+ const char *origin;
const char *username;
g_assert (EPHY_IS_PASSWORD_MANAGER (self));
g_assert (EPHY_IS_PASSWORD_RECORD (record));
- hostname = ephy_password_record_get_hostname (record);
+ origin = ephy_password_record_get_origin (record);
username = ephy_password_record_get_username (record);
attributes = get_attributes_table (ephy_password_record_get_id (record),
- hostname,
+ origin,
ephy_password_record_get_target_origin (record),
username,
ephy_password_record_get_username_field (record),
@@ -441,7 +433,7 @@ ephy_password_manager_store_record (EphyPasswordManager *self,
ephy_synchronizable_get_server_time_modified (EPHY_SYNCHRONIZABLE (record)));
store_internal (ephy_password_record_get_password (record), attributes, NULL, NULL);
- ephy_password_manager_cache_add (self, hostname, username);
+ ephy_password_manager_cache_add (self, origin, username);
g_hash_table_unref (attributes);
}
@@ -467,7 +459,7 @@ update_password_cb (GList *records,
void
ephy_password_manager_save (EphyPasswordManager *self,
- const char *uri,
+ const char *origin,
const char *target_origin,
const char *username,
const char *password,
@@ -476,13 +468,12 @@ ephy_password_manager_save (EphyPasswordManager *self,
gboolean is_new)
{
EphyPasswordRecord *record;
- char *hostname;
char *uuid;
char *id;
gint64 timestamp;
g_return_if_fail (EPHY_IS_PASSWORD_MANAGER (self));
- g_return_if_fail (uri);
+ g_return_if_fail (origin);
g_return_if_fail (target_origin);
g_return_if_fail (password);
g_return_if_fail (!username_field || username);
@@ -490,9 +481,9 @@ ephy_password_manager_save (EphyPasswordManager *self,
if (!is_new) {
LOG ("Updating password for (%s, %s, %s, %s, %s)",
- uri, target_origin, username, username_field, password_field);
+ origin, target_origin, username, username_field, password_field);
ephy_password_manager_query (self, NULL,
- uri, target_origin, username,
+ origin, target_origin, username,
username_field, password_field,
update_password_cb,
update_password_async_data_new (self, password));
@@ -502,15 +493,13 @@ ephy_password_manager_save (EphyPasswordManager *self,
uuid = g_uuid_string_random ();
id = g_strdup_printf ("{%s}", uuid);
timestamp = g_get_real_time () / 1000;
- hostname = ephy_uri_to_security_origin (uri);
- record = ephy_password_record_new (id, hostname, target_origin,
+ record = ephy_password_record_new (id, origin, target_origin,
username, password,
username_field, password_field,
timestamp, timestamp);
ephy_password_manager_store_record (self, record);
g_signal_emit_by_name (self, "synchronizable-modified", record, FALSE);
- g_free (hostname);
g_free (uuid);
g_free (id);
g_object_unref (record);
@@ -537,7 +526,7 @@ secret_service_search_cb (SecretService *service,
GHashTable *attributes = secret_item_get_attributes (item);
SecretValue *value = secret_item_get_secret (item);
const char *id = g_hash_table_lookup (attributes, ID_KEY);
- const char *hostname = g_hash_table_lookup (attributes, HOSTNAME_KEY);
+ const char *origin = g_hash_table_lookup (attributes, ORIGIN_KEY);
const char *target_origin = g_hash_table_lookup (attributes, TARGET_ORIGIN_KEY);
const char *username = g_hash_table_lookup (attributes, USERNAME_KEY);
const char *username_field = g_hash_table_lookup (attributes, USERNAME_FIELD_KEY);
@@ -548,14 +537,14 @@ secret_service_search_cb (SecretService *service,
EphyPasswordRecord *record;
LOG ("Found password record for (%s, %s, %s, %s, %s)",
- hostname, target_origin, username, username_field, password_field);
+ origin, target_origin, username, username_field, password_field);
- if (!id || !hostname || !target_origin || !password_field || !timestamp) {
+ if (!id || !origin || !target_origin || !password_field || !timestamp) {
LOG ("Password record is corrupted, skipping it...");
goto next;
}
- record = ephy_password_record_new (id, hostname, target_origin,
+ record = ephy_password_record_new (id, origin, target_origin,
username, password,
username_field, password_field,
secret_item_get_created (item) * 1000,
@@ -580,7 +569,7 @@ out:
void
ephy_password_manager_query (EphyPasswordManager *self,
const char *id,
- const char *uri,
+ const char *origin,
const char *target_origin,
const char *username,
const char *username_field,
@@ -594,9 +583,9 @@ ephy_password_manager_query (EphyPasswordManager *self,
g_return_if_fail (EPHY_IS_PASSWORD_MANAGER (self));
LOG ("Querying password records for (%s, %s, %s, %s)",
- uri, username, username_field, password_field);
+ origin, username, username_field, password_field);
- attributes = get_attributes_table (id, uri, target_origin, username,
+ attributes = get_attributes_table (id, origin, target_origin, username,
username_field, password_field, -1);
data = query_async_data_new (callback, user_data);
@@ -612,7 +601,7 @@ ephy_password_manager_query (EphyPasswordManager *self,
}
void
-ephy_password_manager_store_raw (const char *uri,
+ephy_password_manager_store_raw (const char *origin,
const char *username,
const char *password,
const char *username_field,
@@ -622,12 +611,12 @@ ephy_password_manager_store_raw (const char *uri,
{
GHashTable *attributes;
- g_return_if_fail (uri);
+ g_return_if_fail (origin);
g_return_if_fail (password);
g_return_if_fail (!username_field || username);
g_return_if_fail (!password_field || password);
- attributes = get_attributes_table (NULL, uri, uri, username,
+ attributes = get_attributes_table (NULL, origin, origin, username,
username_field, password_field, -1);
store_internal (password, attributes, callback, user_data);
@@ -676,7 +665,7 @@ ephy_password_manager_forget_record (EphyPasswordManager *self,
g_assert (EPHY_IS_PASSWORD_RECORD (record));
attributes = get_attributes_table (ephy_password_record_get_id (record),
- ephy_password_record_get_hostname (record),
+ ephy_password_record_get_origin (record),
ephy_password_record_get_target_origin (record),
ephy_password_record_get_username (record),
ephy_password_record_get_username_field (record),
@@ -684,7 +673,7 @@ ephy_password_manager_forget_record (EphyPasswordManager *self,
-1);
LOG ("Forgetting password record for (%s, %s, %s, %s, %s)",
- ephy_password_record_get_hostname (record),
+ ephy_password_record_get_origin (record),
ephy_password_record_get_target_origin (record),
ephy_password_record_get_username (record),
ephy_password_record_get_username_field (record),
@@ -695,7 +684,7 @@ ephy_password_manager_forget_record (EphyPasswordManager *self,
replacement ? replace_record_async_data_new (self, replacement) : NULL);
ephy_password_manager_cache_remove (self,
- ephy_password_record_get_hostname (record),
+ ephy_password_record_get_origin (record),
ephy_password_record_get_username (record));
g_hash_table_unref (attributes);
}
@@ -876,7 +865,7 @@ get_record_by_id (GList *records,
static EphyPasswordRecord *
get_record_by_parameters (GList *records,
- const char *hostname,
+ const char *origin,
const char *target_origin,
const char *username,
const char *username_field,
@@ -884,7 +873,7 @@ get_record_by_parameters (GList *records,
{
for (GList *l = records; l && l->data; l = l->next) {
if (!g_strcmp0 (ephy_password_record_get_username (l->data), username) &&
- !g_strcmp0 (ephy_password_record_get_hostname (l->data), hostname) &&
+ !g_strcmp0 (ephy_password_record_get_origin (l->data), origin) &&
!g_strcmp0 (ephy_password_record_get_target_origin (l->data), target_origin) &&
!g_strcmp0 (ephy_password_record_get_username_field (l->data), username_field) &&
!g_strcmp0 (ephy_password_record_get_password_field (l->data), password_field))
@@ -918,7 +907,7 @@ ephy_password_manager_handle_initial_merge (EphyPasswordManager *self,
GHashTable *dont_upload;
GList *to_upload = NULL;
const char *remote_id;
- const char *remote_hostname;
+ const char *remote_origin;
const char *remote_target_origin;
const char *remote_username;
const char *remote_password;
@@ -932,7 +921,7 @@ ephy_password_manager_handle_initial_merge (EphyPasswordManager *self,
g_assert (EPHY_IS_PASSWORD_MANAGER (self));
/* A saved password record is uniquely identified by its ID or by its tuple
- * of (hostname, username, username field, password field). When importing
+ * of (origin, username, username field, password field). When importing
* password records from server, we may encounter duplicates either by ID
* or by mentioned tuple. We start from the assumption that same ID means
* same tuple but same tuple does not necessarily mean same ID. This is what
@@ -942,7 +931,7 @@ ephy_password_manager_handle_initial_merge (EphyPasswordManager *self,
for (GList *l = remote_records; l && l->data; l = l->next) {
remote_id = ephy_password_record_get_id (l->data);
- remote_hostname = ephy_password_record_get_hostname (l->data);
+ remote_origin = ephy_password_record_get_origin (l->data);
remote_target_origin = ephy_password_record_get_target_origin (l->data);
remote_username = ephy_password_record_get_username (l->data);
remote_password = ephy_password_record_get_password (l->data);
@@ -976,7 +965,7 @@ ephy_password_manager_handle_initial_merge (EphyPasswordManager *self,
}
} else {
record = get_record_by_parameters (local_records,
- remote_hostname,
+ remote_origin,
remote_target_origin,
remote_username,
remote_username_field,
@@ -994,8 +983,8 @@ ephy_password_manager_handle_initial_merge (EphyPasswordManager *self,
}
} else {
record = get_record_by_parameters (local_records,
- remote_hostname,
- remote_hostname,
+ remote_origin,
+ remote_origin,
remote_username,
remote_username_field,
remote_password_field);
@@ -1034,7 +1023,7 @@ ephy_password_manager_handle_regular_merge (EphyPasswordManager *self,
EphyPasswordRecord *record;
GList *to_upload = NULL;
const char *remote_id;
- const char *remote_hostname;
+ const char *remote_origin;
const char *remote_target_origin;
const char *remote_username;
const char *remote_username_field;
@@ -1056,7 +1045,7 @@ ephy_password_manager_handle_regular_merge (EphyPasswordManager *self,
/* See comment in ephy_password_manager_handle_initial_merge. */
for (GList *l = updated_records; l && l->data; l = l->next) {
remote_id = ephy_password_record_get_id (l->data);
- remote_hostname = ephy_password_record_get_hostname (l->data);
+ remote_origin = ephy_password_record_get_origin (l->data);
remote_target_origin = ephy_password_record_get_target_origin (l->data);
remote_username = ephy_password_record_get_username (l->data);
remote_username_field = ephy_password_record_get_username_field (l->data);
@@ -1069,7 +1058,7 @@ ephy_password_manager_handle_regular_merge (EphyPasswordManager *self,
ephy_password_manager_forget_record (self, record, l->data);
} else {
record = get_record_by_parameters (*local_records,
- remote_hostname,
+ remote_origin,
remote_target_origin,
remote_username,
remote_username_field,
diff --git a/lib/sync/ephy-password-manager.h b/lib/sync/ephy-password-manager.h
index 598350af5..b6fe346f9 100644
--- a/lib/sync/ephy-password-manager.h
+++ b/lib/sync/ephy-password-manager.h
@@ -30,7 +30,7 @@ G_BEGIN_DECLS
const SecretSchema *ephy_password_manager_get_password_schema (void) G_GNUC_CONST;
#define ID_KEY "id"
-#define HOSTNAME_KEY "uri"
+#define ORIGIN_KEY "uri" /* TODO: Rename to "origin". Requires migration. */
#define TARGET_ORIGIN_KEY "target_origin"
#define USERNAME_FIELD_KEY "form_username"
#define PASSWORD_FIELD_KEY "form_password"
@@ -46,10 +46,10 @@ G_DECLARE_FINAL_TYPE (EphyPasswordManager, ephy_password_manager, EPHY, PASSWORD
typedef void (*EphyPasswordManagerQueryCallback) (GList *records, gpointer user_data);
EphyPasswordManager *ephy_password_manager_new (void);
-GList *ephy_password_manager_get_cached_users_for_uri (EphyPasswordManager *self,
- const char *uri);
+GList *ephy_password_manager_get_cached_users (EphyPasswordManager *self,
+ const char *origin);
void ephy_password_manager_save (EphyPasswordManager *self,
- const char *uri,
+ const char *origin,
const char *target_origin,
const char *username,
const char *password,
@@ -58,7 +58,7 @@ void ephy_password_manager_save (EphyPasswor
gboolean is_new);
void ephy_password_manager_query (EphyPasswordManager *self,
const char *id,
- const char *uri,
+ const char *origin,
const char *target_origin,
const char *username,
const char *username_field,
@@ -70,7 +70,7 @@ void ephy_password_manager_forget (EphyPasswo
void ephy_password_manager_forget_all (EphyPasswordManager *self);
/* Note: Below functions are deprecated and should not be used in newly written code.
* The only reason they still exist is that the profile migrator expects them. */
-void ephy_password_manager_store_raw (const char *uri,
+void ephy_password_manager_store_raw (const char *origin,
const char *username,
const char *password,
const char *username_field,
diff --git a/lib/sync/ephy-password-record.c b/lib/sync/ephy-password-record.c
index 21b94ff41..4c7e731fb 100644
--- a/lib/sync/ephy-password-record.c
+++ b/lib/sync/ephy-password-record.c
@@ -27,7 +27,7 @@ struct _EphyPasswordRecord {
GObject parent_instance;
char *id;
- char *hostname;
+ char *origin;
char *target_origin;
char *username;
char *password;
@@ -51,7 +51,7 @@ G_DEFINE_TYPE_WITH_CODE (EphyPasswordRecord, ephy_password_record, G_TYPE_OBJECT
enum {
PROP_0,
PROP_ID, /* Firefox Sync */
- PROP_HOSTNAME, /* Epiphany && Firefox Sync */
+ PROP_ORIGIN, /* Epiphany && Firefox Sync */
PROP_TARGET_ORIGIN, /* Epiphany && Firefox Sync */
PROP_USERNAME, /* Epiphany && Firefox Sync */
PROP_PASSWORD, /* Epiphany && Firefox Sync */
@@ -77,9 +77,9 @@ ephy_password_record_set_property (GObject *object,
g_free (self->id);
self->id = g_strdup (g_value_get_string (value));
break;
- case PROP_HOSTNAME:
- g_free (self->hostname);
- self->hostname = g_strdup (g_value_get_string (value));
+ case PROP_ORIGIN:
+ g_free (self->origin);
+ self->origin = g_strdup (g_value_get_string (value));
break;
case PROP_TARGET_ORIGIN:
g_free (self->target_origin);
@@ -124,8 +124,8 @@ ephy_password_record_get_property (GObject *object,
case PROP_ID:
g_value_set_string (value, self->id);
break;
- case PROP_HOSTNAME:
- g_value_set_string (value, self->hostname);
+ case PROP_ORIGIN:
+ g_value_set_string (value, self->origin);
break;
case PROP_TARGET_ORIGIN:
g_value_set_string (value, self->target_origin);
@@ -159,7 +159,7 @@ ephy_password_record_finalize (GObject *object)
EphyPasswordRecord *self = EPHY_PASSWORD_RECORD (object);
g_free (self->id);
- g_free (self->hostname);
+ g_free (self->origin);
g_free (self->target_origin);
g_free (self->username);
g_free (self->password);
@@ -179,27 +179,34 @@ ephy_password_record_class_init (EphyPasswordRecordClass *klass)
object_class->finalize = ephy_password_record_finalize;
/* The property names must match Firefox password object structure, see
- * https://mozilla-services.readthedocs.io/en/latest/sync/objectformats.html#passwords */
+ * https://mozilla-services.readthedocs.io/en/latest/sync/objectformats.html#passwords
+ */
obj_properties[PROP_ID] =
g_param_spec_string ("id",
"Id",
"Id of the password record",
"Default id",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
- obj_properties[PROP_HOSTNAME] =
+ /* Origin matches hostname field from Firefox.
+ * Despite its name, it's actually a security origin (scheme + host + port), so call it appropriately, see
+ * https://dxr.mozilla.org/mozilla-central/rev/892c8916ba32b7733e06bfbfdd4083ffae3ca028/toolkit/components/passwordmgr/LoginManagerContent.jsm#922
+ * https://dxr.mozilla.org/mozilla-central/rev/892c8916ba32b7733e06bfbfdd4083ffae3ca028/toolkit/components/passwordmgr/LoginManagerContent.jsm#1380
+ */
+ obj_properties[PROP_ORIGIN] =
g_param_spec_string ("hostname",
- "Hostname",
- "Hostname url that password is applicable at",
- "Default hostname",
+ "Security origin",
+ "Security origin of the URI that password is applicable at",
+ "Default security origin",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
/* Target origin matches formSubmitURL field from Firefox.
- * Despite its name, it's actually an origin, so call it appropriately, see
- * https://dxr.mozilla.org/mozilla-central/rev/892c8916ba32b7733e06bfbfdd4083ffae3ca028/toolkit/components/passwordmgr/LoginManagerContent.jsm#928 */
+ * Despite its name, it's actually a security origin, so call it appropriately, see
+ * https://dxr.mozilla.org/mozilla-central/rev/892c8916ba32b7733e06bfbfdd4083ffae3ca028/toolkit/components/passwordmgr/LoginManagerContent.jsm#928
+ */
obj_properties[PROP_TARGET_ORIGIN] =
g_param_spec_string ("formSubmitURL",
"Target origin",
- "The target origin of the URI where that password is applicable at",
- "Default target origin URI",
+ "The target origin of the URI that password is applicable at",
+ "Default target origin",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_USERNAME] =
g_param_spec_string ("username",
@@ -252,7 +259,7 @@ ephy_password_record_init (EphyPasswordRecord *self)
EphyPasswordRecord *
ephy_password_record_new (const char *id,
- const char *hostname,
+ const char *origin,
const char *target_origin,
const char *username,
const char *password,
@@ -263,7 +270,7 @@ ephy_password_record_new (const char *id,
{
return EPHY_PASSWORD_RECORD (g_object_new (EPHY_TYPE_PASSWORD_RECORD,
"id", id,
- "hostname", hostname,
+ "hostname", origin,
"formSubmitURL", target_origin,
"username", username,
"password", password,
@@ -283,11 +290,11 @@ ephy_password_record_get_id (EphyPasswordRecord *self)
}
const char *
-ephy_password_record_get_hostname (EphyPasswordRecord *self)
+ephy_password_record_get_origin (EphyPasswordRecord *self)
{
g_return_val_if_fail (EPHY_IS_PASSWORD_RECORD (self), NULL);
- return self->hostname;
+ return self->origin;
}
const char *
diff --git a/lib/sync/ephy-password-record.h b/lib/sync/ephy-password-record.h
index 336435909..548fe076d 100644
--- a/lib/sync/ephy-password-record.h
+++ b/lib/sync/ephy-password-record.h
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (EphyPasswordRecord, ephy_password_record, EPHY, PASSWORD_RECORD, GObject)
EphyPasswordRecord *ephy_password_record_new (const char *id,
- const char *hostname,
+ const char *origin,
const char *target_origin,
const char *username,
const char *password,
@@ -38,7 +38,7 @@ EphyPasswordRecord *ephy_password_record_new (const char
guint64 time_created,
guint64 time_password_changed);
const char *ephy_password_record_get_id (EphyPasswordRecord *self);
-const char *ephy_password_record_get_hostname (EphyPasswordRecord *self);
+const char *ephy_password_record_get_origin (EphyPasswordRecord *self);
const char *ephy_password_record_get_target_origin (EphyPasswordRecord *self);
const char *ephy_password_record_get_username (EphyPasswordRecord *self);
const char *ephy_password_record_get_password (EphyPasswordRecord *self);