| Summary | Carriage Return Line Feed supposed to be a $ in multiline entries in LDAP |
| Queue | Turba |
| Queue Version | HEAD |
| Type | Enhancement |
| State | Resolved |
| Priority | 2. Medium |
| Owners | Horde Developers |
| Requester | urkle (at) drip (dot) ws |
| Created | 03/07/2004 (1580 days ago) |
| Due | |
| Updated | 03/20/2005 (1202 days ago) |
| Assigned | 02/20/2005 (1230 days ago) |
| Resolved | 03/20/2005 (1202 days ago) |
| Attachments | postal.diff ![]() postal2.diff ![]() postal3.diff ![]() |
| Milestone | 2.1 |
| Patch | No |
State ⇒ Resolved
New Attachment: postal3.diff
function did that as well.. I agree though that It should check the
whole UID. (both functions should).
And as for the _getSchema, I do check if the _schema is a a
Net_LDAP_Schema object and re-fetch, if it's not. It does, however,
make more sense to be a static member.
I'll update the patch with these two suggestions.
State ⇒ Assigned
that you don't check the schema against the full UID for the LDAP
postal address syntax, but only the last token? And you may want to
store the schema in _getSchema in a static variable to cache it and
don't create a new schema object for each request.
New Attachment: postal2.diff
schema checking is enabled.. otherwise it will fail back to relying on
the definitions in attributes.php
New Attachment: postal.diff
should be fixed. I just haven't had the time to work on it recently,
and as I'm not using the horde-CVS it hasn't been that high of a
priority as I already had my own patch in the stable tree I'm using.
I have attached an updated patch off of CVS-HEAD.
This does not use the schema checking that was added, As that is an
"optional" feature (checkRequired) which has to be called first to
initialize the _schema object.. The solution attached back
references the $GLOBALS['attributes'] configuration array after
querying $this->map to map attribute.
State ⇒ Rejected
putting any work into it.
Type ⇒ Enhancement
State ⇒ Stalled
Priority ⇒ 2. Medium
State ⇒ Feedback
for schemes and field syntaxes:
http://cvs.horde.org/diff.php/turba/lib/Driver/ldap.php?r1=1.49&r2=1.50&ty=u
Maybe part of this code could be used/adapted to determine the fields
where we want line breaks encoded as "$"?
State ⇒ Assigned
Priority ⇒ 2. Medium
Taken from Chuck Hagenbuch
don't be silly
New Attachment: ldapaddress.patch
I'm the same person as urkle@d.
A few notes though, right now I am explicitly checking for
homepostaladdress, postaladdress, otherpostaladdress, and
registeredaddress with that lovely regular expression. As those are
the standard core scheme that use this syntax.
It would be better if there were a way to access what type of field is
being processed from within the driver,, or a sheme query on the LDAP
to determine what attributes are of the syntax
1.3.6.1.4.1.1466.115.121.1.41.
And this breaks things with evolution, as I am waiting for them to
accept my patch to fix the bug there as well. Neeed to update it for
the 1.5CVS release.
I'm the same person as urkle@d.
A few notes though, right now I am explicitly checking for
homepostaladdress, postaladdress, otherpostaladdress, and
registeredaddress with that lovely regular expression. As those are
the standard core scheme that use this syntax.
It would be better if there were a way to access what type of field is
being processed from within the driver,, or a sheme query on the LDAP
to determine what attributes are of the syntax
1.3.6.1.4.1.1466.115.121.1.41.
And this breaks things with evolution, as I am waiting for them to
accept my patch to fix the bug there as well. Neeed to update it for
the 1.5CVS release.
Priority ⇒ 2. Medium
Assigned to Chuck Hagenbuch
Return, Line Feed instead of just Line Feed between the lines of a
multiline entry (ie. home address) This causes a problem with Evolution
where evolution will not display the entry in the address book if there is
a carriage return in the entry.. But the entries should only have line
feeds..
Patch for Turba 1.2 AND CVS HEAD
------- Additional Comments From urkle@drip.ws 06/17/03 16:45 -------
CVS HEAD Patch
--- ldap.php.orig Fri Jun 13 10:21:15 2003
+++ ldap.php Tue Jun 17 14:41:25 2003
@@ -302,10 +302,10 @@
// Don't add empty attributes.
$attributes = array_filter($attributes, array($this,
'cleanEmptyAttributes'));
- // Encode entries.
+ // Encode entries & do CRLF to LF conversion
foreach ($attributes as $key => $val) {
if (!is_array($val)) {
- $attributes[$key] = String::convertCharset($val,
NLS::getCharset(), $this->charset);
+ $attributes[$key] =
String::convertCharset(str_replace("\r\n",\n",$val), NLS::getCharset(),
$this->charset);
}
}
@@ -377,7 +377,7 @@
// Encode entries.
foreach ($attributes as $key => $val) {
if (!is_array($val)) {
- $attributes[$key] = String::convertCharset($val,
NLS::getCharset(), $this->charset);
+ $attributes[$key] =
String::convertCharset(str_replace("\r\n","\n",$val), NLS::getCharset(),
$this->charset);
}
}
------- Additional Comments From urkle@drip.ws 06/17/03 16:46 -------
Turba 1.2 patch
--- ldap.php.orig Tue Feb 25 20:40:48 2003
+++ ldap.php Sun Jun 15 23:54:34 2003
@@ -301,14 +301,17 @@
// Don't add empty attributes.
$attributes = array_filter($attributes, array($this,
'cleanEmptyAttributes'));
- // Encode entries in UTF-8 if requested.
- if ($this->encoding == 'utf8') {
- foreach ($attributes as $key => $val) {
- if (!is_array($val)) {
- $attributes[$key] = utf8_encode($val);
- }
- }
- }
+ // fix CRLF to LF in multiline entries
+ foreach ($attributes as $key => $val) {
+ if (!is_array($val)) {
+ $val = str_replace("\r\n","\n",$val);
+ // Encode entries in UTF-8 if requested.
+ if ($this->encoding == 'utf8') {
+ $val = utf8_encode($val);
+ }
+ $attributes[$key] = $val;
+ }
+ }
if (!@ldap_add($this->ds, $dn, $attributes)) {
return new PEAR_Error('Failed to add an object: [' .
ldap_errno($this->ds) . '] "' . ldap_error($this->ds) . '" (attributes: [' .
serialize($attributes) . ']).');
@@ -375,14 +378,17 @@
}
}
- // Encode entries in UTF-8 if requested.
- if ($this->encoding == 'utf8') {
- foreach ($attributes as $key => $val) {
- if (!is_array($val)) {
- $attributes[$key] = utf8_encode($val);
- }
- }
- }
+ // fix CRLF to LF in multiline entries
+ foreach ($attributes as $key => $val) {
+ if (!is_array($val)) {
+ $val = str_replace("\r\n","\n",$val);
+ // Encode entries in UTF-8 if requested.
+ if ($this->encoding == 'utf8') {
+ $val = utf8_encode($val);
+ }
+ $attributes[$key] = $val;
+ }
+ }
unset($attributes[$object_key]);
$attributes = array_filter($attributes, array($this,
'cleanEmptyAttributes'));
------- Additional Comments From urkle@drip.ws 03/06/04 23:39 -------
A way needs to be created to let the driver know that the field type is of
postal address..
------- Additional Comments From urkle@drip.ws 03/07/04 00:12 -------
patch to completely fix this bug.
change both ocurrances of
$val = str_replace("\r\n","\n",$val);
in the second patch posted to this.
if (preg_match("/^((home|other)?postal|registered)address$/",%key)) {
$val = str_replace(array("\r\n","\n"),array("$","$"),$val);
}
and then in the getResults function (around line 243)
if ($field == 'dn') {
$resul[$field] = $entry[$field];
+} elseif (preg_match("/^((home|other)?postal|registered)address$/",$field)) {
+ if (!empty($entry[$field])) {
+ if ($this->encoding == 'utf8') {
+ $result[$field] = utf8_decode($entry[$field][0]);
+ }
+ }
+ $result[$field] = str_replace("$","\r\n",$result[$field]);
} else {
$result[$field] = '';
if (!empty($entry[$field])) {
And
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Return, Line Feed instead of just Line Feed between the lines of a
multiline entry (ie. home address) This causes a problem with Evolution
where evolution will not display the entry in the address book if there is
a carriage return in the entry.. But the entries should only have line
feeds..
Patch for Turba 1.2 AND CVS HEAD
------- Additional Comments From urkle@drip.ws 06/17/03 16:45 -------
CVS HEAD Patch
--- ldap.php.orig Fri Jun 13 10:21:15 2003
+++ ldap.php Tue Jun 17 14:41:25 2003
@@ -302,10 +302,10 @@
// Don't add empty attributes.
$attributes = array_filter($attributes, array($this,
'cleanEmptyAttributes'));
- // Encode entries.
+ // Encode entries & do CRLF to LF conversion
foreach ($attributes as $key => $val) {
if (!is_array($val)) {
- $attributes[$key] = String::convertCharset($val,
NLS::getCharset(), $this->charset);
+ $attributes[$key] =
String::convertCharset(str_replace("\r\n",\n",$val), NLS::getCharset(),
$this->charset);
}
}
@@ -377,7 +377,7 @@
// Encode entries.
foreach ($attributes as $key => $val) {
if (!is_array($val)) {
- $attributes[$key] = String::convertCharset($val,
NLS::getCharset(), $this->charset);
+ $attributes[$key] =
String::convertCharset(str_replace("\r\n","\n",$val), NLS::getCharset(),
$this->charset);
}
}