From 4ef597d15df246f4121266aaf3e291e3f06f6f4a Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Wed, 10 Mar 2021 17:57:07 +0100 Subject: [PATCH] build: add --with-vendor-error-message configure option With the new configure option --with-vendor-error-message a packager or a distribution can add a message if realmd returns with an error. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1889386 --- configure.ac | 15 +++++++++++++++ tools/realm.c | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/configure.ac b/configure.ac index ee067d9..05ec1bf 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,21 @@ fi AC_SUBST(DISTRO) +# ----------------------------------------------------------------------------- +# Vendor error message + +AC_ARG_WITH([vendor-error-message], + [AS_HELP_STRING([--with-vendor-error-message=ARG], + [Add a vendor specific error message shown if a realm command fails] + )], + [AS_IF([test "x$withval" != "x"], + [AC_DEFINE_UNQUOTED([VENDOR_MSG], + ["$withval"], + [Vendor specific error message])], + [AC_MSG_ERROR([--with-vendor-error-message requires an argument])] + )], + []) + # ----------------------------------------------------------------------------- # Basic tools diff --git a/tools/realm.c b/tools/realm.c index 1530f09..8fdca16 100644 --- a/tools/realm.c +++ b/tools/realm.c @@ -287,6 +287,13 @@ main (int argc, ret = (realm_commands[i].function) (client, argc, argv); g_object_unref (client); +#ifdef VENDOR_MSG + if (ret != 0) { + g_printerr (VENDOR_MSG"\n"); + } + +#endif + break; } } -- 2.31.1