Hello tech@,

I send this patch in to m...@opensmtpd.org a couple of days ago, but
since there is a hackathon ongoing I thought I might send it here as
well.

When running against the sqlite backend I noticed that multiple chained
aliases/virtual users I would receive an invalid user. This turned out
to be because the lookup always would return the original user along
with extra users that were retrieved from the database.

I found that table_msg_dispatch didn't initialize res, so every request
would (by chance?) still have the residual previous request, which got
the new result appended by table_sqlite_lookup.

The patch below initializes this memory and fixes the bug for me.

Index: table_api.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/table_api.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 table_api.c
--- table_api.c 4 Feb 2014 13:55:34 -0000       1.4
+++ table_api.c 9 Jul 2014 08:36:17 -0000
@@ -108,6 +108,7 @@ table_msg_dispatch(void)
        char             res[4096];
        int              type, r;
 
+       bzero(res, sizeof(res));
        switch (imsg.hdr.type) {
        case PROC_TABLE_OPEN:
                table_msg_get(&op, sizeof op);

Sincerely,

Martijn van Duren

Reply via email to