[dev] Prefs and themes with LDAP

Jon Parise jon@horde.org
Mon, 1 Apr 2002 21:02:47 -0500


On Mon, Apr 01, 2002 at 06:00:29PM -0800, Edwin Culp wrote:

> Thanks, Jon. 
 
Please let me know how it works.  I wasn't able to test it from
here (at my folk's place for Easter still), and I'd like to merge
the fix back into the RELENG_2 branch.

-- 
Jon Parise (jon@csh.rit.edu)  .  Information Technology (2001)
http://www.csh.rit.edu/~jon/  :  Computer Science House Member


>From eculp@encontacto.net Date: Mon,  1 Apr 2002 18:38:28 -0800
Return-Path: <eculp@encontacto.net>
Mailing-List: contact dev-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list dev@lists.horde.org
Received: (qmail 78568 invoked from network); 2 Apr 2002 02:38:14 -0000
Received: from adsl-64-173-182-158.dsl.mtry01.pacbell.net (HELO encontacto.net) (64.173.182.158)
  by clark.horde.org with SMTP; 2 Apr 2002 02:38:14 -0000
Received: from localhost (localhost [127.0.0.1])
  (uid 0)
  by encontacto.net with local; Mon, 01 Apr 2002 18:38:28 -0800
Received: from 64.173.182.155 ( [64.173.182.155])
	as user eculp@encontacto.net@mail.encontacto.net by Mail.EnContacto.Net with HTTP;
	Mon,  1 Apr 2002 18:38:28 -0800
Message-ID: <1017715108.3ca919a4dbceb@Mail.EnContacto.Net>
Date: Mon,  1 Apr 2002 18:38:28 -0800
From: Edwin Culp <eculp@encontacto.net>
To: dev@lists.horde.org
References: <1017586543.3ca7236fa9d21@Mail.EnContacto.Net> <20020402014201.GA20950@csh.rit.edu> <1017712829.3ca910bde826f@Mail.EnContacto.Net> <20020402020247.GB20950@csh.rit.edu>
In-Reply-To: <20020402020247.GB20950@csh.rit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 4.0-cvs
X-Originating-IP: 64.173.182.155
Subject: Re: [dev] Prefs and themes with LDAP

Jon,

I tried this on Saturday but without utf8_encode.  It seems to work 
as I think it should with dirty prefs.  In openldap an empty attribute 
should be deleted which is what I'm after.  The part that I didn't and 
still don't understand is that it didn't and still doesn't solve my 
original issue with reverting back to the standard hordeTheme or no 
theme.  I continue to get the following message in slapd.log:

RESULT tag=103 err=21 text=hordetheme: value #0 invalid per syntax 

and in the horde.log:

[emergency] [imp] Unable to modify preferences: [21] Invalid syntax [on line 316
of "/usr/src/horde/lib/Prefs/ldap.php"]

I really have no idea why or where "#0" is coming from and haven't 
been able to track it down, yet.:-(  Of course I have a work around 
by adding a nonexistent theme to prefs.php in horde and imp so it 
defaults to  html.php.  The problem with that is if you want to
assign a theme in prefs.php you must delete the hordeTheme=none 
manually.  Not a big deal but still not right.

ed


Quoting Jon Parise <jon@horde.org>:

> On Mon, Apr 01, 2002 at 06:00:29PM -0800, Edwin Culp wrote:
> 
> > Thanks, Jon. 
>  
> Please let me know how it works.  I wasn't able to test it from
> here (at my folk's place for Easter still), and I'd like to merge
> the fix back into the RELENG_2 branch.
> 
> -- 
> Jon Parise (jon@csh.rit.edu)  .  Information Technology (2001)
> http://www.csh.rit.edu/~jon/  :  Computer Science House Member
> 
> -- 
> Horde Developers mailing list: http://horde.org/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe@lists.horde.org
> 
> 

-------------------------------------------------------------
 http://insourcery.com - Mergence of Business and Technology  
          a "Griffin Plaza Partners, LLC" Company


>From slusarz@bigworm.colorado.edu Date: Mon,  1 Apr 2002 21:14:28 -0700
Return-Path: <slusarz@bigworm.colorado.edu>
Mailing-List: contact dev-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list dev@lists.horde.org
Received: (qmail 80005 invoked from network); 2 Apr 2002 04:14:14 -0000
Received: from bigworm.colorado.edu (128.138.113.10)
  by clark.horde.org with SMTP; 2 Apr 2002 04:14:14 -0000
Received: by bigworm.colorado.edu (Postfix, from userid 99)
	id 3FD146D6; Mon,  1 Apr 2002 21:14:28 -0700 (MST)
Received: from 128.138.217.165 ( [128.138.217.165])
	as user slusarz@bigworm.colorado.edu by bigworm.colorado.edu with HTTP;
	Mon,  1 Apr 2002 21:14:28 -0700
Message-ID: <1017720868.3ca9302446d1f@bigworm.colorado.edu>
Date: Mon,  1 Apr 2002 21:14:28 -0700
From: Michael M Slusarz <slusarz@bigworm.colorado.edu>
To: dev@lists.horde.org
Cc: Fabio <fabio@tecnocoop-fpa.com.br>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 4.0-cvs
X-Originating-IP: 128.138.217.165
Subject: Horde/IMP OpenPGP functionality - alpha version

All righty... screenshots, new files, and diffs at:
  http://bigworm.colorado.edu/imp-patches/openpgp/

There is still some stuff I want to implement, but I'd like to open it up 
to others so I can figure out what works and what doesn't.  Maybe, if 
Chuck, Jon, Jan, etc. like some of it, they can commit it so I don't have 
to maintain all of the changes on this end :)

What I have implemented (see screenshots for examples):
  Composition: Encryption, Signing, Encryption+signing, public-key 
attachment
  Reading: IMP can now decrypt/verify any PGP message _in a MIME attachment_
  Prefs: creation of personal keys, importation/admin of public keys
  Storage: public keys can be stored using Turba (similar functionality to 
the 'add address to addressbook' functionality currently in IMP)
  New Horde_Crypt:: API
  All new libraries/classes use PEAR_Error, so there should be quite a bit 
of feedback to the user
  Passphrases can be stored per session, so you only need to enter it once 
per session

Stuff that still needs to be done:
  * Decryption of PHP messages in a text/plain MIME part.  this shouldn't 
be too difficult, since i made sure the decryption functionality (used by 
the MIME Viewer class for the openpgp stuff) lives in the IMP_OpenPGP 
library.  i just want to make sure the attachment stuff works well before I 
mess with this.
  * should all this stuff only work with a secure HTTP server?  If so, 
should this go in the Horde_Crypt class?
  * user documentation. Fabio Costa Flores (fabio@tecnocoop-fpa.com.br) has 
offered to help me with this.  Fabio - is this something you want to help 
with?
  * 'warning' documentation - i.e. the stuff we were talking about on the 
dev list in the last week (that IMP/HTTPS is not the best platform for 
OpenPGP - use at your own risk)
  * Make sure everything is secure
  * Everything I have marked TODO in the code :)
  * Right now, the code tries to guess which public key to use - maybe we 
should just load all the public keys into a keyring and let the program 
figure out - this may provide better results


Stuff i'm worried about:
  * It really sucks that there is not independent API to gnupg - everything 
must be done via a shell and a command line interface.  gpg is NOT a very 
good non-interactive program - I'm sure some tweaking will have to be done 
to the command-line stuff to ensure that the output from gpg is consistent 
across platforms.  gpg does provide some file descriptor output, but it 
appears to be very difficult to do this in PHP - this is something to 
research.
  * since I haven't personally used OpenPGP before i began this project, i 
am not sure if the stuff i have coded is actually useful :) those that use 
PGP more than I do are welcome to comment


