atom feed34 messages in net.sourceforge.lists.courier-usersRe: [courier-users] Standard Signatures
FromSent OnAttachments
Peter BurdenMar 18, 2008 5:01 am 
Gordon MessmerMar 18, 2008 8:17 am 
Harry DuncanMar 18, 2008 8:48 am 
Ben KennedyMar 18, 2008 12:00 pm 
Aidas KasparasMar 18, 2008 12:13 pm 
Harry DuncanMar 18, 2008 12:43 pm 
Harry DuncanMar 18, 2008 12:56 pm 
Norbert SchmidtMar 18, 2008 1:22 pm 
Gordon MessmerMar 18, 2008 5:55 pm 
Jerry AmundsonMar 19, 2008 9:58 am 
Gordon MessmerMar 19, 2008 11:47 am 
Harry DuncanMar 20, 2008 12:02 am 
Aidas KasparasMar 20, 2008 2:19 am 
Peter BurdenMar 20, 2008 4:03 am 
EndaMar 20, 2008 4:44 am 
Harry DuncanMar 20, 2008 4:47 am 
Gordon MessmerMar 20, 2008 9:04 am 
Peter BurdenApr 22, 2008 8:56 am 
Peter BurdenApr 22, 2008 8:57 am 
Gordon MessmerApr 23, 2008 12:22 am 
Peter BurdenApr 23, 2008 2:14 am 
Gordon MessmerApr 23, 2008 3:20 pm 
Peter BurdenApr 23, 2008 4:48 pm 
Gordon MessmerApr 23, 2008 9:27 pm 
Peter BurdenMay 12, 2008 9:06 am 
Aleksander AdamowskiMay 15, 2008 10:53 am 
Peter BurdenMay 15, 2008 3:33 pm 
Aleksander AdamowskiMay 16, 2008 2:49 am 
Peter BurdenJun 18, 2008 9:00 am 
Jeff JansenJun 18, 2008 5:45 pm 
Peter BurdenJun 19, 2008 1:56 pm 
Gordon MessmerJun 19, 2008 4:35 pm 
Jeff JansenJun 19, 2008 6:08 pm.patch
Peter BurdenJul 22, 2008 3:47 am 
Subject:Re: [courier-users] Standard Signatures
From:Peter Burden (pete@gmail.com)
Date:Apr 23, 2008 2:14:35 am
List:net.sourceforge.lists.courier-users

On 23/04/2008, Gordon Messmer <yiny@eburg.com> wrote:

Peter Burden wrote:

Since then, I've cut some code and have a working signing filter. If anybody wants to have a look and let me know about any bugs (obvious or subtle), source code is at http://web.ptwol.net/sigfilter/sigfilter.c It's in standard C and uses a MySQL database. There are some explanations of how it works in the source code.

I don't like criticizing you twice in one evening, but there are some pretty serious problems with this code:

* Filter is threaded, but you're not taking the required steps to make mysql thread-safe: http://dev.mysql.com/doc/refman/5.0/en/threaded-clients.html

Since the filter doesn't try and share a connection between threads my interpretation of the reference is that, provided you link against libmysqlclient_r, you don't need to do anything further special.

* Filter uses global variables with no mutex protection. See above.

The global variables that are accessed by the threads are only read, not written to. They are set up as part of the initialisation, the filter does not start listening or launching threads until initialisation is complete. I have never found any need for mutexes to control access to read-only data. Read-write is, of course, a completely different matter.

* Filter doesn't handle shutdown (it needs to watch STDIN for EOF)

Good point. Will fix.

* Filter seems to treat any "AUTH: LOGIN" as if it were a header * AUTH header won't always say "AUTH: LOGIN"

Fair comment. For my server installation we currently only use LOGIN authentication but this should be easy to fix.

I don't think I'm treating AUTH:LOGIN as if it were a header, based on my observation of what Courier seems to do, it appears that AUTH:LOGIN is interposed amongst the parts of the "Received:" header - usually on a continuation line.

I would accept the criticism that the AUTH:LOGIN recognition code doesn't really understand headers and, worse, carries on looking for AUTH:LOGIN in the message body if it didn't find it in the headers.

Is there a definitive statement on the location/syntax of "AUTH:LOGIN" anywhere? I can't see it in RFC2822/2821.

* Filter doesn't free the "mime" variable, which creates a memory leak

Thanks for spotting that !

* Some variables aren't used at all

Left over debugging !

* I strongly recommend that you use a MIME library for message parsing rather than trying to write your own. It's complicated. See if "GMime" fits your needs.

Will investigate. Thanks for the reference.

* Finally, and most importantly IMO, you append a plaintext signature to any text part. It looks like this includes attached files. Regardless, by modifying the existing text parts, you invalidate PGP and SMIME signatures, which is bad.

The point about PGP and SMIME is a fair comment, but I find it difficult to imagine a signing system that would both satisfy end user requirements and not break such things.

Yes at the moment it signs any text/plain and text/html parts. The point about attached text files is a good one, I will investigate further.

There are probably other things, but that's what I noticed after looking at the code for ten minutes...

Once again thanks for your comments which have probably saved me a lot of time.

I've actually got a pythonfilter that does signatures sitting in CVS. A customer paid for it to be written, and I'm mostly waiting for them to confirm that it's working the way that they need it to before I release it.