Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ai3
docker
lurker
Commits
ab1dc55f
Commit
ab1dc55f
authored
Aug 01, 2019
by
ale
Browse files
Report lurker-index errors to client
parent
64ce65b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
smtpd.go
View file @
ab1dc55f
...
...
@@ -25,7 +25,7 @@ var (
port
=
flag
.
Int
(
"port"
,
getenvInt
(
"SMTP_PORT"
),
"smtp port"
)
hostname
=
flag
.
String
(
"ehlo-hostname"
,
os
.
Getenv
(
"SMTP_EHLO_HOSTNAME"
),
"EHLO hostname"
)
lurkerLibDir
=
flag
.
String
(
"lurker-lib-dir"
,
os
.
Getenv
(
"LURKER_LIB_DIR"
),
"lurker library dir"
)
addrPattern
=
flag
.
String
(
"addr-rx"
,
getenvDefault
(
"LURKER_ADDR_RX"
,
"
lurker+([^@]+)@.*
"
),
"recipient address regular expression"
)
addrPattern
=
flag
.
String
(
"addr-rx"
,
getenvDefault
(
"LURKER_ADDR_RX"
,
`
lurker
\
+([^@]+)@.*
`
),
"recipient address regular expression"
)
)
var
addrRx
*
regexp
.
Regexp
...
...
@@ -50,8 +50,13 @@ func isMaintenanceModeOn() bool {
func
lurkerIndexMsg
(
listName
string
,
data
[]
byte
)
error
{
cmd
:=
exec
.
Command
(
"lurker-index"
,
"-m"
,
"-l"
,
listName
)
cmd
.
Stdin
=
bytes
.
NewReader
(
data
)
cmd
.
Stderr
=
os
.
Stderr
return
cmd
.
Run
()
out
,
err
:=
cmd
.
CombinedOutput
()
if
err
!=
nil
{
outStr
:=
strings
.
Replace
(
strings
.
TrimSpace
(
string
(
out
)),
"
\n
"
,
"; "
,
-
1
)
log
.
Printf
(
"lurker-index error: %v, %s"
,
err
,
outStr
)
return
smtpd
.
Error
{
550
,
outStr
}
}
return
nil
}
func
parseRecipientAddr
(
addr
string
)
(
string
,
error
)
{
...
...
@@ -83,7 +88,7 @@ func handleMessage(peer smtpd.Peer, env smtpd.Envelope) error {
return
err
}
if
err
:=
lurkerIndexMsg
(
listName
,
env
.
Data
);
err
!=
nil
{
return
smtpd
.
Error
{
550
,
fmt
.
Sprintf
(
"lurker-index error: %v"
,
err
)}
return
err
}
}
return
nil
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment