Mailing List Archive

A Really Alpha LMTP daemon
Here's a really basic, not yet working LMTP daemon. Mostly it's pop3.c,
pop3.h and pop3d.c with a little s/pop3?/lmtp/g magic.

Well, that and it supports the amazing LMTP command set of...
LHLO, MAIL FROM, RCPT TO, RSET, QUIT, NOOP and HELP

VRFY and EXPN return "not implemented" error codes (Ok per RFC ;-)

Entering DATA will cause the RCPT addresses to be looked up via
auth_check_user_ext() and say if they're valid or not. I haven't started
working on the "real data" part (the one that actually accepts a message)
because I'm still working out which pieces of pipe.c and injector.c are
good, which parts need more abstraction, and which parts get junked.

I do get some segfaults and weird behaviour. If someone could audit the
code following the case LMTP_MAIL, LMTP_RCPT and LMTP_DATA blocks in
lmtp.c I would very much appreciate it. What really bugs me, though, is
that a few of the problems are not consistently triggered :-\

Time to hunt down those random state bits!

I hope that this might become a basis for the official LMTP daemon, but in
any event this is a lot of fun to write! Plus, the experience helps for
the next daemon I'm going to write, for the ManageSieve protocol :-)

Huge shout out to the IC&S guys because the structure of pop3.c was SO
easy to work with!

Aaron
Re: A Really Alpha LMTP daemon [ In reply to ]
Hi Aaron,

> Here's a really basic, not yet working LMTP daemon. Mostly it's pop3.c,
> pop3.h and pop3d.c with a little s/pop3?/lmtp/g magic.

Cool!

> Entering DATA will cause the RCPT addresses to be looked up via
> auth_check_user_ext() and say if they're valid or not. I haven't
> started
> working on the "real data" part (the one that actually accepts a
> message)
> because I'm still working out which pieces of pipe.c and injector.c are
> good, which parts need more abstraction, and which parts get junked.

If you need any 'inside' info on those subject, please let me know!

> I do get some segfaults and weird behaviour. If someone could audit the
> code following the case LMTP_MAIL, LMTP_RCPT and LMTP_DATA blocks in
> lmtp.c I would very much appreciate it. What really bugs me, though, is
> that a few of the problems are not consistently triggered :-\

I've looked at the code. One possible problem cause is that you're not
correctly closing the case block for LMTP_MAIL (after the return should
be another }). Since i'm now on my bed checking this i can't really
sent you any patches :)

> Time to hunt down those random state bits!
>
> I hope that this might become a basis for the official LMTP daemon,
> but in
> any event this is a lot of fun to write! Plus, the experience helps for
> the next daemon I'm going to write, for the ManageSieve protocol :-)

Very nice. If you're writing more daemons Roel's server software (the
one that handles clients connections, child births and stuff like that)
should come in handy.

Again, if you need any help, please let me know.

> Huge shout out to the IC&S guys because the structure of pop3.c was SO
> easy to work with!

Thanks!

Eelco


_________________________
E.J.A. van Beek
ICT Manager
IC&S
T: +31 30 2322878
F: +31 30 2322305

PGP-key:
www.ic-s.nl/keys/eelco.txt
Re: A Really Alpha LMTP daemon [ In reply to ]
Hello,

Just a thought - dmail had an actual primative smtp daemon at one
time; as lmtp is just a stripped down smtp protocol, would it be
easier to start there than re-impliment from scratch?


---- Original Message ----
From: Eelco van Beek <dbmail-dev@dbmail.org>
To: dbmail-dev@dbmail.org
Subject: Re: [Dbmail-dev] A Really Alpha LMTP daemon
Sent: Wed, 16 Apr 2003 22:41:43 +0200

