A couple of goodies

Bron Gondwana brong at fastmail.fm
Wed Jul 25 15:58:38 EDT 2007


On Wed, 25 Jul 2007 15:35:26 +0100 (BST), "David Carter" <dpc22 at cam.ac.uk> said:
> On Wed, 25 Jul 2007, Bron Gondwana wrote:
> 
> > See also the attached, our latest patch - it includes a bugfix which stops
> > you being able to randomly move some user's home directory to a non-home
> > directory elsewhere.  Something that you could do only because of the bug
> > in mboxname_isusermailbox.
> 
> I think that the problem is specific to virtual domain setups.

I'm pretty sure it's due to unixhierarchysep - if you look at the deleted
half of my patch it does a string check for 'user.' specifically - the new
one does a check for 'user' and then for start[4] == 'sep'. after walking to
that part.

The removed code does also search for '!user.' which is the virtual domain
support bit - though it doesn't also check that they're enabled.  A bit bogus
but probably 99.999% safe.

> > It also makes mboxname_isusermailbox a fair bit easier to read - though 
> > it does a config item lookup each use - might be worth making that 
> > static or even a bit more global.  Hmm.  What do you think?
> 
> config_getstring() is actually just an array lookup: the hard work is
> done 
> at compile time.
> 
> mboxlist_delayed_delete_isenabled() and mboxlist_in_delete_hierachy()
> have 
> some caching, but this is really just habit on my part.

Ahh, premature optimisation.  My favourite kind :)  It confused me for a bit
anyway.  I'm tempted to strip them if they're not needed - complexifies the
code and makes it harder for a new maintainer to understand.

Bron.
-- 
  Bron Gondwana
  brong at fastmail.fm



More information about the Cyrus-devel mailing list