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

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