Signatures: No terminal raises NeedPassphrase
Update the Key model's sign_file method to raise the NeedPassphrase exception when GPG has no terminal available and not just when the GPG backend specifically asks for a passphrase. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
@@ -187,6 +187,8 @@
|
||||
"methods.py".
|
||||
- The PropertyHelper class has been removed as the accessors
|
||||
no longer need it.
|
||||
- Raise the NeedPassphrase exception when GPG has no terminal
|
||||
available.
|
||||
|
||||
3.1.9 (2018-11-01)
|
||||
==================
|
||||
|
||||
@@ -13,6 +13,7 @@ DEFAULT_SETTING_GPG_BACKEND = 'mayan.apps.django_gpg.classes.PythonGNUPGBackend'
|
||||
|
||||
ERROR_MSG_BAD_PASSPHRASE = 'BAD_PASSPHRASE'
|
||||
ERROR_MSG_MISSING_PASSPHRASE = 'MISSING_PASSPHRASE'
|
||||
ERROR_MSG_NO_TERMINAL = 'Sorry, no terminal at all requested - can\'t get input'
|
||||
|
||||
KEY_TYPES = {
|
||||
'pub': _('Public'),
|
||||
|
||||
@@ -12,7 +12,8 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from .exceptions import NeedPassphrase, PassphraseError
|
||||
from .literals import (
|
||||
ERROR_MSG_BAD_PASSPHRASE, ERROR_MSG_MISSING_PASSPHRASE,
|
||||
KEY_TYPE_CHOICES, KEY_TYPE_SECRET, OUTPUT_MESSAGE_CONTAINS_PRIVATE_KEY
|
||||
ERROR_MSG_NO_TERMINAL, KEY_TYPE_CHOICES, KEY_TYPE_SECRET,
|
||||
OUTPUT_MESSAGE_CONTAINS_PRIVATE_KEY
|
||||
)
|
||||
from .managers import KeyManager
|
||||
from .runtime import gpg_backend
|
||||
@@ -123,7 +124,7 @@ class Key(models.Model):
|
||||
|
||||
logger.debug('file_sign_results.stderr: %s', file_sign_results.stderr)
|
||||
|
||||
if ERROR_MSG_MISSING_PASSPHRASE in file_sign_results.stderr:
|
||||
if ERROR_MSG_MISSING_PASSPHRASE in file_sign_results.stderr or ERROR_MSG_NO_TERMINAL in file_sign_results.stderr:
|
||||
raise NeedPassphrase
|
||||
|
||||
if ERROR_MSG_BAD_PASSPHRASE in file_sign_results.stderr:
|
||||
|
||||
Reference in New Issue
Block a user