]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Replace WITH_OPENSSL ifdefs in log calls with a macro.
authordtucker@openbsd.org <dtucker@openbsd.org>
Sun, 8 Nov 2020 11:46:12 +0000 (11:46 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Sun, 8 Nov 2020 13:02:27 +0000 (00:02 +1100)
The log calls are themselves now macros, and preprocessor directives inside
macro arguments are undefined behaviour which some compilers (eg old GCCs)
choke on.  It also makes the code tidier.  ok deraadt@

OpenBSD-Commit-ID: cc12a9029833d222043aecd252d654965c351a69

ssh.c
sshd.c
sshkey.h

diff --git a/ssh.c b/ssh.c
index 7a10813727ca31f7ef00d3994e34c03ae55014fc..85c6e6c55e18522e860401f197088f17a02aa820 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.540 2020/10/18 11:32:02 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.541 2020/11/08 11:46:12 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -893,13 +893,7 @@ main(int ac, char **av)
                        break;
                case 'V':
                        fprintf(stderr, "%s, %s\n",
-                           SSH_RELEASE,
-#ifdef WITH_OPENSSL
-                           OpenSSL_version(OPENSSL_VERSION)
-#else
-                           "without OpenSSL"
-#endif
-                       );
+                           SSH_RELEASE, SSH_OPENSSL_VERSION);
                        if (opt == 'V')
                                exit(0);
                        break;
@@ -1160,13 +1154,7 @@ main(int ac, char **av)
            !use_syslog);
 
        if (debug_flag)
-               logit("%s, %s", SSH_RELEASE,
-#ifdef WITH_OPENSSL
-                   OpenSSL_version(OPENSSL_VERSION)
-#else
-                   "without OpenSSL"
-#endif
-               );
+               logit("%s, %s", SSH_RELEASE, SSH_OPENSSL_VERSION);
 
        /* Parse the configuration files */
        process_config_files(host_arg, pw, 0, &want_final_pass);
diff --git a/sshd.c b/sshd.c
index bdb9c957baa869837d9e6577760d632f5c555c05..173fadd86c56de538f178d41b4d574746442ab7e 100644 (file)
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.564 2020/10/18 11:32:02 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.565 2020/11/08 11:46:12 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -906,14 +906,7 @@ drop_connection(int sock, int startups)
 static void
 usage(void)
 {
-       fprintf(stderr, "%s, %s\n",
-           SSH_RELEASE,
-#ifdef WITH_OPENSSL
-           OpenSSL_version(OPENSSL_VERSION)
-#else
-           "without OpenSSL"
-#endif
-       );
+       fprintf(stderr, "%s, %s\n", SSH_RELEASE, SSH_OPENSSL_VERSION);
        fprintf(stderr,
 "usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n"
 "            [-E log_file] [-f config_file] [-g login_grace_time]\n"
@@ -1772,13 +1765,7 @@ main(int ac, char **av)
                exit(1);
        }
 
-       debug("sshd version %s, %s", SSH_VERSION,
-#ifdef WITH_OPENSSL
-           OpenSSL_version(OPENSSL_VERSION)
-#else
-           "without OpenSSL"
-#endif
-       );
+       debug("sshd version %s, %s", SSH_VERSION, SSH_OPENSSL_VERSION);
 
        /* Store privilege separation user for later use if required. */
        privsep_chroot = use_privsep && (getuid() == 0 || geteuid() == 0);
index 6d162264b36999adfcae358e32c74cbe79da96c0..702d919017511f9bc76d7ee6087a6b7cc356b663 100644 (file)
--- a/sshkey.h
+++ b/sshkey.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.h,v 1.47 2020/10/19 22:49:23 dtucker Exp $ */
+/* $OpenBSD: sshkey.h,v 1.48 2020/11/08 11:46:12 dtucker Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
@@ -39,6 +39,7 @@
 #  define EC_GROUP     void
 #  define EC_POINT     void
 # endif /* OPENSSL_HAS_ECC */
+#define SSH_OPENSSL_VERSION OpenSSL_version(OPENSSL_VERSION)
 #else /* WITH_OPENSSL */
 # define BIGNUM                void
 # define RSA           void
@@ -46,6 +47,7 @@
 # define EC_KEY                void
 # define EC_GROUP      void
 # define EC_POINT      void
+#define SSH_OPENSSL_VERSION "without OpenSSL"
 #endif /* WITH_OPENSSL */
 
 #define SSH_RSA_MINIMUM_MODULUS_SIZE   1024