ENGINE-221: hoorah - kludgey stuff that may have messed up 2.0.30 w/ gpgme 1.6.0 removed. gnupg-2.1
authorKrista Bennett <krista@pep-project.org>
Sun, 16 Jul 2017 20:50:00 +0200
branchgnupg-2.1
changeset 1927635015dfafd5
parent 1926 a6b1bf1c52a1
child 1929 bad90979fd7e
ENGINE-221: hoorah - kludgey stuff that may have messed up 2.0.30 w/ gpgme 1.6.0 removed.
src/pgp_gpg.c
     1.1 --- a/src/pgp_gpg.c	Sun Jul 16 20:00:33 2017 +0200
     1.2 +++ b/src/pgp_gpg.c	Sun Jul 16 20:50:00 2017 +0200
     1.3 @@ -1123,21 +1123,14 @@
     1.4  #ifdef GPGME_VERSION_NUMBER 
     1.5  #if (GPGME_VERSION_NUMBER >= 0x010700)
     1.6          gpgme_error_t gpgme_error;
     1.7 -        /* "name <address>" adds 3 chars + NUL */
     1.8          int userid_size = strlen(identity->address) + 1;
     1.9 -        /* int userid_size = strlen(identity->username) + strlen(identity->address) + 4; */
    1.10          char* userid = (char*)(calloc(1, userid_size));
    1.11          if (!userid)
    1.12              return PEP_OUT_OF_MEMORY;
    1.13 -        /* sprintf... so tempting... */    
    1.14 -//        strlcpy(userid, identity->username, userid_size);
    1.15 -//        strlcat(userid, " <", userid_size);
    1.16          strlcpy(userid, identity->address, userid_size);
    1.17 -//        strlcat(userid, identity->address, userid_size);
    1.18 -//        strlcat(userid, ">", userid_size);
    1.19          gpgme_error = gpg.gpgme_op_createkey(session->ctx, userid, "RSA", 
    1.20                                               0, 31536000, NULL, 
    1.21 -                                             GPGME_CREATE_NOPASSWD);
    1.22 +                                             GPGME_CREATE_NOPASSWD | GPGME_CREATE_FORCE);
    1.23          gpgme_error = _GPGERR(gpgme_error);
    1.24  
    1.25          free(userid);
    1.26 @@ -1200,13 +1193,6 @@
    1.27      return status;
    1.28  }
    1.29  
    1.30 -static gpgme_error_t bypass_passphrase(void *hook, 
    1.31 -	const char *uid_hint, const char *passphrase_info, 
    1.32 -	int prev_was_bad, int fd) {
    1.33 -    gpg.gpgme_io_write(fd, "\n", 1);
    1.34 -    return GPG_ERR_NO_ERROR;
    1.35 -}
    1.36 -
    1.37  PEP_STATUS pgp_generate_keypair(
    1.38      PEP_SESSION session, pEp_identity *identity
    1.39      )
    1.40 @@ -1250,9 +1236,6 @@
    1.41          return PEP_BUFFER_TOO_SMALL;
    1.42      }
    1.43  
    1.44 -    /* if this is not implemented, we ignore the error and deal with the passphrase dialog */
    1.45 -    gpgme_error = gpg.gpgme_set_passphrase_cb(session->ctx, bypass_passphrase, NULL);
    1.46 -
    1.47      gpgme_error = gpg.gpgme_op_genkey(session->ctx, parms, NULL, NULL);
    1.48      gpgme_error = _GPGERR(gpgme_error);
    1.49      free(parms);
    1.50 @@ -1273,8 +1256,6 @@
    1.51      assert(gpgme_genkey_result);
    1.52      assert(gpgme_genkey_result->fpr);
    1.53  
    1.54 -    gpgme_error = gpg.gpgme_set_passphrase_cb(session->ctx, NULL, NULL);
    1.55 -
    1.56      free(identity->fpr);
    1.57      identity->fpr = strdup(gpgme_genkey_result->fpr);
    1.58      if (identity->fpr == NULL)