[389-commits] ldap/servers
Richard Allen Megginson
rmeggins at fedoraproject.org
Mon Mar 8 23:26:15 UTC 2010
ldap/servers/plugins/syntaxes/cis.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
New commits:
commit b8ff06dd240df947fee972fe13bb2826ebb02048
Author: Rich Megginson <rmeggins at redhat.com>
Date: Mon Mar 8 14:35:17 2010 -0700
Bug 570905 - postalAddress syntax should allow empty lines (should allow $$)
https://bugzilla.redhat.com/show_bug.cgi?id=570905
Resolves: bug 570905
Bug Description: postalAddress syntax should allow empty lines (should allow $$)
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: Even though RFC 4517 says a postal address syntax value
should not contain empty lines (e.g. $$), most, if not all, current
applications expect to be able to store $$. This adds an internal switch
to allow support for $$ for now.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/syntaxes/cis.c b/ldap/servers/plugins/syntaxes/cis.c
index 77f6d55..bc4f72e 100644
--- a/ldap/servers/plugins/syntaxes/cis.c
+++ b/ldap/servers/plugins/syntaxes/cis.c
@@ -79,6 +79,15 @@ static int oid_validate(struct berval *val);
static int printable_validate(struct berval *val);
/*
+ Even though the official RFC 4517 says that the postal syntax
+ line values must contain at least 1 character (i.e. no $$), it
+ seems that most, if not all, address book and other applications that
+ use postal address syntax values expect to be able to store empty
+ lines/values - so for now, allow it
+*/
+static const int postal_allow_empty_lines = 1;
+
+/*
* Attribute syntaxes. We treat all of these the same for now, even though
* the specifications (e.g., RFC 2252) impose various constraints on the
* the format for each of these.
@@ -989,19 +998,14 @@ static int postal_validate(
} else if (*p == '$') {
/* This signifies the end of a line. We need
* to ensure that the line is not empty. */
- if (p == start) {
- rc = 1;
- goto exit;
- }
-
/* make sure the value doesn't end with a '$' */
- if (p == end) {
- rc = 1;
- goto exit;
- }
-
- /* Make sure the line (start to p) is valid UTF-8. */
- if ((rc = utf8string_validate(start, p, NULL)) != 0) {
+ if ((p == start) || (p == end)) {
+ if (!postal_allow_empty_lines) {
+ rc = 1;
+ goto exit;
+ } /* else allow it */
+ } else if ((rc = utf8string_validate(start, p, NULL)) != 0) {
+ /* Make sure the line (start to p) is valid UTF-8. */
goto exit;
}
More information about the 389-commits
mailing list