ENGINE-209: merged in default ENGINE-209
authorKrista Bennett <krista@pep-project.org>
Wed, 31 May 2017 15:52:30 +0200
branchENGINE-209
changeset 18100beaab16a32c
parent 1808 121361c60644
parent 1809 54a7d37790b9
child 1811 04d2a7abcfa2
ENGINE-209: merged in default
src/pEpEngine.h
     1.1 --- a/src/message_api.c	Mon May 29 11:08:13 2017 +0200
     1.2 +++ b/src/message_api.c	Wed May 31 15:52:30 2017 +0200
     1.3 @@ -1503,7 +1503,10 @@
     1.4      if (!end_boundary)
     1.5          return PEP_UNKNOWN_ERROR;
     1.6  
     1.7 -    end_boundary--; // See RFC3156 section 5... FIXME: could be 2? CRLF?
     1.8 +    // See RFC3156 section 5...
     1.9 +    end_boundary--; 
    1.10 +    if (*(end_boundary - 1) == '\r')
    1.11 +        end_boundary--; 
    1.12  
    1.13      *ssize = end_boundary - start_boundary;
    1.14      *stext = start_boundary;
     2.1 --- a/src/pEpEngine.h	Mon May 29 11:08:13 2017 +0200
     2.2 +++ b/src/pEpEngine.h	Wed May 31 15:52:30 2017 +0200
     2.3 @@ -46,6 +46,7 @@
     2.4      PEP_KEY_HAS_AMBIG_NAME                          = 0x0202,
     2.5      PEP_GET_KEY_FAILED                              = 0x0203,
     2.6      PEP_CANNOT_EXPORT_KEY                           = 0x0204,
     2.7 +    PEP_CANNOT_EDIT_KEY                             = 0x0205,
     2.8      
     2.9      PEP_CANNOT_FIND_IDENTITY                        = 0x0301,
    2.10      PEP_CANNOT_SET_PERSON                           = 0x0381,
     3.1 --- a/src/pgp_gpg.c	Mon May 29 11:08:13 2017 +0200
     3.2 +++ b/src/pgp_gpg.c	Wed May 31 15:52:30 2017 +0200
     3.3 @@ -39,8 +39,7 @@
     3.4          assert(length == stringlist_length(values));
     3.5          if (!(length == stringlist_length(values) &&
     3.6                length <= sizeof(unsigned int) * CHAR_BIT)) {
     3.7 -            r = Fclose(f);
     3.8 -            assert(r == 0);
     3.9 +            Fclose(f);
    3.10  
    3.11              return false;
    3.12          }
    3.13 @@ -62,6 +61,8 @@
    3.14  
    3.15                          if (i == n) {
    3.16                              r = Fclose(f);
    3.17 +                            if (r != 0)
    3.18 +                                return false;
    3.19                              return true;
    3.20                          }
    3.21                      }
    3.22 @@ -83,11 +84,15 @@
    3.23          if ((found & i) == 0) {
    3.24              r = Fprintf(f, "%s %s\n", _k->value, _v->value);
    3.25              assert(r >= 0);
    3.26 +            if(r<0)
    3.27 +                return false;
    3.28          }
    3.29      }
    3.30  
    3.31      r = Fclose(f);
    3.32      assert(r == 0);
    3.33 +    if (r != 0)
    3.34 +        return false;
    3.35  
    3.36      return true;
    3.37  }
    3.38 @@ -1352,6 +1357,8 @@
    3.39  
    3.40      reading = gpg.gpgme_data_read(dh, buffer, _size);
    3.41      assert(_size == reading);
    3.42 +    if(_size != reading)
    3.43 +        return PEP_CANNOT_EXPORT_KEY;
    3.44  
    3.45      // safeguard for the naive user
    3.46      buffer[_size] = 0;
    3.47 @@ -1940,11 +1947,14 @@
    3.48      gpgme_error = gpg.gpgme_op_edit(session->ctx, key, renew_fsm, &handle,
    3.49              output);
    3.50      assert(gpgme_error == GPG_ERR_NO_ERROR);
    3.51 +    if(gpgme_error != GPG_ERR_NO_ERROR) {
    3.52 +        status = PEP_CANNOT_EDIT_KEY;
    3.53 +    }
    3.54  
    3.55      gpg.gpgme_data_release(output);
    3.56      gpg.gpgme_key_unref(key);
    3.57  
    3.58 -    return PEP_STATUS_OK;
    3.59 +    return status;
    3.60  }
    3.61  
    3.62  typedef struct _revoke_state {
    3.63 @@ -2127,11 +2137,14 @@
    3.64      gpgme_error = gpg.gpgme_op_edit(session->ctx, key, revoke_fsm, &handle,
    3.65              output);
    3.66      assert(gpgme_error == GPG_ERR_NO_ERROR);
    3.67 +    if(gpgme_error != GPG_ERR_NO_ERROR) {
    3.68 +        status = PEP_CANNOT_EDIT_KEY;
    3.69 +    }
    3.70  
    3.71      gpg.gpgme_data_release(output);
    3.72      gpg.gpgme_key_unref(key);
    3.73  
    3.74 -    return PEP_STATUS_OK;
    3.75 +    return status;
    3.76  }
    3.77  
    3.78  PEP_STATUS pgp_key_expired(