fixing bug: _own_identities_retrieve() swapped user_id and username sync
authorVolker Birk <vb@pep.foundation>
Wed, 24 Oct 2018 15:25:01 +0200
branchsync
changeset 31001bd0c12ba841
parent 3097 39251f347500
child 3101 b5ce2e8e12c8
fixing bug: _own_identities_retrieve() swapped user_id and username
src/pEpEngine.c
test/src/SuiteMaker.cc
test/src/engine_tests/SyncTests.cc
     1.1 --- a/src/pEpEngine.c	Mon Oct 22 10:40:15 2018 +0200
     1.2 +++ b/src/pEpEngine.c	Wed Oct 24 15:25:01 2018 +0200
     1.3 @@ -391,7 +391,7 @@
     1.4      ");";
     1.5  
     1.6  static const char *sql_own_identities_retrieve =  
     1.7 -    "select address, fpr, username, identity.user_id, "
     1.8 +    "select address, fpr, identity.user_id, username,"
     1.9      "   lang, identity.flags | pgp_keypair.flags"
    1.10      "   from identity"
    1.11      "   join person on id = identity.user_id"
     2.1 --- a/test/src/SuiteMaker.cc	Mon Oct 22 10:40:15 2018 +0200
     2.2 +++ b/test/src/SuiteMaker.cc	Wed Oct 24 15:25:01 2018 +0200
     2.3 @@ -12,175 +12,175 @@
     2.4  #include "SuiteMaker.h"
     2.5  
     2.6  // Begin where we generate stuff
     2.7 +#include "MimeTests.h"
     2.8 +#include "UserIdCollisionTests.h"
     2.9 +#include "Engine463Tests.h"
    2.10 +#include "BloblistTests.h"
    2.11 +#include "NewUpdateIdAndMyselfTests.h"
    2.12 +#include "I18nTests.h"
    2.13 +#include "IdentityListTests.h"
    2.14 +#include "PgpBinaryTests.h"
    2.15 +#include "MessageNullFromTests.h"
    2.16 +#include "LeastCommonDenomColorTests.h"
    2.17 +#include "StringlistTests.h"
    2.18 +#include "PgpListKeysTests.h"
    2.19 +#include "MessageApiTests.h"
    2.20 +#include "EncryptMissingPrivateKeyTests.h"
    2.21 +#include "CaseAndDotAddressTests.h"
    2.22 +#include "UserIDAliasTests.h"
    2.23 +#include "BCCTests.h"
    2.24 +#include "BlacklistAcceptNewKeyTests.h"
    2.25 +#include "DecryptAttachPrivateKeyUntrustedTests.h"
    2.26 +#include "BlacklistTests.h"
    2.27 +#include "RevokeRegenAttachTests.h"
    2.28 +#include "PepSubjectReceivedTests.h"
    2.29 +#include "SequenceTests.h"
    2.30 +#include "EncryptAttachPrivateKeyTests.h"
    2.31 +#include "ExternalRevokeTests.h"
    2.32 +#include "KeyeditTests.h"
    2.33 +#include "LeastColorGroupTests.h"
    2.34 +#include "DecryptAttachPrivateKeyTrustedTests.h"
    2.35 +#include "TrustwordsTests.h"
    2.36 +#include "ReencryptPlusExtraKeysTests.h"
    2.37 +#include "MapAsn1Tests.h"
    2.38  #include "DecorateTests.h"
    2.39 -#include "UserIdCollisionTests.h"
    2.40 -#include "ReencryptPlusExtraKeysTests.h"
    2.41 -#include "BlacklistTests.h"
    2.42 -#include "AppleMailTests.h"
    2.43  #include "MessageTwoPointOhTests.h"
    2.44 -#include "IdentityListTests.h"
    2.45 -#include "I18nTests.h"
    2.46 -#include "Engine463Tests.h"
    2.47 -#include "DecryptAttachPrivateKeyUntrustedTests.h"
    2.48 -#include "BCCTests.h"
    2.49 -#include "LeastColorGroupTests.h"
    2.50 -#include "BlacklistAcceptNewKeyTests.h"
    2.51 -#include "MessageApiTests.h"
    2.52 -#include "StringlistTests.h"
    2.53 +#include "CrashdumpTests.h"
    2.54  #include "StringpairListTests.h"
    2.55 +#include "EncryptForIdentityTests.h"
    2.56 +#include "KeyResetMessageTests.h"
    2.57  #include "TrustManipulationTests.h"
    2.58  #include "SyncTests.h"
    2.59 -#include "EncryptAttachPrivateKeyTests.h"
    2.60 -#include "BloblistTests.h"
    2.61 -#include "KeyResetMessageTests.h"
    2.62 -#include "SequenceTests.h"
    2.63 -#include "TrustwordsTests.h"
    2.64 -#include "RevokeRegenAttachTests.h"
    2.65 -#include "EncryptMissingPrivateKeyTests.h"
    2.66 -#include "PepSubjectReceivedTests.h"
    2.67 -#include "KeyeditTests.h"
    2.68 -#include "MapAsn1Tests.h"
    2.69 -#include "PgpBinaryTests.h"
    2.70 -#include "DecryptAttachPrivateKeyTrustedTests.h"
    2.71 -#include "MessageNullFromTests.h"
    2.72 -#include "MimeTests.h"
    2.73 -#include "PgpListKeysTests.h"
    2.74 -#include "NewUpdateIdAndMyselfTests.h"
    2.75 -#include "EncryptForIdentityTests.h"
    2.76 -#include "CrashdumpTests.h"
    2.77 -#include "CaseAndDotAddressTests.h"
    2.78 -#include "LeastCommonDenomColorTests.h"
    2.79 -#include "ExternalRevokeTests.h"
    2.80 -#include "UserIDAliasTests.h"
    2.81 +#include "AppleMailTests.h"
    2.82  
    2.83  
    2.84  const char* SuiteMaker::all_suites[] = {
    2.85 +    "MimeTests",
    2.86 +    "UserIdCollisionTests",
    2.87 +    "Engine463Tests",
    2.88 +    "BloblistTests",
    2.89 +    "NewUpdateIdAndMyselfTests",
    2.90 +    "I18nTests",
    2.91 +    "IdentityListTests",
    2.92 +    "PgpBinaryTests",
    2.93 +    "MessageNullFromTests",
    2.94 +    "LeastCommonDenomColorTests",
    2.95 +    "StringlistTests",
    2.96 +    "PgpListKeysTests",
    2.97 +    "MessageApiTests",
    2.98 +    "EncryptMissingPrivateKeyTests",
    2.99 +    "CaseAndDotAddressTests",
   2.100 +    "UserIDAliasTests",
   2.101 +    "BCCTests",
   2.102 +    "BlacklistAcceptNewKeyTests",
   2.103 +    "DecryptAttachPrivateKeyUntrustedTests",
   2.104 +    "BlacklistTests",
   2.105 +    "RevokeRegenAttachTests",
   2.106 +    "PepSubjectReceivedTests",
   2.107 +    "SequenceTests",
   2.108 +    "EncryptAttachPrivateKeyTests",
   2.109 +    "ExternalRevokeTests",
   2.110 +    "KeyeditTests",
   2.111 +    "LeastColorGroupTests",
   2.112 +    "DecryptAttachPrivateKeyTrustedTests",
   2.113 +    "TrustwordsTests",
   2.114 +    "ReencryptPlusExtraKeysTests",
   2.115 +    "MapAsn1Tests",
   2.116      "DecorateTests",
   2.117 -    "UserIdCollisionTests",
   2.118 -    "ReencryptPlusExtraKeysTests",
   2.119 -    "BlacklistTests",
   2.120 -    "AppleMailTests",
   2.121      "MessageTwoPointOhTests",
   2.122 -    "IdentityListTests",
   2.123 -    "I18nTests",
   2.124 -    "Engine463Tests",
   2.125 -    "DecryptAttachPrivateKeyUntrustedTests",
   2.126 -    "BCCTests",
   2.127 -    "LeastColorGroupTests",
   2.128 -    "BlacklistAcceptNewKeyTests",
   2.129 -    "MessageApiTests",
   2.130 -    "StringlistTests",
   2.131 +    "CrashdumpTests",
   2.132      "StringpairListTests",
   2.133 +    "EncryptForIdentityTests",
   2.134 +    "KeyResetMessageTests",
   2.135      "TrustManipulationTests",
   2.136      "SyncTests",
   2.137 -    "EncryptAttachPrivateKeyTests",
   2.138 -    "BloblistTests",
   2.139 -    "KeyResetMessageTests",
   2.140 -    "SequenceTests",
   2.141 -    "TrustwordsTests",
   2.142 -    "RevokeRegenAttachTests",
   2.143 -    "EncryptMissingPrivateKeyTests",
   2.144 -    "PepSubjectReceivedTests",
   2.145 -    "KeyeditTests",
   2.146 -    "MapAsn1Tests",
   2.147 -    "PgpBinaryTests",
   2.148 -    "DecryptAttachPrivateKeyTrustedTests",
   2.149 -    "MessageNullFromTests",
   2.150 -    "MimeTests",
   2.151 -    "PgpListKeysTests",
   2.152 -    "NewUpdateIdAndMyselfTests",
   2.153 -    "EncryptForIdentityTests",
   2.154 -    "CrashdumpTests",
   2.155 -    "CaseAndDotAddressTests",
   2.156 -    "LeastCommonDenomColorTests",
   2.157 -    "ExternalRevokeTests",
   2.158 -    "UserIDAliasTests",
   2.159 +    "AppleMailTests",
   2.160  };
   2.161  
   2.162  // This file is generated, so magic constants are ok.
   2.163  int SuiteMaker::num_suites = 40;
   2.164  
   2.165  void SuiteMaker::suitemaker_build(const char* test_class_name, const char* test_home, Test::Suite** test_suite) {
   2.166 -    if (strcmp(test_class_name, "DecorateTests") == 0)
   2.167 -        *test_suite = new DecorateTests(test_class_name, test_home);
   2.168 +    if (strcmp(test_class_name, "MimeTests") == 0)
   2.169 +        *test_suite = new MimeTests(test_class_name, test_home);
   2.170      else if (strcmp(test_class_name, "UserIdCollisionTests") == 0)
   2.171          *test_suite = new UserIdCollisionTests(test_class_name, test_home);
   2.172 +    else if (strcmp(test_class_name, "Engine463Tests") == 0)
   2.173 +        *test_suite = new Engine463Tests(test_class_name, test_home);
   2.174 +    else if (strcmp(test_class_name, "BloblistTests") == 0)
   2.175 +        *test_suite = new BloblistTests(test_class_name, test_home);
   2.176 +    else if (strcmp(test_class_name, "NewUpdateIdAndMyselfTests") == 0)
   2.177 +        *test_suite = new NewUpdateIdAndMyselfTests(test_class_name, test_home);
   2.178 +    else if (strcmp(test_class_name, "I18nTests") == 0)
   2.179 +        *test_suite = new I18nTests(test_class_name, test_home);
   2.180 +    else if (strcmp(test_class_name, "IdentityListTests") == 0)
   2.181 +        *test_suite = new IdentityListTests(test_class_name, test_home);
   2.182 +    else if (strcmp(test_class_name, "PgpBinaryTests") == 0)
   2.183 +        *test_suite = new PgpBinaryTests(test_class_name, test_home);
   2.184 +    else if (strcmp(test_class_name, "MessageNullFromTests") == 0)
   2.185 +        *test_suite = new MessageNullFromTests(test_class_name, test_home);
   2.186 +    else if (strcmp(test_class_name, "LeastCommonDenomColorTests") == 0)
   2.187 +        *test_suite = new LeastCommonDenomColorTests(test_class_name, test_home);
   2.188 +    else if (strcmp(test_class_name, "StringlistTests") == 0)
   2.189 +        *test_suite = new StringlistTests(test_class_name, test_home);
   2.190 +    else if (strcmp(test_class_name, "PgpListKeysTests") == 0)
   2.191 +        *test_suite = new PgpListKeysTests(test_class_name, test_home);
   2.192 +    else if (strcmp(test_class_name, "MessageApiTests") == 0)
   2.193 +        *test_suite = new MessageApiTests(test_class_name, test_home);
   2.194 +    else if (strcmp(test_class_name, "EncryptMissingPrivateKeyTests") == 0)
   2.195 +        *test_suite = new EncryptMissingPrivateKeyTests(test_class_name, test_home);
   2.196 +    else if (strcmp(test_class_name, "CaseAndDotAddressTests") == 0)
   2.197 +        *test_suite = new CaseAndDotAddressTests(test_class_name, test_home);
   2.198 +    else if (strcmp(test_class_name, "UserIDAliasTests") == 0)
   2.199 +        *test_suite = new UserIDAliasTests(test_class_name, test_home);
   2.200 +    else if (strcmp(test_class_name, "BCCTests") == 0)
   2.201 +        *test_suite = new BCCTests(test_class_name, test_home);
   2.202 +    else if (strcmp(test_class_name, "BlacklistAcceptNewKeyTests") == 0)
   2.203 +        *test_suite = new BlacklistAcceptNewKeyTests(test_class_name, test_home);
   2.204 +    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyUntrustedTests") == 0)
   2.205 +        *test_suite = new DecryptAttachPrivateKeyUntrustedTests(test_class_name, test_home);
   2.206 +    else if (strcmp(test_class_name, "BlacklistTests") == 0)
   2.207 +        *test_suite = new BlacklistTests(test_class_name, test_home);
   2.208 +    else if (strcmp(test_class_name, "RevokeRegenAttachTests") == 0)
   2.209 +        *test_suite = new RevokeRegenAttachTests(test_class_name, test_home);
   2.210 +    else if (strcmp(test_class_name, "PepSubjectReceivedTests") == 0)
   2.211 +        *test_suite = new PepSubjectReceivedTests(test_class_name, test_home);
   2.212 +    else if (strcmp(test_class_name, "SequenceTests") == 0)
   2.213 +        *test_suite = new SequenceTests(test_class_name, test_home);
   2.214 +    else if (strcmp(test_class_name, "EncryptAttachPrivateKeyTests") == 0)
   2.215 +        *test_suite = new EncryptAttachPrivateKeyTests(test_class_name, test_home);
   2.216 +    else if (strcmp(test_class_name, "ExternalRevokeTests") == 0)
   2.217 +        *test_suite = new ExternalRevokeTests(test_class_name, test_home);
   2.218 +    else if (strcmp(test_class_name, "KeyeditTests") == 0)
   2.219 +        *test_suite = new KeyeditTests(test_class_name, test_home);
   2.220 +    else if (strcmp(test_class_name, "LeastColorGroupTests") == 0)
   2.221 +        *test_suite = new LeastColorGroupTests(test_class_name, test_home);
   2.222 +    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyTrustedTests") == 0)
   2.223 +        *test_suite = new DecryptAttachPrivateKeyTrustedTests(test_class_name, test_home);
   2.224 +    else if (strcmp(test_class_name, "TrustwordsTests") == 0)
   2.225 +        *test_suite = new TrustwordsTests(test_class_name, test_home);
   2.226      else if (strcmp(test_class_name, "ReencryptPlusExtraKeysTests") == 0)
   2.227          *test_suite = new ReencryptPlusExtraKeysTests(test_class_name, test_home);
   2.228 -    else if (strcmp(test_class_name, "BlacklistTests") == 0)
   2.229 -        *test_suite = new BlacklistTests(test_class_name, test_home);
   2.230 -    else if (strcmp(test_class_name, "AppleMailTests") == 0)
   2.231 -        *test_suite = new AppleMailTests(test_class_name, test_home);
   2.232 +    else if (strcmp(test_class_name, "MapAsn1Tests") == 0)
   2.233 +        *test_suite = new MapAsn1Tests(test_class_name, test_home);
   2.234 +    else if (strcmp(test_class_name, "DecorateTests") == 0)
   2.235 +        *test_suite = new DecorateTests(test_class_name, test_home);
   2.236      else if (strcmp(test_class_name, "MessageTwoPointOhTests") == 0)
   2.237          *test_suite = new MessageTwoPointOhTests(test_class_name, test_home);
   2.238 -    else if (strcmp(test_class_name, "IdentityListTests") == 0)
   2.239 -        *test_suite = new IdentityListTests(test_class_name, test_home);
   2.240 -    else if (strcmp(test_class_name, "I18nTests") == 0)
   2.241 -        *test_suite = new I18nTests(test_class_name, test_home);
   2.242 -    else if (strcmp(test_class_name, "Engine463Tests") == 0)
   2.243 -        *test_suite = new Engine463Tests(test_class_name, test_home);
   2.244 -    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyUntrustedTests") == 0)
   2.245 -        *test_suite = new DecryptAttachPrivateKeyUntrustedTests(test_class_name, test_home);
   2.246 -    else if (strcmp(test_class_name, "BCCTests") == 0)
   2.247 -        *test_suite = new BCCTests(test_class_name, test_home);
   2.248 -    else if (strcmp(test_class_name, "LeastColorGroupTests") == 0)
   2.249 -        *test_suite = new LeastColorGroupTests(test_class_name, test_home);
   2.250 -    else if (strcmp(test_class_name, "BlacklistAcceptNewKeyTests") == 0)
   2.251 -        *test_suite = new BlacklistAcceptNewKeyTests(test_class_name, test_home);
   2.252 -    else if (strcmp(test_class_name, "MessageApiTests") == 0)
   2.253 -        *test_suite = new MessageApiTests(test_class_name, test_home);
   2.254 -    else if (strcmp(test_class_name, "StringlistTests") == 0)
   2.255 -        *test_suite = new StringlistTests(test_class_name, test_home);
   2.256 +    else if (strcmp(test_class_name, "CrashdumpTests") == 0)
   2.257 +        *test_suite = new CrashdumpTests(test_class_name, test_home);
   2.258      else if (strcmp(test_class_name, "StringpairListTests") == 0)
   2.259          *test_suite = new StringpairListTests(test_class_name, test_home);
   2.260 +    else if (strcmp(test_class_name, "EncryptForIdentityTests") == 0)
   2.261 +        *test_suite = new EncryptForIdentityTests(test_class_name, test_home);
   2.262 +    else if (strcmp(test_class_name, "KeyResetMessageTests") == 0)
   2.263 +        *test_suite = new KeyResetMessageTests(test_class_name, test_home);
   2.264      else if (strcmp(test_class_name, "TrustManipulationTests") == 0)
   2.265          *test_suite = new TrustManipulationTests(test_class_name, test_home);
   2.266      else if (strcmp(test_class_name, "SyncTests") == 0)
   2.267          *test_suite = new SyncTests(test_class_name, test_home);
   2.268 -    else if (strcmp(test_class_name, "EncryptAttachPrivateKeyTests") == 0)
   2.269 -        *test_suite = new EncryptAttachPrivateKeyTests(test_class_name, test_home);
   2.270 -    else if (strcmp(test_class_name, "BloblistTests") == 0)
   2.271 -        *test_suite = new BloblistTests(test_class_name, test_home);
   2.272 -    else if (strcmp(test_class_name, "KeyResetMessageTests") == 0)
   2.273 -        *test_suite = new KeyResetMessageTests(test_class_name, test_home);
   2.274 -    else if (strcmp(test_class_name, "SequenceTests") == 0)
   2.275 -        *test_suite = new SequenceTests(test_class_name, test_home);
   2.276 -    else if (strcmp(test_class_name, "TrustwordsTests") == 0)
   2.277 -        *test_suite = new TrustwordsTests(test_class_name, test_home);
   2.278 -    else if (strcmp(test_class_name, "RevokeRegenAttachTests") == 0)
   2.279 -        *test_suite = new RevokeRegenAttachTests(test_class_name, test_home);
   2.280 -    else if (strcmp(test_class_name, "EncryptMissingPrivateKeyTests") == 0)
   2.281 -        *test_suite = new EncryptMissingPrivateKeyTests(test_class_name, test_home);
   2.282 -    else if (strcmp(test_class_name, "PepSubjectReceivedTests") == 0)
   2.283 -        *test_suite = new PepSubjectReceivedTests(test_class_name, test_home);
   2.284 -    else if (strcmp(test_class_name, "KeyeditTests") == 0)
   2.285 -        *test_suite = new KeyeditTests(test_class_name, test_home);
   2.286 -    else if (strcmp(test_class_name, "MapAsn1Tests") == 0)
   2.287 -        *test_suite = new MapAsn1Tests(test_class_name, test_home);
   2.288 -    else if (strcmp(test_class_name, "PgpBinaryTests") == 0)
   2.289 -        *test_suite = new PgpBinaryTests(test_class_name, test_home);
   2.290 -    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyTrustedTests") == 0)
   2.291 -        *test_suite = new DecryptAttachPrivateKeyTrustedTests(test_class_name, test_home);
   2.292 -    else if (strcmp(test_class_name, "MessageNullFromTests") == 0)
   2.293 -        *test_suite = new MessageNullFromTests(test_class_name, test_home);
   2.294 -    else if (strcmp(test_class_name, "MimeTests") == 0)
   2.295 -        *test_suite = new MimeTests(test_class_name, test_home);
   2.296 -    else if (strcmp(test_class_name, "PgpListKeysTests") == 0)
   2.297 -        *test_suite = new PgpListKeysTests(test_class_name, test_home);
   2.298 -    else if (strcmp(test_class_name, "NewUpdateIdAndMyselfTests") == 0)
   2.299 -        *test_suite = new NewUpdateIdAndMyselfTests(test_class_name, test_home);
   2.300 -    else if (strcmp(test_class_name, "EncryptForIdentityTests") == 0)
   2.301 -        *test_suite = new EncryptForIdentityTests(test_class_name, test_home);
   2.302 -    else if (strcmp(test_class_name, "CrashdumpTests") == 0)
   2.303 -        *test_suite = new CrashdumpTests(test_class_name, test_home);
   2.304 -    else if (strcmp(test_class_name, "CaseAndDotAddressTests") == 0)
   2.305 -        *test_suite = new CaseAndDotAddressTests(test_class_name, test_home);
   2.306 -    else if (strcmp(test_class_name, "LeastCommonDenomColorTests") == 0)
   2.307 -        *test_suite = new LeastCommonDenomColorTests(test_class_name, test_home);
   2.308 -    else if (strcmp(test_class_name, "ExternalRevokeTests") == 0)
   2.309 -        *test_suite = new ExternalRevokeTests(test_class_name, test_home);
   2.310 -    else if (strcmp(test_class_name, "UserIDAliasTests") == 0)
   2.311 -        *test_suite = new UserIDAliasTests(test_class_name, test_home);
   2.312 +    else if (strcmp(test_class_name, "AppleMailTests") == 0)
   2.313 +        *test_suite = new AppleMailTests(test_class_name, test_home);
   2.314  }
   2.315  
   2.316  void SuiteMaker::suitemaker_buildlist(const char** test_class_names, int num_to_run, const char* test_home, std::vector<Test::Suite*>& test_suites) {
     3.1 --- a/test/src/engine_tests/SyncTests.cc	Mon Oct 22 10:40:15 2018 +0200
     3.2 +++ b/test/src/engine_tests/SyncTests.cc	Wed Oct 24 15:25:01 2018 +0200
     3.3 @@ -96,6 +96,8 @@
     3.4  
     3.5      for (bloblist_t *b = msg->attachments; b && b->value; b = b->next) {
     3.6          if (b->mime_type && strcasecmp(b->mime_type, "application/pEp.sync") == 0) {
     3.7 +            assert(msg->from && msg->from->address && msg->from->username);
     3.8 +            cout << msg->from->username << " <" << msg->from->address << ">\n";
     3.9              char *text = NULL;
    3.10              PEP_STATUS status = PER_to_XER_Sync_msg(msg->attachments->value, msg->attachments->size, &text);
    3.11              assert(status == PEP_STATUS_OK);