mirror of
https://github.com/chillout2k/ldap-acl-milter.git
synced 2025-12-11 02:30:17 +00:00
53 lines
1.6 KiB
Lua
53 lines
1.6 KiB
Lua
-- https://mopano.github.io/sendmail-filter-api/constant-values.html#com.sendmail.milter.MilterConstants
|
|
-- http://www.opendkim.org/miltertest.8.html
|
|
|
|
-- socket must be defined as miltertest global variable (-D)
|
|
conn = mt.connect(socket)
|
|
if conn == nil then
|
|
error "mt.connect() failed"
|
|
end
|
|
if mt.conninfo(conn, "localhost", "::1") ~= nil then
|
|
error "mt.conninfo() failed"
|
|
end
|
|
|
|
mt.set_timeout(60)
|
|
|
|
-- 5321.FROM+MACROS
|
|
mt.macro(conn, SMFIC_MAIL, "{auth_authen}", "blubb-user-wild")
|
|
if mt.mailfrom(conn, "tester-invalid@test.blah") ~= nil then
|
|
error "mt.mailfrom() failed"
|
|
end
|
|
if mt.getreply(conn) ~= SMFIR_CONTINUE then
|
|
error "mt.mailfrom() unexpected reply"
|
|
end
|
|
|
|
-- 5321.RCPT+MACROS
|
|
mt.macro(conn, SMFIC_RCPT, "i", "test-wildcard-qid")
|
|
if mt.rcptto(conn, "<anybody-xyz@out.there>") ~= nil then
|
|
error "mt.rcptto() failed"
|
|
end
|
|
if mt.getreply(conn) ~= SMFIR_CONTINUE then
|
|
error "mt.rcptto() unexpected reply"
|
|
end
|
|
|
|
-- 5322.HEADERS
|
|
if mt.header(conn, "fRoM", '"Blah Blubb" <tester@test.blah>') ~= nil then
|
|
error "mt.header(From) failed"
|
|
end
|
|
if mt.header(conn, "Authentication-RESULTS", "my-auth-serv-id;\n dkim=pass header.d=test.blah header.s=selector1-test-blah header.b=mumble") ~= nil then
|
|
error "mt.header(Authentication-Results) failed"
|
|
end
|
|
|
|
-- EOM
|
|
if mt.eom(conn) ~= nil then
|
|
error "mt.eom() failed"
|
|
end
|
|
mt.echo("EOM: " .. mt.getreply(conn))
|
|
if mt.getreply(conn) == SMFIR_CONTINUE then
|
|
mt.echo("EOM-continue")
|
|
elseif mt.getreply(conn) == SMFIR_REPLYCODE then
|
|
mt.echo("EOM-reject")
|
|
end
|
|
|
|
-- DISCONNECT
|
|
mt.disconnect(conn) |