ENGINE-250: address fixes and more; lower() still does something really goofy on the FIRST run with make test, but only then, and even if all databases and keyrings are removed, case_and_dot_address_test still passes for every time after until the next time you make clean *with the whole engine* and rebuild. BIZARRE.

doc_update_sequoia
Krista Bennett 5 years ago
parent d528a5bfa8
commit 202df5c0eb

@ -11,7 +11,7 @@
#include <stdlib.h>
#include <sqlite3.h>
#define _PEP_SQLITE_DEBUG 0
#define _PEP_SQLITE_DEBUG 1
static volatile int init_count = -1;
@ -200,8 +200,13 @@ static const char *sql_set_pgp_keypair =
static const char* sql_exists_identity_entry =
"select count(*) from identity "
" where address = ?1 and user_id = ?2;";
" where (case when (address = ?1) then (1)"
" when (lower(address) = lower(?1)) then (1)"
" when (replace(lower(address),'.','') = replace(lower(?1),'.','')) then (1)"
" else 0"
" end) = 1"
" and user_id = ?2;";
static const char *sql_set_identity_entry =
"insert into identity ("
" address, main_key_id, "
@ -219,7 +224,12 @@ static const char* sql_update_identity_entry =
" set main_key_id = upper(replace(?2,' ','')), "
" flags = ?4, "
" is_own = ?5 "
" where address = ?1 and user_id = ?3 ;";
" where (case when (address = ?1) then (1)"
" when (lower(address) = lower(?1)) then (1)"
" when (replace(lower(address),'.','') = replace(lower(?1),'.','')) then (1) "
" else 0 "
" end) = 1 "
" and user_id = ?3 ;";
// " (select"
// " coalesce("
@ -233,14 +243,34 @@ static const char* sql_update_identity_entry =
static const char *sql_set_identity_flags =
"update identity set flags = "
" ((?1 & 255) | (select flags from identity"
" where address = ?2 and user_id = ?3)) "
"where address = ?2 and user_id = ?3 ;";
" where (case when (address = ?2) then (1)"
" when (lower(address) = lower(?2)) then (1)"
" when (replace(lower(address),'.','') = replace(lower(?2),'.','')) then (1)"
" else 0 "
" end) = 1 "
" and user_id = ?3)) "
" where (case when (address = ?2) then (1)"
" when (lower(address) = lower(?2)) then (1)"
" when (replace(lower(address),'.','') = replace(lower(?2),'.','')) then (1)"
" else 0"
" end) = 1"
" and user_id = ?3 ;";
static const char *sql_unset_identity_flags =
"update identity set flags = "
" ( ~(?1 & 255) & (select flags from identity"
" where address = ?2 and user_id = ?3)) "
"where address = ?2 and user_id = ?3 ;";
" where (case when (address = ?2) then (1)"
" when (lower(address) = lower(?2)) then (1)"
" when (replace(lower(address),'.','') = replace(lower(?2),'.','')) then (1)"
" else 0 "
" end) = 1 "
" and user_id = ?3)) "
" where (case when (address = ?2) then (1)"
" when (lower(address) = lower(?2)) then (1)"
" when (replace(lower(address),'.','') = replace(lower(?2),'.','')) then (1)"
" else 0"
" end) = 1"
" and user_id = ?3 ;";
static const char *sql_set_trust =
"insert into trust (user_id, pgp_keypair_fpr, comm_type) "

@ -55,6 +55,7 @@ int main() {
alice_id = new_identity(alice_email_case, NULL, PEP_OWN_USERID, "Alice Test");
status = myself(session, alice_id);
assert(alice_id->fpr);
cout << "Alice email: " << alice_email_case << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
assert(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
free_identity(alice_id);
alice_id = NULL;
@ -62,6 +63,7 @@ int main() {
alice_id = new_identity(alice_email_dot, NULL, PEP_OWN_USERID, "Alice Test");
status = myself(session, alice_id);
assert(alice_id->fpr);
cout << "Alice email: " << alice_email_dot << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
assert(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
free_identity(alice_id);
alice_id = NULL;
@ -69,6 +71,7 @@ int main() {
alice_id = new_identity(alice_email_dotless, NULL, PEP_OWN_USERID, "Alice Test");
status = myself(session, alice_id);
assert(alice_id->fpr);
cout << "Alice email: " << alice_email_dotless << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
assert(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
free_identity(alice_id);
alice_id = NULL;
@ -76,6 +79,7 @@ int main() {
alice_id = new_identity(alice_email_case_and_dot, NULL, PEP_OWN_USERID, "Alice Test");
status = myself(session, alice_id);
assert(alice_id->fpr);
cout << "Alice email: " << alice_email_case_and_dot << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
assert(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
free_identity(alice_id);
alice_id = NULL;

Loading…
Cancel
Save