# HG changeset patch # User Chris Cannam # Date 1541169591 0 # Node ID dd193244d97d9588cfb5de56117200026ed321f0 # Parent 5f91094e5680d133b620b5246567f777cc15ca37 Remove newlines from error messages; try to do something sensible with security errors diff -r 5f91094e5680 -r dd193244d97d checker/checkcode.h --- a/checker/checkcode.h Thu Oct 11 15:55:17 2018 +0100 +++ b/checker/checkcode.h Fri Nov 02 14:39:51 2018 +0000 @@ -53,25 +53,30 @@ */ FAIL_DEPENDENCY_MISSING = 3, + /** Plugin library loading was refused for some security-related + * reason + */ + FAIL_FORBIDDEN = 4, + /** Plugin library cannot be loaded for some other reason */ - FAIL_NOT_LOADABLE = 4, + FAIL_NOT_LOADABLE = 5, /** Plugin library can be loaded, but the expected plugin * descriptor symbol is missing */ - FAIL_DESCRIPTOR_MISSING = 5, + FAIL_DESCRIPTOR_MISSING = 6, /** Plugin library can be loaded and descriptor called, but no * plugins are found in it */ - FAIL_NO_PLUGINS = 6, + FAIL_NO_PLUGINS = 7, /** Failure but no meaningful error code provided, or failure * read from an older helper version that did not support * error codes */ - FAIL_OTHER = 7 + FAIL_OTHER = 999 }; #endif diff -r 5f91094e5680 -r dd193244d97d src/helper.cpp --- a/src/helper.cpp Thu Oct 11 15:55:17 2018 +0100 +++ b/src/helper.cpp Fri Nov 02 14:39:51 2018 +0000 @@ -253,6 +253,12 @@ #else if (!libraryExists(soname)) { code = PluginCheckCode::FAIL_LIBRARY_NOT_FOUND; + } else if (errno == EPERM) { + // This may be unreliable, but it seems to be set by + // something dlopen() calls in the case where a library + // can't be loaded for code-signing-related reasons on + // macOS + code = PluginCheckCode::FAIL_FORBIDDEN; } #endif return { code, message }; @@ -375,6 +381,12 @@ cout << "FAILURE|" << soname << "|[" << int(result.code) << "]" << endl; } else { + for (size_t i = 0; i < result.message.size(); ++i) { + if (result.message[i] == '\n' || + result.message[i] == '\r') { + result.message[i] = ' '; + } + } cout << "FAILURE|" << soname << "|" << result.message << " [" << int(result.code) << "]" << endl; diff -r 5f91094e5680 -r dd193244d97d version.h --- a/version.h Thu Oct 11 15:55:17 2018 +0100 +++ b/version.h Fri Nov 02 14:39:51 2018 +0000 @@ -1,1 +1,1 @@ -#define CHECKER_COMPATIBILITY_VERSION "3" +#define CHECKER_COMPATIBILITY_VERSION "4"