upstream: Replace WITH_OPENSSL ifdefs in log calls with a macro.

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
This commit is contained in:
dtucker@openbsd.org 2020-11-08 11:46:12 +00:00 committed by Darren Tucker
parent 6d2564b94e
commit 4d94b031ff
3 changed files with 9 additions and 32 deletions

18
ssh.c
View File

@ -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> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -893,13 +893,7 @@ main(int ac, char **av)
break; break;
case 'V': case 'V':
fprintf(stderr, "%s, %s\n", fprintf(stderr, "%s, %s\n",
SSH_RELEASE, SSH_RELEASE, SSH_OPENSSL_VERSION);
#ifdef WITH_OPENSSL
OpenSSL_version(OPENSSL_VERSION)
#else
"without OpenSSL"
#endif
);
if (opt == 'V') if (opt == 'V')
exit(0); exit(0);
break; break;
@ -1160,13 +1154,7 @@ main(int ac, char **av)
!use_syslog); !use_syslog);
if (debug_flag) if (debug_flag)
logit("%s, %s", SSH_RELEASE, logit("%s, %s", SSH_RELEASE, SSH_OPENSSL_VERSION);
#ifdef WITH_OPENSSL
OpenSSL_version(OPENSSL_VERSION)
#else
"without OpenSSL"
#endif
);
/* Parse the configuration files */ /* Parse the configuration files */
process_config_files(host_arg, pw, 0, &want_final_pass); process_config_files(host_arg, pw, 0, &want_final_pass);

19
sshd.c
View File

@ -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> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -906,14 +906,7 @@ drop_connection(int sock, int startups)
static void static void
usage(void) usage(void)
{ {
fprintf(stderr, "%s, %s\n", fprintf(stderr, "%s, %s\n", SSH_RELEASE, SSH_OPENSSL_VERSION);
SSH_RELEASE,
#ifdef WITH_OPENSSL
OpenSSL_version(OPENSSL_VERSION)
#else
"without OpenSSL"
#endif
);
fprintf(stderr, fprintf(stderr,
"usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n" "usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n"
" [-E log_file] [-f config_file] [-g login_grace_time]\n" " [-E log_file] [-f config_file] [-g login_grace_time]\n"
@ -1772,13 +1765,7 @@ main(int ac, char **av)
exit(1); exit(1);
} }
debug("sshd version %s, %s", SSH_VERSION, debug("sshd version %s, %s", SSH_VERSION, SSH_OPENSSL_VERSION);
#ifdef WITH_OPENSSL
OpenSSL_version(OPENSSL_VERSION)
#else
"without OpenSSL"
#endif
);
/* Store privilege separation user for later use if required. */ /* Store privilege separation user for later use if required. */
privsep_chroot = use_privsep && (getuid() == 0 || geteuid() == 0); privsep_chroot = use_privsep && (getuid() == 0 || geteuid() == 0);

View File

@ -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. * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@ -39,6 +39,7 @@
# define EC_GROUP void # define EC_GROUP void
# define EC_POINT void # define EC_POINT void
# endif /* OPENSSL_HAS_ECC */ # endif /* OPENSSL_HAS_ECC */
#define SSH_OPENSSL_VERSION OpenSSL_version(OPENSSL_VERSION)
#else /* WITH_OPENSSL */ #else /* WITH_OPENSSL */
# define BIGNUM void # define BIGNUM void
# define RSA void # define RSA void
@ -46,6 +47,7 @@
# define EC_KEY void # define EC_KEY void
# define EC_GROUP void # define EC_GROUP void
# define EC_POINT void # define EC_POINT void
#define SSH_OPENSSL_VERSION "without OpenSSL"
#endif /* WITH_OPENSSL */ #endif /* WITH_OPENSSL */
#define SSH_RSA_MINIMUM_MODULUS_SIZE 1024 #define SSH_RSA_MINIMUM_MODULUS_SIZE 1024