> Hi Aaron,
>
> > Here's a really basic, not yet working LMTP daemon. Mostly it's pop3.c,
> > pop3.h and pop3d.c with a little s/pop3?/lmtp/g magic.
>
> Cool!
>
> > Entering DATA will cause the RCPT addresses to be looked up via
> > auth_check_user_ext() and say if they're valid or not. I haven't
> > started
> > working on the "real data" part (the one that actually accepts a
> > message)
> > because I'm still working out which pieces of pipe.c and injector.c are
> > good, which parts need more abstraction, and which parts get junked.
>
> If you need any 'inside' info on those subject, please let me know!
>
> > I do get some segfaults and weird behaviour. If someone could audit the
> > code following the case LMTP_MAIL, LMTP_RCPT and LMTP_DATA blocks in
> > lmtp.c I would very much appreciate it. What really bugs me, though, is
> > that a few of the problems are not consistently triggered :-\
>
> I've looked at the code. One possible problem cause is that you're not
> correctly closing the case block for LMTP_MAIL (after the return should
> be another }). Since i'm now on my bed checking this i can't really
> sent you any patches :)
>
> > Time to hunt down those random state bits!
> >
> > I hope that this might become a basis for the official LMTP daemon,
> > but in
> > any event this is a lot of fun to write! Plus, the experience helps for
> > the next daemon I'm going to write, for the ManageSieve protocol :-)
>
> Very nice. If you're writing more daemons Roel's server software (the
> one that handles clients connections, child births and stuff like that)
> should come in handy.
>
> Again, if you need any help, please let me know.
>
> > Huge shout out to the IC&S guys because the structure of pop3.c was SO
> > easy to work with!
>
> Thanks!
>
> Eelco
>
>
> _________________________
> E.J.A. van Beek
> ICT Manager
> IC&S
> T: +31 30 2322878
> F: +31 30 2322305
>
> PGP-key:
> www.ic-s.nl/keys/eelco.txt
>
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>
-- End Original Message --


--
Jesse Norell
jesse (at) kci.net
Re: A Really Alpha LMTP daemon [ In reply to ]
Probably not... while LMTP is based on SMTP, it forbids a couple of
concepts, such as queues and authentication. I do think it would be
possible to write an SMTP daemon that would just "play dumb" if it
received an LHLO instead of HELO or EHLO (ie. the client said "let's
speak in LMTP today") but using an SMTP framework for an LMTP server
is probably overkill.

Aaron


On Wed, 16 Apr 2003, Jesse Norell wrote:

>
> Hello,
>
> Just a thought - dmail had an actual primative smtp daemon at one
> time; as lmtp is just a stripped down smtp protocol, would it be
> easier to start there than re-impliment from scratch?
>
>
> ---- Original Message ----
> From: Eelco van Beek <dbmail-dev@dbmail.org>
> To: dbmail-dev@dbmail.org
> Subject: Re: [Dbmail-dev] A Really Alpha LMTP daemon
> Sent: Wed, 16 Apr 2003 22:41:43 +0200
>
> > Hi Aaron,
> >
> > > Here's a really basic, not yet working LMTP daemon. Mostly it's pop3.c,
> > > pop3.h and pop3d.c with a little s/pop3?/lmtp/g magic.
> >
> > Cool!
> >
> > > Entering DATA will cause the RCPT addresses to be looked up via
> > > auth_check_user_ext() and say if they're valid or not. I haven't
> > > started
> > > working on the "real data" part (the one that actually accepts a
> > > message)
> > > because I'm still working out which pieces of pipe.c and injector.c are
> > > good, which parts need more abstraction, and which parts get junked.
> >
> > If you need any 'inside' info on those subject, please let me know!
> >
> > > I do get some segfaults and weird behaviour. If someone could audit the
> > > code following the case LMTP_MAIL, LMTP_RCPT and LMTP_DATA blocks in
> > > lmtp.c I would very much appreciate it. What really bugs me, though, is
> > > that a few of the problems are not consistently triggered :-\
> >
> > I've looked at the code. One possible problem cause is that you're not
> > correctly closing the case block for LMTP_MAIL (after the return should
> > be another }). Since i'm now on my bed checking this i can't really
> > sent you any patches :)
> >
> > > Time to hunt down those random state bits!
> > >
> > > I hope that this might become a basis for the official LMTP daemon,
> > > but in
> > > any event this is a lot of fun to write! Plus, the experience helps for
> > > the next daemon I'm going to write, for the ManageSieve protocol :-)
> >
> > Very nice. If you're writing more daemons Roel's server software (the
> > one that handles clients connections, child births and stuff like that)
> > should come in handy.
> >
> > Again, if you need any help, please let me know.
> >
> > > Huge shout out to the IC&S guys because the structure of pop3.c was SO
> > > easy to work with!
> >
> > Thanks!
> >
> > Eelco
> >
> >
> > _________________________
> > E.J.A. van Beek
> > ICT Manager
> > IC&S
> > T: +31 30 2322878
> > F: +31 30 2322305
> >
> > PGP-key:
> > www.ic-s.nl/keys/eelco.txt
> >
> > _______________________________________________
> > Dbmail-dev mailing list
> > Dbmail-dev@dbmail.org
> > http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> >
> -- End Original Message --
>
>
> --
> Jesse Norell
> jesse (at) kci.net
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>
Re: A Really Alpha LMTP daemon [ In reply to ]
Thanks for finding the missing }. There's also an incorrect variable in
the LMTP_RCPT block (the result of copy-paste-forget). The resulting weird
program flow into LMTP_RCPT with a wrong memset() is probably what I was
seeing...

