diff --git a/0001-build-add-with-vendor-error-message-configure-option.patch b/0001-build-add-with-vendor-error-message-configure-option.patch new file mode 100644 index 0000000..75235ee --- /dev/null +++ b/0001-build-add-with-vendor-error-message-configure-option.patch @@ -0,0 +1,60 @@ +From 0353d704879f20983184f8bded4f16538d72f7cc Mon Sep 17 00:00:00 2001 +From: Sumit Bose +Date: Wed, 10 Mar 2021 18:12:09 +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 adcli returns with an error. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1889386 +--- + configure.ac | 15 +++++++++++++++ + tools/tools.c | 6 ++++++ + 2 files changed, 21 insertions(+) + +diff --git a/configure.ac b/configure.ac +index baa0d3b..7dfba97 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -123,6 +123,21 @@ if test "$sasl_invalid" = "yes"; then + AC_MSG_ERROR([Couldn't find Cyrus SASL headers]) + fi + ++# -------------------------------------------------------------------- ++# 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 adcli 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])] ++ )], ++ []) ++ + # -------------------------------------------------------------------- + # Documentation options + +diff --git a/tools/tools.c b/tools/tools.c +index d0dcf98..84bbba9 100644 +--- a/tools/tools.c ++++ b/tools/tools.c +@@ -538,6 +538,12 @@ main (int argc, + + if (conn) + adcli_conn_unref (conn); ++#ifdef VENDOR_MSG ++ if (ret != 0) { ++ fprintf (stderr, VENDOR_MSG"\n"); ++ } ++#endif ++ + return ret; + } + +-- +2.30.2 + diff --git a/adcli.spec b/adcli.spec index 24ecce3..febbfb8 100644 --- a/adcli.spec +++ b/adcli.spec @@ -1,11 +1,13 @@ Name: adcli Version: 0.9.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Active Directory enrollment License: LGPLv2+ URL: https://gitlab.freedesktop.org/realmd/adcli Source0: https://gitlab.freedesktop.org/sbose/adcli/uploads/30880d967e79cee789194435e70fbf30/adcli-%{version}.tar.gz +Patch1: 0001-build-add-with-vendor-error-message-configure-option.patch + BuildRequires: gcc BuildRequires: intltool pkgconfig BuildRequires: libtool @@ -34,7 +36,11 @@ standard LDAP and Kerberos calls. %build autoreconf --force --install --verbose -%configure --disable-static --disable-silent-rules +%configure --disable-static --disable-silent-rules \ +%if 0%{?rhel} + --with-vendor-error-message='Please check\n https://red.ht/support_rhel_ad \nto get help for common issues.' \ +%endif + %{nil} make %{?_smp_mflags} %check @@ -65,6 +71,10 @@ documentation. %doc %{_datadir}/doc/adcli/* %changelog +* Mon Mar 29 2021 Sumit Bose - 0.9.1-3 +- Add vendor error message + Resolves: rhbz#1889386 + * Sat Feb 20 2021 Sumit Bose - 0.9.1-2 - Add Conflicts to avoid update/downgrade issues