diff options
author | Alexander Færøy <ahf@torproject.org> | 2017-04-20 16:23:06 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-04-25 08:10:10 -0400 |
commit | c2d1d949dec1db9fb413a02be422dfede3bb53aa (patch) | |
tree | 4ad2a4926952afe396fa8aaef516e4d3c29de7dc /src/or/main.c | |
parent | 6b905b38bb850d0530ba6f6d02c10b1fb19aef9a (diff) | |
download | tor-c2d1d949dec1db9fb413a02be422dfede3bb53aa.tar.gz tor-c2d1d949dec1db9fb413a02be422dfede3bb53aa.zip |
Use `tor_compress_supports_method()` before printing library versions.
This patch ensures that Tor checks if a given compression method is
supported before printing the version string when calling `tor
--library-versions`.
Additionally, we use the `tor_compress_supports_method()` to check if a
given version is supported for Tor's start-up version string, but here
we print "N/A" if a given compression method is unavailable.
See: https://bugs.torproject.org/21662
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/or/main.c b/src/or/main.c index f3a0d84aea..1ba6554d3e 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -58,9 +58,7 @@ #include "circuitlist.h" #include "circuituse.h" #include "command.h" -#include "compress_lzma.h" -#include "compress_zlib.h" -#include "compress_zstd.h" +#include "compress.h" #include "config.h" #include "confparse.h" #include "connection.h" @@ -3005,9 +3003,12 @@ tor_init(int argc, char *argv[]) get_uname(), tor_libevent_get_version_str(), crypto_openssl_get_version_str(), - tor_zlib_get_version_str(), - tor_lzma_get_version_str(), - tor_zstd_get_version_str()); + tor_compress_supports_method(ZLIB_METHOD) ? + tor_compress_version_str(ZLIB_METHOD) : "N/A", + tor_compress_supports_method(LZMA_METHOD) ? + tor_compress_version_str(LZMA_METHOD) : "N/A", + tor_compress_supports_method(ZSTD_METHOD) ? + tor_compress_version_str(ZSTD_METHOD) : "N/A"); log_notice(LD_GENERAL, "Tor can't help you if you use it wrong! " "Learn how to be safe at " |