Skip to content

Commit

Permalink
Revert "write encrypted url"
Browse files Browse the repository at this point in the history
This reverts commit 1179398.
  • Loading branch information
TiborKLP committed Oct 20, 2023
1 parent 97b0e53 commit 2dd3a17
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
21 changes: 4 additions & 17 deletions blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ static struct account *account_parse(struct chunk *chunk, const unsigned char ke
if (check_next_entry_encrypted(chunk))
entry_crypt(url);
else
entry_hex(url);
entry_hex(url);
entry_crypt(note);
entry_boolean(fav);
skip(sharedfromaid);
Expand Down Expand Up @@ -814,10 +814,7 @@ static void write_account_chunk(struct buffer *buffer, struct account *account)
write_plain_string(&accbuf, account->id);
write_crypt_string(&accbuf, account->name_encrypted);
write_crypt_string(&accbuf, account->group_encrypted);
if (account->url_encrypted != NULL)
write_crypt_string(&accbuf, account->url_encrypted);
else
write_hex_string(&accbuf, account->url);
write_hex_string(&accbuf, account->url);
write_crypt_string(&accbuf, account->note_encrypted);
write_plain_string(&accbuf, "skipped");
write_plain_string(&accbuf, "skipped");
Expand Down Expand Up @@ -1017,17 +1014,8 @@ void account_set_note(struct account *account, char *note, unsigned const char k
}
void account_set_url(struct account *account, char *url, unsigned const char key[KDF_HASH_LEN])
{
if (url != NULL && strstr(url, "://") == NULL) {
char *url_with_prefix;
if ((url_with_prefix = malloc(strlen(url) + strlen("http://") + 1)) != NULL) {
strcpy(url_with_prefix, "http://");
strcat(url_with_prefix, url);
free(url);
url = url_with_prefix;
}
}

set_encrypted_field(account, url);
UNUSED(key);
set_field(account, url);
}
void account_set_appname(struct account *account, char *appname, unsigned const char key[KDF_HASH_LEN])
{
Expand Down Expand Up @@ -1058,7 +1046,6 @@ void account_reencrypt(struct account *account, const unsigned char key[KDF_HASH

reencrypt_field(account, name);
reencrypt_field(account, group);
reencrypt_field(account, url);
reencrypt_field(account, username);
reencrypt_field(account, password);
reencrypt_field(account, note);
Expand Down
5 changes: 4 additions & 1 deletion endpoints-share.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ int lastpass_share_move(const struct session *session,
struct account *account,
struct share *orig_folder)
{
_cleanup_free_ char *url = NULL;
_cleanup_free_ char *reply = NULL;

struct http_param_set params = {
Expand All @@ -321,13 +322,15 @@ int lastpass_share_move(const struct session *session,
if (!account->share && !orig_folder)
return 0;

bytes_to_hex((unsigned char *) account->url, &url, strlen(account->url));

http_post_add_params(&params,
"token", session->token,
"cmd", "uploadaccounts",
"aid0", account->id,
"name0", account->name_encrypted,
"grouping0", account->group_encrypted,
"url0", account->url_encrypted,
"url0", url,
"username0", account->username_encrypted,
"password0", account->password_encrypted,
"pwprotect0", account->pwprotect ? "on" : "off",
Expand Down
7 changes: 5 additions & 2 deletions endpoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void lastpass_update_account(enum blobsync sync, unsigned const char key[KDF_HAS
}
http_post_add_params(&params,
"aid", account->id,
"url", account->url_encrypted,
"url", url,
"username", account->username_encrypted,
"password", account->password_encrypted,
"extra", account->note_encrypted,
Expand Down Expand Up @@ -399,6 +399,9 @@ int lastpass_upload(const struct session *session,
char *name_param, *grouping_param;
char *url_param, *username_param, *password_param;
char *fav_param, *extra_param;
char *url = NULL;
bytes_to_hex((unsigned char *) account->url, &url,
strlen(account->url));

xasprintf(&name_param, "name%d", index);
xasprintf(&grouping_param, "grouping%d", index);
Expand All @@ -411,7 +414,7 @@ int lastpass_upload(const struct session *session,
http_post_add_params(&params,
name_param, account->name_encrypted,
grouping_param, account->group_encrypted,
url_param, account->url_encrypted,
url_param, url,
username_param, account->username_encrypted,
password_param, account->password_encrypted,
fav_param, account->fav ? "1" : "0",
Expand Down

0 comments on commit 2dd3a17

Please sign in to comment.