Chinaunix

标题: 求助 postmap查询mysql错误. [打印本页]

作者: joeywong    时间: 2007-08-14 15:30
标题: 求助 postmap查询mysql错误.
有一个mysql-recipient.cf文件内容如下:
user = root
password = zzzzz
dbname = postfix
hosts = 127.0.0.1
query = SELECT class FROM tbRecipientClasses WHERE id = '%s'

运行 postmap -q aaa@abc.com mysql:mysql-recipeint.cf 时报错: postmap: fatal: bad string length 0 < 1: mysql-recipient.cf_dbname =

我在mysql里面运行"SELECT class FROM tbRecipientClasses"没有问题, 真是百思不得其解.   
作者: xmbbx    时间: 2007-08-15 17:55
原帖由 joeywong 于 2007-8-14 15:30 发表
有一个mysql-recipient.cf文件内容如下:
user = root
password = zzzzz
dbname = postfix
hosts = 127.0.0.1
query = SELECT class FROM tbRecipientClasses WHERE id = '%s'

运行 postmap -q aaa@a ...


这个不是用来postmap的。是在main.cf中用的。
如:smtpd_client_restrictions = mysql:/etc/postfix/mysql-recipient.cf
作者: joeywong    时间: 2007-08-16 15:40
这个cf文件是用于main.cf中的设定. 但应该可以用postmap测试它的运行结果吧?  ldap和hash的都可以, mysql的不行吗?
作者: xmbbx    时间: 2007-08-16 16:07
http://www.postfix.org/postmap.1.html
       as of Postfix 2.3 this  case
       folding  happens  only  with  tables whose lookup keys are
       fixed-case strings such as btree:,  dbm:  or  hash:.  With
       earlier  versions,  the  lookup  key  is  folded even with
       tables where a lookup field can match both upper and lower
       case  text,  such  as  regexp: and pcre:.
作者: xmbbx    时间: 2007-08-20 16:01
原帖由 joeywong 于 2007-8-16 15:40 发表
这个cf文件是用于main.cf中的设定. 但应该可以用postmap测试它的运行结果吧?  ldap和hash的都可以, mysql的不行吗?


不好意思,上次是我弄错了.mysql也是可以的

今天刚好也碰到这个问题,于是测试了一下,发现是因为你没有在mysql:后面加上绝对路径:
比如正确的是: postmap -q test@test.com mysql:/root/test.cf




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2