From 5c7699450f6654f1ec62dc1910f5f3906e805eac Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 7 Oct 2017 13:00:28 +0300 Subject: [PATCH] NNCP_SENDER envvar while sendmail calling --- VERSION | 2 +- doc/cfg.texi | 4 +++- doc/news.ru.texi | 7 +++++++ doc/news.texi | 7 +++++++ ports/nncp/Makefile | 2 +- src/cypherpunks.ru/nncp/toss.go | 4 +++- 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 51176c7..c43e105 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11 +0.12 diff --git a/doc/cfg.texi b/doc/cfg.texi index 1a37f10..0420d39 100644 --- a/doc/cfg.texi +++ b/doc/cfg.texi @@ -89,7 +89,9 @@ synchronization protocol}. Contains authentication public key. @item sendmail An array containing path to executable and its command line arguments that is called for mail sending. If it is empty, then no mail processing -will be performed from that node. +will be performed from that node. Sendmail command +@command{["/bin/foo", "bar"]} called the following way: +@command{NNCP_SENDER=NODEID /bin/foo bar RCPT1 RCPT2 ... < MSG}. @anchor{CfgIncoming} @item incoming diff --git a/doc/news.ru.texi b/doc/news.ru.texi index f738d0e..98804fb 100644 --- a/doc/news.ru.texi +++ b/doc/news.ru.texi @@ -1,6 +1,13 @@ @node Новости @section Новости +@node Релиз 0.12 +@subsection Релиз 0.12 +@itemize +@item +Команда sendmail вызывается с @env{NNCP_SENDER} переменной окружения. +@end itemize + @node Релиз 0.11 @subsection Релиз 0.11 @itemize diff --git a/doc/news.texi b/doc/news.texi index 8c3ec1a..8f36b4b 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -3,6 +3,13 @@ See also this page @ref{Новости, on russian}. +@node Release 0.12 +@section Release 0.12 +@itemize +@item +Sendmail command is called with @env{NNCP_SENDER} environment variable. +@end itemize + @node Release 0.11 @section Release 0.11 @itemize diff --git a/ports/nncp/Makefile b/ports/nncp/Makefile index 25bff5d..22b3313 100644 --- a/ports/nncp/Makefile +++ b/ports/nncp/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= nncp -PORTVERSION= 0.11 +PORTVERSION= 0.12 CATEGORIES= net MASTER_SITES= http://www.nncpgo.org/download/ diff --git a/src/cypherpunks.ru/nncp/toss.go b/src/cypherpunks.ru/nncp/toss.go index 2fb4cbb..962b240 100644 --- a/src/cypherpunks.ru/nncp/toss.go +++ b/src/cypherpunks.ru/nncp/toss.go @@ -98,7 +98,8 @@ func (ctx *Ctx) Toss(nodeId *NodeId, nice uint8, dryRun bool) bool { if err != nil { log.Fatalln(err) } - sendmail := ctx.Neigh[*job.PktEnc.Sender].Sendmail + sender := ctx.Neigh[*job.PktEnc.Sender] + sendmail := sender.Sendmail if len(sendmail) == 0 { ctx.LogE("rx", SdsAdd(sds, SDS{"err": "No sendmail configured"}), "") isBad = true @@ -112,6 +113,7 @@ func (ctx *Ctx) Toss(nodeId *NodeId, nice uint8, dryRun bool) bool { strings.Split(recipients, " ")..., )..., ) + cmd.Env = append(cmd.Env, "NNCP_SENDER=" + sender.Id.String()) cmd.Stdin = decompressor if err = cmd.Run(); err != nil { ctx.LogE("rx", SdsAdd(sds, SDS{"err": err}), "sendmail") -- 2.44.0