Aaron


On Wed, 16 Apr 2003, Eelco van Beek wrote:

> Hi Aaron,
>
> > Here's a really basic, not yet working LMTP daemon. Mostly it's pop3.c,
> > pop3.h and pop3d.c with a little s/pop3?/lmtp/g magic.
>
> Cool!
>
> > Entering DATA will cause the RCPT addresses to be looked up via
> > auth_check_user_ext() and say if they're valid or not. I haven't
> > started
> > working on the "real data" part (the one that actually accepts a
> > message)
> > because I'm still working out which pieces of pipe.c and injector.c are
> > good, which parts need more abstraction, and which parts get junked.
>
> If you need any 'inside' info on those subject, please let me know!
>
> > I do get some segfaults and weird behaviour. If someone could audit the
> > code following the case LMTP_MAIL, LMTP_RCPT and LMTP_DATA blocks in
> > lmtp.c I would very much appreciate it. What really bugs me, though, is
> > that a few of the problems are not consistently triggered :-\
>
> I've looked at the code. One possible problem cause is that you're not
> correctly closing the case block for LMTP_MAIL (after the return should
> be another }). Since i'm now on my bed checking this i can't really
> sent you any patches :)
>
> > Time to hunt down those random state bits!
> >
> > I hope that this might become a basis for the official LMTP daemon,
> > but in
> > any event this is a lot of fun to write! Plus, the experience helps for
> > the next daemon I'm going to write, for the ManageSieve protocol :-)
>
> Very nice. If you're writing more daemons Roel's server software (the
> one that handles clients connections, child births and stuff like that)
> should come in handy.
>
> Again, if you need any help, please let me know.
>
> > Huge shout out to the IC&S guys because the structure of pop3.c was SO
> > easy to work with!
>
> Thanks!
>
> Eelco
>
>
> _________________________
> E.J.A. van Beek
> ICT Manager
> IC&S
> T: +31 30 2322878
> F: +31 30 2322305
>
> PGP-key:
> www.ic-s.nl/keys/eelco.txt
>
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>
Re: A Really Alpha LMTP daemon [ In reply to ]
Nice, it's stable now. Onwards into the depths of pipe.c and injector.c!
I'll post again in a few days to a week (have a bunch of homework due).

Aaron


On Wed, 16 Apr 2003, Aaron Stone wrote:

