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

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