Fix validation of --verify argument using detached sig.

hotfix/pin-psutil-version
drebs 2013-10-24 18:05:18 -02:00
parent 2c0c826c0f
commit 2f60144ad9
2 changed files with 9 additions and 5 deletions

View File

@ -298,7 +298,7 @@ def _sanitise(*args):
values = value.split(' ')
for v in values:
## these can be handled separately, without _fix_unsafe(),
## because they are only allowed if the pass the regex
## because they are only allowed if they pass the regex
if (flag in none_options) and (v is None):
continue
@ -332,8 +332,11 @@ def _sanitise(*args):
if flag in ['--encrypt', '--encrypt-files', '--decrypt',
'--decrypt-files', '--import', '--verify']:
if _util._is_file(val): checked += (val + " ")
else: log.debug("%s not file: %s" % (flag, val))
if _util._is_file(val) or \
(flag == '--verify' and val == '-'):
checked += (val + " ")
else:
log.debug("%s not file: %s" % (flag, val))
elif flag in ['--cipher-algo', '--personal-cipher-prefs',
'--personal-cipher-preferences']:
@ -372,7 +375,8 @@ def _sanitise(*args):
groups[last] = str(filo.pop())
## accept the read-from-stdin arg:
if len(filo) >= 1 and filo[len(filo)-1] == '-':
groups[last] += str(' - \'\'') ## gross hack
groups[last] += str(' - ') ## gross hack
filo.pop()
else:
groups[last] = str()
while len(filo) > 1 and not is_flag(filo[len(filo)-1]):

View File

@ -308,7 +308,7 @@ class GPG(GPGBase):
sig_fh = None
try:
sig_fh = open(sig_file)
args = ["--verify %s - " % sig_fh.name]
args = ["--verify %s -" % sig_fh.name]
proc = self._open_subprocess(args)
writer = _util._threaded_copy_data(file, proc.stdin)
self._collect_output(proc, result, stdin=proc.stdin)