From 21e60e40c23f562c8382820d13aed6e6b8f90b05 Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Fri, 15 Nov 2013 13:53:42 +0100 Subject: [PATCH] improve configuration error message --- cyrus-sasl-2.1.26-config-error.patch | 46 ++++++++++++++++++++++++++++ cyrus-sasl.spec | 3 ++ 2 files changed, 49 insertions(+) create mode 100644 cyrus-sasl-2.1.26-config-error.patch diff --git a/cyrus-sasl-2.1.26-config-error.patch b/cyrus-sasl-2.1.26-config-error.patch new file mode 100644 index 0000000..39e8e11 --- /dev/null +++ b/cyrus-sasl-2.1.26-config-error.patch @@ -0,0 +1,46 @@ +diff --git a/include/sasl.h b/include/sasl.h +index d52269f..ed208a5 100644 +--- a/include/sasl.h ++++ b/include/sasl.h +@@ -177,6 +177,7 @@ + because of some constrains/policy violation */ + + #define SASL_BADBINDING -32 /* channel binding failure */ ++#define SASL_CONFIGERR -100 /* error when parsing configuration file */ + + /* max size of a sasl mechanism name */ + #define SASL_MECHNAMEMAX 20 +diff --git a/lib/common.c b/lib/common.c +index e0f59eb..1a1715e 100644 +--- a/lib/common.c ++++ b/lib/common.c +@@ -1362,6 +1362,7 @@ const char *sasl_errstring(int saslerr, + case SASL_CONSTRAINT_VIOLAT: return "sasl_setpass can't store a property because " + "of a constraint violation"; + case SASL_BADBINDING: return "channel binding failure"; ++ case SASL_CONFIGERR: return "error when parsing configuration file"; + + default: return "undefined error!"; + } +diff --git a/lib/config.c b/lib/config.c +index 7cae302..fde3757 100644 +--- a/lib/config.c ++++ b/lib/config.c +@@ -91,7 +91,7 @@ int sasl_config_init(const char *filename) + } + if (*p != ':') { + fclose(infile); +- return SASL_FAIL; ++ return SASL_CONFIGERR; + } + *p++ = '\0'; + +@@ -99,7 +99,7 @@ int sasl_config_init(const char *filename) + + if (!*p) { + fclose(infile); +- return SASL_FAIL; ++ return SASL_CONFIGERR; + } + + /* Now strip trailing spaces, if any */ diff --git a/cyrus-sasl.spec b/cyrus-sasl.spec index 6ae5f5c..9d1d377 100644 --- a/cyrus-sasl.spec +++ b/cyrus-sasl.spec @@ -50,6 +50,8 @@ Patch49: cyrus-sasl-2.1.26-md5global.patch Patch50: cyrus-sasl-2.1.26-revert-upstream-080e51c7fa0421eb2f0210d34cf0ac48a228b1e9.patch # improve sql libraries detection Patch51: cyrus-sasl-2.1.26-sql.patch +# improve configuration error message +Patch52: cyrus-sasl-2.1.26-config-error.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: autoconf, automake, libtool, gdbm-devel, groff @@ -192,6 +194,7 @@ chmod -x include/*.h %patch49 -p1 -b .md5global.h %patch50 -p1 -b .gssapi %patch51 -p1 -b .sql +%patch52 -p1 -b .configerr %build # Find Kerberos.