Blame SOURCES/0001-build-add-with-vendor-error-message-configure-option.patch

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