summaryrefslogtreecommitdiffstats
path: root/apps/openssl.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-02-05 11:27:23 +1000
committerPauli <paul.dale@oracle.com>2020-02-12 08:52:42 +1000
commitc2ec4a16f79cec06b5449bd8728f2e03fa16e22b (patch)
treedc260aaa0c35bc83dd82f4e2d00ce38f1742b5d5 /apps/openssl.c
parent343f0e4a8182ca5c07d9c527f6d681c4109c0700 (diff)
app: add a deprecation warning to all deprecated commands.
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10977)
Diffstat (limited to 'apps/openssl.c')
-rw-r--r--apps/openssl.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/openssl.c b/apps/openssl.c
index 00ad9ca0bd..cafe4046e6 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -47,6 +47,15 @@ BIO *bio_in = NULL;
BIO *bio_out = NULL;
BIO *bio_err = NULL;
+static void warn_deprecated(const char *pname,
+ const char *deprecated_alternative)
+{
+ BIO_printf(bio_err, "The command %s is deprecated.", pname);
+ if (strcmp(deprecated_alternative, DEPRECATED_NO_ALTERNATIVE) != 0)
+ BIO_printf(bio_err, " Use '%s' instead.", deprecated_alternative);
+ BIO_printf(bio_err, "\n");
+}
+
static int apps_startup(void)
{
#ifdef SIGPIPE
@@ -277,6 +286,8 @@ int main(int argc, char *argv[])
fp = lh_FUNCTION_retrieve(prog, &f);
if (fp != NULL) {
argv[0] = pname;
+ if (fp->deprecated_alternative != NULL)
+ warn_deprecated(pname, fp->deprecated_alternative);
ret = fp->func(argc, argv);
goto end;
}
@@ -470,6 +481,8 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
}
}
if (fp != NULL) {
+ if (fp->deprecated_alternative != NULL)
+ warn_deprecated(fp->name, fp->deprecated_alternative);
return fp->func(argc, argv);
}
if ((strncmp(argv[0], "no-", 3)) == 0) {