Help on CDB file format

Hugo Monteiro <[email protected]> Fri, 09 May 2008 16:52:46 +0100
Newsgroups gmane.comp.djb.cdb
Message-ID <[email protected]>
Hello all,

I'm in the process of writing a small program that, hopefully, will
allow to do recipient checking and lookup email addresses on multiple
distinct backends for qmail based installations. Happens that for legacy 
and performance reasons, i would like to include CDB in the supported 
backends. The program, or the part of the relative code, is already able 
to read and search the matching values for the queried key, but i've 
come across a situation that i was hoping someone could clarify.

 From the documentation i've seen, the representation of the data isn't
more than a record like "+keylen,datalen:key->value", where there's the
possibility of the same key to point to different values. So i started
testing with a self made cdb file like the described above and the code
behaved properly. Hurray!

Then i tried with an aliases.cdb file and a cdb file generated with
qmail-newu and i didn't get anything. Taking a closer look to the dumps
of those cdbs, i saw that the data was represented differently from the
cdb i made, and even from each other.

aliases.cdb keeps data in the format "+keylen,datalen::key@->&data",
where the ":" and "@" are part of the key, and the "&" part of the data.

then, cdb generated with qmail-newu has the format
"+keylen,datalen:!key->data", where the "!" is part of the key.

Of course i could write code to handle those "artifacts", but i'm not
confortable doing so without understanding them. I'd like to know if
there is any reason for them, what that reason is and if in terms of
recipient checking/lookup it would be a bad thing if the code would just
circumvent them. I would like to know also if there are more "artifacts"
that i should be aware of.


Thank you all for your time and input.

Hugo Monteiro.

-- 
ci.fct.unl.pt:~# cat .signature

Hugo Monteiro
Email	 : [email protected]
Telefone : +351 212948300 Ext.15307

Centro de Informática
Faculdade de Ciências e Tecnologia da
		   Universidade Nova de Lisboa
Quinta da Torre   2829-516 Caparica   Portugal
Telefone: +351 212948596   Fax: +351 212948548
www.ci.fct.unl.pt	      [email protected]

ci.fct.unl.pt:~# _