On 02/27/15 03:20, Anthony J. Bentley wrote:
> Guenther Niess writes:
>> On 02/26/15 16:47, Seth wrote:
>>> On Thu, 26 Feb 2015 03:51:37 -0800, Guenther Niess <ni...@pappanoa.de>
>>> wrote:
>>>
>>>> Hi,
>>>> I've problems with a password in the file /etc/mail/secrets containing
>>>> the hash symbol '#'. The passwords gets truncated before the hash
>>>> symbol, when I try to escape the hash symbol with a backslash \# the
>>>> full password with the backslash is sent to the relay server.
>>>> Is this a bug, or what section of the man page did I miss to escape
>>>> special characters in db files?
...
> 
> I reported this to bugs@ a while back, because I had hit the same issue.
> # in secrets definitely worked on OpenBSD at some point in the past
> (maybe before sendmail's makemap(8) was removed?).
> 

By looking into makemap.c it seems the bug was fixed by version 1.19 and
reintroduced by version version 1.50 not sure if it was intended.
I think the patch below is maybe the best fix for this issue, it allows
only whole line of comments and don't cut the fields if a hash symbol is
somewhere within a line.

Index: usr.sbin/smtpd/makemap.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/makemap.c,v
retrieving revision 1.52
diff -u -p -r1.52 makemap.c
--- usr.sbin/smtpd/makemap.c    20 Jan 2015 17:37:54 -0000      1.52
+++ usr.sbin/smtpd/makemap.c    8 Mar 2015 09:08:37 -0000
@@ -235,7 +235,7 @@ parse_map(char *filename)
        char    *line;
        size_t   len;
        size_t   lineno = 0;
-       char     delim[] = { '\\', '\\', '#' };
+       char     delim[] = { '\\', '\\', 0 };

        if (strcmp(filename, "-") == 0)
                fp = fdopen(0, "r");

Reply via email to