diff options
author | Rich Megginson <rmeggins@redhat.com> | 2010-03-08 14:35:17 -0700 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2010-03-08 16:26:33 -0700 |
commit | b8ff06dd240df947fee972fe13bb2826ebb02048 (patch) | |
tree | cf50efc63bc11700ac9f3224442db4dc0aba5c2c | |
parent | 4845ffc48517bd2c938129a40c4e4f29c1efcc5a (diff) | |
download | ds-b8ff06dd240df947fee972fe13bb2826ebb02048.tar.gz ds-b8ff06dd240df947fee972fe13bb2826ebb02048.tar.xz ds-b8ff06dd240df947fee972fe13bb2826ebb02048.zip |
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
-rw-r--r-- | ldap/servers/plugins/syntaxes/cis.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/ldap/servers/plugins/syntaxes/cis.c b/ldap/servers/plugins/syntaxes/cis.c index 77f6d55e..bc4f72e7 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; } |