allow non-email in find_keys (grrrr) ENGINE-434
authorKrista Bennett <krista@pep-project.org>
Tue, 22 May 2018 09:35:15 +0200
branchENGINE-434
changeset 2680b6f5a8fb2219
parent 2679 567462e5b11a
child 2684 a5175dd76542
allow non-email in find_keys (grrrr)
src/pgp_gpg.c
     1.1 --- a/src/pgp_gpg.c	Tue May 22 09:33:43 2018 +0200
     1.2 +++ b/src/pgp_gpg.c	Tue May 22 09:35:15 2018 +0200
     1.3 @@ -1830,8 +1830,6 @@
     1.4      return PEP_STATUS_OK;
     1.5  }
     1.6  
     1.7 -
     1.8 -
     1.9  static PEP_STATUS _pgp_search_keys(PEP_SESSION session, const char* pattern,
    1.10                              stringlist_t** keylist,
    1.11                              int private_only) {
    1.12 @@ -1876,8 +1874,9 @@
    1.13                  // check that at least one uid's email matches pattern exactly,
    1.14                  // modulo the email-diff heuristic
    1.15                  while(kuid) {
    1.16 -                    if((pattern && kuid->email && _email_heuristic_match(kuid->email, pattern)) ||
    1.17 -                       pattern == NULL /* match all */ )
    1.18 +                    if((pattern == NULL) ||
    1.19 +                       (strstr(pattern, "@") == NULL) || // not an email
    1.20 +                       (kuid->email && _email_heuristic_match(kuid->email, pattern)))
    1.21                      { 
    1.22                          char *fpr = key->subkeys->fpr;
    1.23                          assert(fpr);