Definite requirements (as of right now):
  GnuPG Version 1.06
  A temporary directory

sorry for the rambling. Hope I haven't bored anyone,
michael

______________________________________________
Michael Slusarz [slusarz@bigworm.colorado.edu]
The University of Colorado at Boulder


>From slusarz@bigworm.colorado.edu Date: Tue,  2 Apr 2002 03:09:49 -0700
Return-Path: <slusarz@bigworm.colorado.edu>
Mailing-List: contact dev-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list dev@lists.horde.org
Received: (qmail 98824 invoked from network); 2 Apr 2002 10:09:32 -0000
Received: from bigworm.colorado.edu (128.138.113.10)
  by clark.horde.org with SMTP; 2 Apr 2002 10:09:32 -0000
Received: by bigworm.colorado.edu (Postfix, from userid 99)
	id D8EEC6D6; Tue,  2 Apr 2002 03:09:49 -0700 (MST)
Received: from 198.11.16.178 ( [198.11.16.178])
	as user slusarz@bigworm.colorado.edu by bigworm.colorado.edu with HTTP;
	Tue,  2 Apr 2002 03:09:49 -0700
Message-ID: <1017742189.3ca9836d88b94@bigworm.colorado.edu>
Date: Tue,  2 Apr 2002 03:09:49 -0700
From: Michael M Slusarz <slusarz@bigworm.colorado.edu>
To: dev@lists.horde.org
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 4.0-cvs
X-Originating-IP: 198.11.16.178
Subject: IMP error - prefs not set correctly on login

