[horde] LDAP Prefs + Horde 3.0 + IMP 4.0 Prob

KaalH! kaalh at smol.org
Wed May 22 06:33:31 PDT 2002


yeah, I've got a solution ! :)

The problem is "hordePrefs:: aW1wOnF1b3RlX3ByZWZpeDo+IA=="

This appends because you are not using english as default language.
eg: french translation default identity name is "identité par défaut"

the non-us caracters are the bug cause.

my proposition/solution is to base64_encode() the entries instead of 
utf8_encode() them.
the bad news is that preferences in the ldap tree are no more human readable.

the patch : 

Index: ldap.php
===================================================================
RCS file: /repository/horde/lib/Prefs/ldap.php,v
retrieving revision 1.36
diff -u -r1.36 ldap.php
--- ldap.php    20 May 2002 11:22:01 -0000      1.36
+++ ldap.php    22 May 2002 13:19:38 -0000
@@ -351,7 +351,7 @@
              * server.
              */
             foreach ($result[0][$field] as $prefstr) {
-                $prefstr = utf8_decode($prefstr);
+                $prefstr = base64_decode($prefstr);
 
                 /* If the string doesn't contain a colon delimeter, skip it. 
*/
                 if (substr_count($prefstr, ':') == 0) {
@@ -436,7 +436,7 @@
         foreach($prefs as $pref) {
             $entry = sprintf("%s:%s:%s", $this->getScope($pref), $pref,
                              Prefs::getValue($pref));
-            $new_values[$this->params['field']][] = utf8_encode($entry);
+            $new_values[$this->params['field']][] = base64_encode($entry);
         }


##################################################################

another way is to base64_encode only the pref value : 
horde:identities:[base64'd value]
then the scope & pref name are still human readable in the ldap tree.

the patch :

Index: ldap.php
===================================================================
RCS file: /repository/horde/lib/Prefs/ldap.php,v
retrieving revision 1.36
diff -u -r1.36 ldap.php
--- ldap.php    20 May 2002 11:22:01 -0000      1.36
+++ ldap.php    22 May 2002 13:30:10 -0000
@@ -361,6 +361,9 @@
                 /* Split the string into its scope:name:value components. */
                 list($scope, $pref, $val) = split(':', $prefstr, 3);
 
+               /* Decode the pref value */
+               $pref = base64_decode($pref);
+
                 /* Only retrieve this preference if it's in our scope. */
                 if ((strcmp($scope, $this->scope) == 0) ||
                     (strcmp($scope, 'horde') == 0)) {
@@ -435,7 +438,7 @@
         $new_values = array();
         foreach($prefs as $pref) {
             $entry = sprintf("%s:%s:%s", $this->getScope($pref), $pref,
-                             Prefs::getValue($pref));
+                             base64_encode(Prefs::getValue($pref)));
             $new_values[$this->params['field']][] = utf8_encode($entry);
         }




-- 
KaalH!


Surlignage joel <joel at secuserv.ch>:

> Heya 
> 
> Hum, I've included the schema in the slapd.conf (jeah, openldap) and set the
> 
> objectclass for the "tr0nix"-user. I found out that if he searches for mail 
> he searches only for "tr0nix" and not for the whole email, so I set the 
> mail-attribute to "tr0nix". He definetly has write access because he makes 
> changes in the db as I said bevore. I also setted the checkschema (or 
> whatever) to off. 
> 
> Result:
> Login works without complaints about the entry _BUT_ if I change settings in
> 
> the webmail and try to save them OR logout he complains with the same old 
> error msg. 
> 
> ldap-debugging means:
> daemon: conn=2 fd=9 connection from IP=127.0.0.1:48251 (IP=0.0.0.0:34049) 
> accepted.
> conn=2 op=0 BIND dn="CN=MANAGER,DC=SECUSERV,DC=CH" method=128
> ber_flush: 14 bytes to sd 9
> conn=2 op=0 RESULT tag=97 err=0 text=
> conn=2 op=1 SRCH base="dc=secuserv,dc=ch" scope=2 filter="(mail=tr0nix)"
> ber_flush: 38 bytes to sd 9
> ber_flush: 14 bytes to sd 9
> conn=2 op=1 SEARCH RESULT tag=101 err=0 text=
> conn=2 op=2 MOD dn="cn=tr0nix,dc=secuserv,dc=ch"
> ber_flush: 53 bytes to sd 9
> conn=2 op=2 RESULT tag=103 err=21 text=hordePrefs: value #5 invalid per 
> syntax
> conn=2 op=3 UNBIND
> conn=-1 fd=9 closed 
> 
> Take a look at the "conn=2 op=2 RESULT tag=103 err=21 text=hordePrefs: value
> 
> #5 invalid per syntax"-line. Does that say you something? 
> 
> The entry in the db after logging in and trying to set the settings of the 
> user tr0nix, it looks like that:
> dn: dc=secuserv,dc=ch
> objectClass: top 
> 
> dn: cn=tr0nix,dc=secuserv,dc=ch
> objectClass: hordePerson
> sn: Joel Wiesmann
> cn: mail
> mail: tr0nix
> hordePrefs: horde:language:
> hordePrefs: horde:theme:
> hordePrefs: imp:summary_refresh_time:300
> hordePrefs: horde:timezone:
> hordePrefs: imp:mailbox:INBOX
> hordePrefs: horde:identities:a:0:{}
> hordePrefs: horde:default_identity:0
> hordePrefs: horde:signature:
> hordePrefs: horde:sig_dashes:0
> hordePrefs: horde:sig_first:0
> hordePrefs: horde:fullname:
> hordePrefs: horde:from_addr:
> hordePrefs: horde:replyto_addr:
> hordePrefs: horde:save_sent_mail:1
> hordePrefs: horde:sent_mail_folder:sent-mail
> hordePrefs: imp:sortby:1
> hordePrefs: imp:sortdir:0
> hordePrefs: imp:max_msgs:20
> hordePrefs: imp:num_words:3
> hordePrefs: imp:nav_expanded:0
> hordePrefs: imp:show_legend:1
> hordePrefs: imp:highlight_text:1
> hordePrefs: imp:dim_signature:1
> hordePrefs: imp:attachment_display:list
> hordePrefs: imp:delhide:0
> hordePrefs: imp:last_login:1022077602
> hordePrefs: imp:show_last_login:0
> hordePrefs: imp:initial_page:INBOX
> hordePrefs: imp:do_maintenance:1
> hordePrefs: imp:rename_sentmail_monthly:0
> hordePrefs: imp:delete_sentmail_monthly:0
> hordePrefs: imp:delete_sentmail_monthly_keep:12
> hordePrefs: imp:purge_trash:0
> hordePrefs: imp:purge_trash_interval:2
> hordePrefs: imp:purge_trash_keep:30
> hordePrefs: imp:mailbox_return:0
> hordePrefs: imp:use_trash:0
> hordePrefs: imp:trash_folder:trash
> hordePrefs: imp:subscribe:0
> hordePrefs: imp:wrap_width:80
> hordePrefs: imp:reply_quote:1
> hordePrefs:: aW1wOnF1b3RlX3ByZWZpeDo+IA==
> hordePrefs: imp:compose_popup:1
> hordePrefs: imp:drafts_folder:drafts
> hordePrefs: imp:close_draft:1
> hordePrefs: imp:search_sources:
> hordePrefs: imp:search_fields:
> hordePrefs: imp:add_source:
> hordePrefs: imp:filtering:0
> hordePrefs: imp:expanded_folders:a:0:{}
> hordePrefs: imp:nav_poll:
> hordePrefs: imp:refresh_time:0
> hordePrefs: imp:nav_popup:0
> hordePrefs: imp:filters:
> hordePrefs: imp:filter_on_login:0
> hordePrefs: imp:filter_on_refresh:0
> hordePrefs: imp:show_filter_msg:0
> hordePrefs: imp:use_pgp:0
> hordePrefs: imp:pgp_attach_pubkey:0
> hordePrefs: imp:pgp_private_key:
> hordePrefs: imp:pgp_public_key:
> modifiersName: cn=manager,dc=secuserv,dc=ch
> modifyTimestamp: 20020522142642Z 
> 
> As you see modifiersName is existing :/ so it isn't the write-perm (I 
> thought the same first too) and the objectclass seems also working... 
> 
> Any clue? 
> 
> Greets
> Joel Wiesmann
> 
> -- 
> Horde mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org


More information about the horde mailing list