Hello,
we have open bugzilla [1] for cyrus-sasl, that refers to problems with
parsing config files. When there is problem, return error is generic and
without knowing what is going on, hard to find out that it is problem in
config. We have also proposed patch which is applied in Fedora OS for ~2
years and works fine. It would be great to put this also to upstream to
have compatibility.
I prepared patch that is applicable for upstream git (attachment). Also
I'm CC'ing email addresses located in sasl.h, that can be interested in
this topic. Please, consider this issue and let me know about your opinion.
Best Regards,
Jakub Jelen
[1] https://bugzilla.redhat.com/show_bug.cgi?id=728235
>From 9d2d9fe64f4726d54644b2393373c55654cf22d2 Mon Sep 17 00:00:00 2001
From: Jakub Jelen <jjelen@xxxxxxxxxx>
Date: Tue, 10 Mar 2015 15:21:34 +0100
Subject: [PATCH] Add error message for config error
---
include/sasl.h | 1 +
lib/common.c | 1 +
lib/config.c | 4 ++--
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/sasl.h b/include/sasl.h
index 8b8a63f..6ae153f 100755
--- a/include/sasl.h
+++ b/include/sasl.h
@@ -179,6 +179,7 @@
because of some constrains/policy violation */
#define SASL_BADBINDING -32 /* channel binding failure */
+#define SASL_CONFIGERR -33 /* 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 672fe2f..de0adfd 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 */
--
2.1.0