Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #61 from fgma/mysql-update
Browse files Browse the repository at this point in the history
support for mailaddrmap lookups in table-mysql
  • Loading branch information
poolpOrg authored Oct 18, 2019
2 parents 62f61d5 + 9e92f57 commit 36cc595
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extras/tables/table-mysql/table-mysql.5
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ This is used to provide a query for looking up a domain. The question mark
is replaced with the appropriate data. For the domain it would be the
right hand side of the SMTP address. This expects one VARCHAR to be returned
with a matching domain name.
.Pp

.It Xo
.Ic query_mailaddrmap
.Ar SQL statement
.Xc
This is used to provide a query to look up senders. The question mark
is replaced with the appropriate data. This expects one VARCHAR to be
returned with the address the sender is allowed to send mails from.
.El

A generic SQL statement would be something like:
Expand Down
3 changes: 3 additions & 0 deletions extras/tables/table-mysql/table_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum {
SQL_SOURCE,
SQL_MAILADDR,
SQL_ADDRNAME,
SQL_MAILADDRMAP,

SQL_MAX
};
Expand Down Expand Up @@ -240,6 +241,7 @@ config_connect(struct config *conf)
{ "query_source", 1 },
{ "query_mailaddr", 1 },
{ "query_addrname", 1 },
{ "query_mailaddrmap", 1 },
};
my_bool reconn;
size_t i;
Expand Down Expand Up @@ -435,6 +437,7 @@ table_mysql_lookup(int service, struct dict *params, const char *key, char *dst,

switch(service) {
case K_ALIAS:
case K_MAILADDRMAP:
memset(dst, 0, sz);
do {
if (dst[0] && strlcat(dst, ", ", sz) >= sz) {
Expand Down

0 comments on commit 36cc595

Please sign in to comment.