If any fail, return nonzero in sshwot-verify

This commit is contained in:
Juhani Krekelä 2018-09-02 15:16:01 +03:00
parent af2d8413f7
commit 5f0d8e8d2d
1 changed files with 5 additions and 2 deletions

View File

@ -79,6 +79,7 @@ def main():
# Check
any_verified = False
any_failed = False
for path in infiles:
# Remove the directory and the extension from the file
name = os.path.basename(path)
@ -92,6 +93,8 @@ def main():
if len(success) > 0:
any_verified = True
if len(fail) > 0:
any_fail = True
for match_host, match_port, match_comment in success:
# Use for display the same normalzed format as internally
@ -117,8 +120,8 @@ def main():
for _, _, same_fingerprint_comment in same_fingerprint:
print('[same fingerprint] %s: (unknown host): %s' % (name, same_fingerprint_comment))
# Exit with 0 only if it was verified
if any_verified:
# Exit with 0 only if it was verified and didn't fail
if any_verified and not any_fail:
sys.exit(0)
else:
sys.exit(2)