It's taken me an hour and a half to figure out this bug.  grrrr. :)

Here's the problem (CVS-HEAD):
1. Login to imp

2. redirect.php is run

3. imp/lib/base.php calls $registry->pushApp()
   pushApp() calls $registry->loadPrefs()
   However, there is no Auth:: information loaded yet, so an empty 
preferences class is created
   This class calls $prefs->setDefaults() a couple times with the horde and 
imp prefs files

4. Later in redirect.php, IMP::createSession is called()
   createSession() sets the Auth information and then calls $registry-
>loadPrefs()
   this time, since there is Auth information, a prefs class is loaded with 
the storage driver (in my case, sql)
   As before, $prefs->setDefaults() is called twice to load the horde and 
imp prefs files.
   HOWEVER, setDefaults() keeps track of all prefs files loaded via a 
static variable ($completed) - thus, it kicks out of the function without 
loading ANY of the defaults from the storage driver.

5. The result of this bug is that NO user preferences are available within 
redirect.php - so NO maintenance or last_login stuff works.  Everything 
else after this works ok because the next time a page is loaded, the pref 
names are loaded from the cached values stored for the empty session.

1 Solution:

--- Prefs.php   21 Mar 2002 16:41:17 -0000      1.63
+++ Prefs.php   2 Apr 2002 10:06:45 -0000
@@ -175,14 +175,6 @@
      */
     function setDefaults($filename)
     {
-        /* Ensure that the defaults are only read once. */
-        static $completed;
-        if (!empty($completed[$filename])) {
-            return;
-        } else {
-            $completed[$filename] = true;
-        }
-
         if (!@is_readable($filename)) return;
 
         /* Read the configuration file. The $_prefs array, which will

Of course, this defeats the purpose of ensuring that the defaults are only 
read once.  This is some core Horde stuff, so I will let someone who knows 
better figure out what to do with this.


>From eculp@encontacto.net Date: Tue,  2 Apr 2002 06:14:35 -0800
Return-Path: <eculp@encontacto.net>
Mailing-List: contact dev-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list dev@lists.horde.org
Received: (qmail 9078 invoked from network); 2 Apr 2002 14:14:20 -0000
Received: from adsl-64-173-182-158.dsl.mtry01.pacbell.net (HELO encontacto.net) (64.173.182.158)
  by clark.horde.org with SMTP; 2 Apr 2002 14:14:20 -0000
Received: from localhost (localhost [127.0.0.1])
  (uid 0)
  by encontacto.net with local; Tue, 02 Apr 2002 06:14:35 -0800
Received: from 64.173.182.155 ( [64.173.182.155])
	as user eculp@encontacto.net@mail.encontacto.net by Mail.EnContacto.Net with HTTP;
	Tue,  2 Apr 2002 06:14:35 -0800
Message-ID: <1017756875.3ca9bccb5e3d2@Mail.EnContacto.Net>
Date: Tue,  2 Apr 2002 06:14:35 -0800
From: Edwin Culp <eculp@encontacto.net>
To: dev@lists.horde.org
References: <1017720868.3ca9302446d1f@bigworm.colorado.edu>
In-Reply-To: <1017720868.3ca9302446d1f@bigworm.colorado.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 4.0-cvs
X-Originating-IP: 64.173.182.155
Subject: Re: [dev] Horde/IMP OpenPGP functionality - alpha version

Quoting Michael M Slusarz <slusarz@bigworm.colorado.edu>:

> All righty... screenshots, new files, and diffs at:
>   http://bigworm.colorado.edu/imp-patches/openpgp/
> 
> There is still some stuff I want to implement, but I'd like to open it up 
> to others so I can figure out what works and what doesn't.  Maybe, if 
> Chuck, Jon, Jan, etc. like some of it, they can commit it so I don't have 
> to maintain all of the changes on this end :)

Michael,

I just did a quick scan of the screen shots and the code.  IMO, it is 
awesome!  I agree with waiting for the development team to make a commit
decision.  If it isn't commited, it will be very difficult and not very
practical to keep everyone in sync.

Thanks for all the work put into this.  I sure appreciate it and look 
forward to testing it.

ed

<SNIP> 





-------------------------------------------------------------
 http://insourcery.com - Mergence of Business and Technology  
          a "Griffin Plaza Partners, LLC" Company


>From akira@kurogane.net Date: Wed,  3 Apr 2002 00:56:42 +0900
Return-Path: <akira@kurogane.net>
Mailing-List: contact dev-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list dev@lists.horde.org
Received: (qmail 15368 invoked from network); 2 Apr 2002 16:01:55 -0000
Received: from unknown (HELO kurogane.net) (61.122.41.109)
  by clark.horde.org with SMTP; 2 Apr 2002 16:01:55 -0000
Received: (from nobody@localhost)
	by kurogane.net (8.9.3+3.2W/8.9.3) id AAA06142;
	Wed, 3 Apr 2002 00:56:42 +0900
X-Authentication-Warning: ns1.kurogane.net: nobody set sender to akira@kurogane.net using -f
Received: from 61.200.33.126 ( [61.200.33.126])
	as user akira@localhost by www.kurogane.net with HTTP;
	Wed,  3 Apr 2002 00:56:42 +0900
Message-ID: <1017763002.3ca9d4ba29934@www.kurogane.net>
Date: Wed,  3 Apr 2002 00:56:42 +0900
From: Akira Kurogane <akira@kurogane.net>
To: dev@lists.horde.org
Cc: "Jan Schneider <jan@ammma.de>; \"B.J. Black\"" <William.Black@Sun.COM>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
User-Agent: Internet Messaging Program (IMP) 4.0-cvs
X-Originating-IP: 61.200.33.126
Subject: Multilingual Horde

Konnichiwa!
     I have recently finished an alteration of Horde/IMP that works effectively
for japanese users, both for reading and composition. That's good, but I've used
the "mbstring" functions to achieve this, which means recompiling php using the
"--enable-mbstring" configuration option. Hence, these changes cannot be merged
without forcing _everyone_ else to recompile, as I see it.

    So, what to do? Is japanese (and, further down the track, more advanced
options such as specifying charset for mime parts) worth it? Or should I go my
seperate, multi-byte way?

Yours,

Akira

P.S. if anybody wants to examine the model I have at the moment, if you just
forward this mail onto to me I'd be happy to give you a login to play with.



-------------------------------------------------
>From Kurogane.net


>From akira@kurogane.net Date: Wed,  3 Apr 2002 00:57:55 +0900
Return-Path: <akira@kurogane.net>
Mailing-List: contact dev-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list dev@lists.horde.org
Received: (qmail 15561 invoked from network); 2 Apr 2002 16:03:07 -0000
Received: from unknown (HELO kurogane.net) (61.122.41.109)
  by clark.horde.org with SMTP; 2 Apr 2002 16:03:07 -0000
Received: (from nobody@localhost)
	by kurogane.net (8.9.3+3.2W/8.9.3) id AAA06156;
	Wed, 3 Apr 2002 00:57:55 +0900
X-Authentication-Warning: ns1.kurogane.net: nobody set sender to akira@kurogane.net using -f
Received: from 61.200.33.126 ( [61.200.33.126])
	as user akira@localhost by www.kurogane.net with HTTP;
	Wed,  3 Apr 2002 00:57:55 +0900
Message-ID: <1017763075.3ca9d5037541e@www.kurogane.net>
Date: Wed,  3 Apr 2002 00:57:55 +0900
From: Akira Kurogane <akira@kurogane.net>
To: dev@lists.horde.org
Cc: William.Black@Sun.COM
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
User-Agent: Internet Messaging Program (IMP) 4.0-cvs
X-Originating-IP: 61.200.33.126
Subject: Multilingual Horde

Konnichiwa!
     I have recently finished an alteration of Horde/IMP that works effectively
for japanese users, both for reading and composition. That's good, but I've used
the "mbstring" functions to achieve this, which means recompiling php using the
"--enable-mbstring" configuration option. Hence, these changes cannot be merged
without forcing _everyone_ else to recompile, as I see it.

    So, what to do? Is japanese (and, further down the track, more advanced
options such as specifying charset for mime parts) worth it? Or should I go my
seperate, multi-byte way?

Yours,

Akira

P.S. if anybody wants to examine the model I have at the moment, if you just
forward this mail onto to me I'd be happy to give you a login to play with.



-------------------------------------------------
>From Kurogane.net