Re: [Dovecot] How to bring dovecot to using a slightly modified passwd file

2014-04-23 Thread Steffen Kaiser

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, 21 Apr 2014, Stephan von Krawczynski wrote:


I am trying to use a setup where domains have separate passwd files with a
slightly different layout. Is there a way to tell dovecot that a passwd file
contains everything it looks for but on different positions inside the passwd
file line?

Standard passwd:

USERNAME:PASSWD:UID:GID:HOME:extras

different layout:

USERNAME:PASSWD:extras:UID:GID:HOME

Or do I have to patch the source, and where if necessary?


Check out

src/auth/db-passwd-file.c
src/auth/passdb-passwd-file.c

BTW: To shift "extras" before uid/gid requires a way to quote ":", too.

- -- 
Steffen Kaiser

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBU1eSmXz1H7kL/d9rAQKVcAf9G+fQd2FT3JeHgQz+GSXlOK4WxItQJTK9
qBEJt4FAlsxVM2jRmuC+v4ZrOTYqz5IY/d8rDcc1H5NmM8V61S0gctalWF8A5m0t
yKFSi76oAFRtq6XKd1u00gFavvvMZw6FO/rj6PnCx+lsA31ABJvphFjgS/HxWexK
hNSBFXq9+bFvJSlDEtmtwwW1mZF91EW/Tm+/lb36GZhfFj2JNshrICqc5PLL6MPy
DX0Aq9hkRdzl8+oxwupIODhc1NhTypTtq/bO7JGKMZNUHBnynbdw8SZvfqxjtvqY
QawzrZr2Fyjfqipw/+CyNREVwCpvgomf+eA9yO7LD1p8/EgCFKi4Kg==
=hcCY
-END PGP SIGNATURE-


Re: [Dovecot] How to bring dovecot to using a slightly modified passwd file

2014-04-21 Thread Stephan von Krawczynski
On Mon, 21 Apr 2014 17:26:13 +0200
Andreas Schulze  wrote:

> Stephan von Krawczynski:
> > If there is no chance to convince Timo for something like a passwd-scheme
> > parameter useful for more people than just me I will probably rewrite the
> > stuff myself. Nevertheless if someone kindly points me to the right piece of
> > code I could save some hours searching for it myself...
> Stephan,
> 
> I'm not aware on any function you need to specify the passwd layout.
> So a short solution would be a patch to dovecot.
> 
> A more general solution could be a separate scheme beside
> the existing auth backends http://wiki2.dovecot.org/PasswordDatabase
> or a mechanism to specify passwd fields as you suggested.
> 
> Andreas

Hello Andreas,

I am well aware of the several possibilities around passwd and userdb. The
thing is I want to avoid using scripts or an external binary (which would be
possible) for performance reasons. I think the internal passwd file handling
from dovecot would be best. It should be pretty easy to do a patched version
where only the fields are replaced by the ones my passwd files use.

-- 
Regards,
Stephan


Re: [Dovecot] How to bring dovecot to using a slightly modified passwd file

2014-04-21 Thread Andreas Schulze
Stephan von Krawczynski:
> If there is no chance to convince Timo for something like a passwd-scheme
> parameter useful for more people than just me I will probably rewrite the
> stuff myself. Nevertheless if someone kindly points me to the right piece of
> code I could save some hours searching for it myself...
Stephan,

I'm not aware on any function you need to specify the passwd layout.
So a short solution would be a patch to dovecot.

A more general solution could be a separate scheme beside
the existing auth backends http://wiki2.dovecot.org/PasswordDatabase
or a mechanism to specify passwd fields as you suggested.

Andreas


Re: [Dovecot] How to bring dovecot to using a slightly modified passwd file

2014-04-21 Thread Stephan von Krawczynski
On Mon, 21 Apr 2014 13:38:59 +0200
Benny Pedersen  wrote:

> Stephan von Krawczynski skrev den 2014-04-21 09:33:
> 
> > Or do I have to patch the source, and where if necessary?
> 
> dovecot does not need passwd files, you can eg use any db that dovecot 
> support, lets say sqlite, then you can make layout free of charge
> 
> make a php wrapper that import flat filedb to sqlite, and another one to 
> export sqlite to fliledb
> 
> that would be heaven imho :)
> 
> and at the same time a nice backup

Hello Benny,

there are good reasons why this is _not_ possible. The setup is complex and
lots of other software parts depend on the passwd file. Since they should all
be interacting it is no good idea to spread the same data over several
"databases". Furthermore we are not talking about _one_ passwd-like file but 
thousands (one for every domain).
Believe me, I thought about it before asking exactly this question and not for
some solution.
If there is no chance to convince Timo for something like a passwd-scheme
parameter useful for more people than just me I will probably rewrite the
stuff myself. Nevertheless if someone kindly points me to the right piece of
code I could save some hours searching for it myself...

-- 
Regards,
Stephan


Re: [Dovecot] How to bring dovecot to using a slightly modified passwd file

2014-04-21 Thread Benny Pedersen

Stephan von Krawczynski skrev den 2014-04-21 09:33:


Or do I have to patch the source, and where if necessary?


dovecot does not need passwd files, you can eg use any db that dovecot 
support, lets say sqlite, then you can make layout free of charge


make a php wrapper that import flat filedb to sqlite, and another one to 
export sqlite to fliledb


that would be heaven imho :)

and at the same time a nice backup


[Dovecot] How to bring dovecot to using a slightly modified passwd file

2014-04-21 Thread Stephan von Krawczynski
Hello all,

I am trying to use a setup where domains have separate passwd files with a
slightly different layout. Is there a way to tell dovecot that a passwd file
contains everything it looks for but on different positions inside the passwd
file line?

Standard passwd:

USERNAME:PASSWD:UID:GID:HOME:extras

different layout:

USERNAME:PASSWD:extras:UID:GID:HOME

Or do I have to patch the source, and where if necessary?

Thanks for your help.
-- 
Regards,
Stephan