postmp -s
列出了测试文件的内容,但postmap -q
与查询不匹配。我遗漏了什么?
Postfix 版本和测试文件
[root@relay postfix]# rpm -q postfix
postfix-3.9.0-8.fc41.x86_64
[root@relay postfix]# cat accessTest
[email protected] OK
[email protected] REJECT
[email protected] OK
[email protected] 521
建立数据库并显示内容
[root@relay postfix]# postmap -v accessTest
postmap: name_mask: ipv4
postmap: inet_addr_local: configured 2 IPv4 addresses
postmap: open hash accessTest
postmap: Compiled against Berkeley DB: 5.3.28?
postmap: Run-time linked against Berkeley DB: 5.3.28?
[root@relay postfix]# postmap -s accessTest
[email protected] OK
[email protected] REJECT
[email protected] OK
[email protected] 521
测试查询返回 Shell 错误
[root@orelay postfix]# postmap -q aaa@ accessTest
[root@relay postfix]# echo $?
1
还测试了:
postmap -q example.com accessTest
postmap -q .example.com accessTest
postmap -q ddd@ accessTest
postmap -q ddd+extra@ accessTest
全部返回 shell 代码 1。
与我对man 5 postmap中标题为“索引表中的电子邮件地址模式”部分的理解相反,
postmap
它实际上并不匹配部分键。该部分的第一段解释了然后继续列出
user@domain
、domain.tld
、.domain.tld
和user@
按顺序进行搜索。但是,该潜在的部分匹配循环必定发生在
postmap
其自身上游的某个地方。如果我使用accessTest
上面给出的表格,则只有在我明确搜索时postmap -q
才会返回值(“ ”) 。如果我搜索我认为会与 匹配的,则搜索会失败。OK
[email protected]
aaa@
user@
因此,如果在 中测试键/值匹配
postmap
,则仅测试精确键,否则搜索将失败。虽然潜在的部分匹配可能会通过某些上游循环返回值,但postmap
它本身不会这样做。