I didn't know about the db_findmailbox_regex, that would be
a better way to go.  I'll have to take a look at how that
works.

Yup, absolutely correct on the size of the folder, I'll fix
that in my patch for sure.  You must forgive me, last time
I pounded out C code was many moons ago.

As for the case sensativity, I guess the best way to deal
with it would be to use the regex to find the entry in the
DB, and use that name for the folder rather than what was
passed in.  Actually, how does DBMail handle the username
being a different case?  Humm.... I'll have to check how that
was done too, might give me a clue.

This weekend I hope to take a crack at the code some more,
and hopefully pull off the same in smtp.

Please feel free to implement my code any way you see fit.

--
David A. Niblett               | email: [EMAIL PROTECTED]
Network Administrator          | Phone: (352) 334-3400
Gainesville Regional Utilities | Web: http://www.gru.net/



-----Original Message-----
From: Paul J Stevens [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 19, 2005 4:19 PM
To: DBMail mailinglist
Subject: Re: [Dbmail] How to Filter in dbmail


David,


Niblett, David A wrote:
> Good catch, I didn't think about mysql.  The problem is that if my 
> SPAM box is SPAM, but something is sent to it as
> [EMAIL PROTECTED] since the case doesn't match a new box
> may be created (provided it's in the allowed create list) or the email 
> will be rejected.

Ok. I think I follow; but that kind of logic just doesn't feel right for
db_findmailbox_owner, imo.

There's db_findmailbox_by_regex for this kind of functionality. Which I
wouldn't have guessed hadn't I just applied Geo's fnmatch style listex_match
code there last week. It has a flag for case-sensitivity that will suite
you. For 2.0 that is not relevant of course, since db_findmailbox_by_regex
uses straight posix regex, case-insensitive and all.

I would also like to see some basic unit-tests, esp for remove_folder. And I
see a stack smasher in valid_folder:

+               strcat(tmp, ":");
+               strcat(tmp, folder);
+               strcat(tmp, ":");

where tmp is a const, and no boundary checks are applied to folder. Naughty,
naughty.

+               strcat(tmp, ":");
+               strncat(tmp, folder, sizeof(tmp)-2);
+               strcat(tmp, ":");

That should do it, right?

> Like won't cut it either, I needed something that did a case 
> comparison.  I'm open to suggestions.

Looks almost finished enough for svn-trunk. If it works out there it is of
course very much elligible for 2.0.6. This is a great new feature.



-- 
  ________________________________________________________________
  Paul Stevens                                  mailto:[EMAIL PROTECTED]
  NET FACILITIES GROUP                     PGP: finger [EMAIL PROTECTED]
  The Netherlands________________________________http://www.nfg.nl
_______________________________________________
Dbmail mailing list
[email protected] https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to