Re[2]: [Exim] SQL lookup fallthrough

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Peter A. Savitch
Datum:  
To: Bo Mellberg
Betreff: Re[2]: [Exim] SQL lookup fallthrough
Hello Bo,

Tuesday, April 23, 2002, 10:15:36 AM, you wrote:

>> > system_aliases:
>> > driver = redirect
>> > allow_fail
>> > allow_defer
>> > data = ${lookup{$local_part}lsearch{/etc/aliases}}
>> > # user = exim
>> > file_transport = address_file
>> > pipe_transport = address_pipe
>> >
>> > mysql_system_aliases:
>> > driver = redirect
>> > allow_fail
>> > file_transport = address_file
>> > pipe_transport = address_pipe
>> > data = ${lookup mysql{select members.emailaddress from members,
>> > $local_part where members.sheetnumber =
>> > $local_part.sheetnumber}{$value}fail}


[snip]

BM> When I do a "exim -bt root" it answers this:


BM> failed to expand "${lookup mysql{select members.emailaddress from members,
BM> $local_part where members.sheetnumber = $local_part.sheetnumber}}": lookup
BM> of "select members.emailaddress from members, root where members.sheetnumber
BM> = root.sheetnumber" gave DEFER: MYSQL: query failed: Table 'lve.root doesn't
BM> exist


BM> I have to be able to check if the table exists before I do the query. Is
BM> that possible?


See MySQL manual.

SHOW [OPEN] TABLES [FROM db_name] [LIKE wild]

This is almost like SELECT, but returns table name(s) in a single
column. So, You might wish to

SHOW TABLES LIKE '$local_part'

NOTE: XXX: `wild' is an SQL wildcard, specials are `%' and `_'.
See manual.

NOTE 2 !!! XXX:@@@ !!!
If You do not escape MySQL strings with quote_mysql, it's a security
hole in general . Table names can be enclosed into backticks: ` (ASCII
96) to contain unsafe chars. Specials in `wild' may be escaped by '\'.

NOTE 3: Hint: You can use generic `condition' for the router.

--
Best regards,
 Peter                            mailto:spam4octan@highway.ru