Re: [Exim] exim_dbmbuild and # signs

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: John Jetmore
CC: exim-users
Subject: Re: [Exim] exim_dbmbuild and # signs
On Wed, 3 Mar 2004, John Jetmore wrote:

> I found out we have an established customer with an email address that
> starts with a pound sign. This is an established address, so we can't
> just tell them they can't have it. My problem is that exim_dbmbuild skips
> all lines that start with pound.


(You are lucky that I am bilingual, and understand that a North
American's "pound" is the # character. :-) This side of the pond,
"pound sign" is something different.)

You have just discovered a bug in exim_dbmbuild! If you RTFM, you find this:

----------------------------------------------------------------------
46.8 Making DBM files (exim_dbmbuild)

The "exim_dbmbuild" program reads an input file containing keys and data in
the format used by the lsearch lookup (see section 9.2).
----------------------------------------------------------------------

and if you read 9.2, you find:

----------------------------------------------------------------------
 .   lsearch: The given file is a text file that is searched linearly for a
     line beginning with the key, terminated by a colon or white space or the
     end of the line. The first occurrence that is found in the file is used.
     White space between the key and the colon is permitted. The remainder of
     the line, with leading and trailing white space removed, is the data.
     This can be continued onto subsequent lines by starting them with any
     amount of white space, but only a single space character is included in
     the data at such a junction. If the data begins with a colon, the key
     must be terminated by a colon, for example:


       baduser:  :fail:


     Empty lines and lines beginning with # are ignored, even if they occur in
     the middle of an item. This is the traditional textual format of alias
     files. Note that the keys in an lsearch file are literal strings. There
     is no wildcarding of any kind.


     In most lsearch files, keys are not required to contain colons and
     whitespace. However, if you need this feature, it is available. If a key
     begins with a doublequote character, it is terminated only by a matching
     quote (or end of line), and the normal escaping rules apply to its
     contents (see section 6.12). An optional colon is permitted after quoted
     keys (exactly as for unquoted keys). There is no special handling of
     quotes for the data part of an lsearch line.
----------------------------------------------------------------------


Note the final paragraph. I guess it should say "# characters" as well
as "colons and white space".

Unfortunately, though this stuff about quotes applies to Exim itself,
when processing lsearch files, it appears that I never updated dbmbuild
to handle quoted keys. I have noted the bug, and it will doubtless get
fixed in due course. If you fix it yourself, please send the patch.

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book