> Thanks for finding the missing }. There's also an incorrect variable in
> the LMTP_RCPT block (the result of copy-paste-forget). The resulting weird
> program flow into LMTP_RCPT with a wrong memset() is probably what I was
> seeing...
>
> Aaron
>
>
> On Wed, 16 Apr 2003, Eelco van Beek wrote:
>
> > Hi Aaron,
> >
> > > Here's a really basic, not yet working LMTP daemon. Mostly it's pop3.c,
> > > pop3.h and pop3d.c with a little s/pop3?/lmtp/g magic.
> >
> > Cool!
> >
> > > Entering DATA will cause the RCPT addresses to be looked up via
> > > auth_check_user_ext() and say if they're valid or not. I haven't
> > > started
> > > working on the "real data" part (the one that actually accepts a
> > > message)
> > > because I'm still working out which pieces of pipe.c and injector.c are
> > > good, which parts need more abstraction, and which parts get junked.
> >
> > If you need any 'inside' info on those subject, please let me know!
> >
> > > I do get some segfaults and weird behaviour. If someone could audit the
> > > code following the case LMTP_MAIL, LMTP_RCPT and LMTP_DATA blocks in
> > > lmtp.c I would very much appreciate it. What really bugs me, though, is
> > > that a few of the problems are not consistently triggered :-\
> >
> > I've looked at the code. One possible problem cause is that you're not
> > correctly closing the case block for LMTP_MAIL (after the return should
> > be another }). Since i'm now on my bed checking this i can't really
> > sent you any patches :)
> >
> > > Time to hunt down those random state bits!
> > >
> > > I hope that this might become a basis for the official LMTP daemon,
> > > but in
> > > any event this is a lot of fun to write! Plus, the experience helps for
> > > the next daemon I'm going to write, for the ManageSieve protocol :-)
> >
> > Very nice. If you're writing more daemons Roel's server software (the
> > one that handles clients connections, child births and stuff like that)
> > should come in handy.
> >
> > Again, if you need any help, please let me know.
> >
> > > Huge shout out to the IC&S guys because the structure of pop3.c was SO
> > > easy to work with!
> >
> > Thanks!
> >
> > Eelco
> >
> >
> > _________________________
> > E.J.A. van Beek
> > ICT Manager
> > IC&S
> > T: +31 30 2322878
> > F: +31 30 2322305
> >
> > PGP-key:
> > www.ic-s.nl/keys/eelco.txt
> >
> > _______________________________________________
> > Dbmail-dev mailing list
> > Dbmail-dev@dbmail.org
> > http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> >
>
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>
Re: A Really Alpha LMTP daemon [ In reply to ]
Ok, so actually, there's main.c+pipe.c, mini-injector.c, and injector.c
which appears to be commented from my Makefile. Each does a similar thing:
accept a message and deliver it to the database. So what's what, what's a
good sourcebase to work from, any how did we end up with all 3 of these?

It's looking to me like working from mini-injector.c will be the easiest.
The code is quite simple and straightforward :-) But that assumes that I'd
want to duplicate the insertion code again. Umm, sure...

What was injector.c intended to do? Was it perhaps a halted attempt to
replace main.c+pipe.c? Given the parallel name with mini-injector.c, it
would make sense to me if it were the successor to main.c+pipe.c (which
make up the poorly named dbmail-smtp).

But that's all talk. How about the code? I'm having some trouble digging
through injector.c and understanding what's different from main.c+pipe.c
since though the code looks pretty different, the comments and help text
seem to suggest that they are functionally similar, even identical...

If it's not already obvious... I'm lost! Thanks for your help here!

Aaron


On Wed, 16 Apr 2003, Eelco van Beek wrote:
[snip]
> > because I'm still working out which pieces of pipe.c and injector.c are
> > good, which parts need more abstraction, and which parts get junked.
>
> If you need any 'inside' info on those subject, please let me know!
>
[snip]