improve configuration error message

This commit is contained in:
Petr Lautrbach 2013-11-15 13:53:42 +01:00
parent 7fd305bb81
commit 21e60e40c2
2 changed files with 49 additions and 0 deletions

View File

@ -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 */

View File

@ -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.