This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: blmayer (bleemayer@gmail.com)
Date: Tue Oct 3 01:25:50 2023 -0300
Parent: e25680f
Added dir to exec
commit 2bc038169c0fdac9761e563aa569489774c38391
Author: blmayer <bleemayer@gmail.com>
Date: Tue Oct 3 01:25:50 2023 -0300
Added dir to exec
diff --git a/cmd/dovel/backend.go b/cmd/dovel/backend.go
index 51d7d0a..53d3afb 100644
--- a/cmd/dovel/backend.go
+++ b/cmd/dovel/backend.go
@@ -93,7 +93,7 @@ func (s *Session) Data(raw io.Reader) error {
}
// running handlers is optional
- h := path.Join(configPath, "hooks", "send-"+cfg.Domain)
+ h := "send-" + cfg.Domain
if f, err := os.Lstat(h); err == nil {
if !f.Mode().IsRegular() {
h, err = os.Readlink(h)
@@ -103,6 +103,7 @@ func (s *Session) Data(raw io.Reader) error {
}
c := exec.Command(h)
+ c.Dir = path.Join(configPath, "hooks")
c.Stdin = strings.NewReader(string(mess))
c.Stdout = os.Stdout
if err := c.Run(); err != nil {
@@ -116,7 +117,7 @@ func (s *Session) Data(raw io.Reader) error {
for _, to := range tos {
domain := strings.Split(to.Address, "@")[1]
- h := path.Join(configPath, "hooks", "receive-"+domain)
+ h := "receive-" + domain
if f, err := os.Lstat(h); err != nil {
slog.Error(domain, "receive error:", err.Error())
continue
@@ -128,6 +129,7 @@ func (s *Session) Data(raw io.Reader) error {
}
c := exec.Command(h)
+ c.Dir = path.Join(configPath, "hooks")
c.Stdin = strings.NewReader(string(mess))
c.Stdout = os.Stdout
if err := c.Run(); err != nil {