summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-06 16:31:27 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-06 16:31:27 +0000
commit3acedc39adb56990a6241936814938afaf96b8bb (patch)
treee909178e2b6e974438a66fed109f2c0ffdcd17a0
parentedbf8c405d6f8dca694695519478f7efe826fbb8 (diff)
downloadrspamd-3acedc39adb56990a6241936814938afaf96b8bb.tar.gz
rspamd-3acedc39adb56990a6241936814938afaf96b8bb.zip
Support hostname and helo in rspamc client.
-rw-r--r--doc/rspamc.111
-rw-r--r--doc/rspamc.1.md8
-rw-r--r--src/client/rspamc.c10
3 files changed, 28 insertions, 1 deletions
diff --git a/doc/rspamc.1 b/doc/rspamc.1
index 73be9afb4..b0670c1ee 100644
--- a/doc/rspamc.1
+++ b/doc/rspamc.1
@@ -115,6 +115,17 @@ Emulate that message is for specified user
.RS
.RE
.TP
+.B --helo=\f[I]helo_string\f[]
+Imitate SMTP HELO passing from MTA
+.RS
+.RE
+.TP
+.B --hostname=\f[I]hostname\f[]
+Imitate hostname passing from MTA (rspamd assumes that it is verified by
+MTA)
+.RS
+.RE
+.TP
.B -t \f[I]seconds\f[], --timeout=\f[I]seconds\f[]
Timeout for waiting for a reply
.RS
diff --git a/doc/rspamc.1.md b/doc/rspamc.1.md
index 531e0802d..b28e72609 100644
--- a/doc/rspamc.1.md
+++ b/doc/rspamc.1.md
@@ -75,6 +75,12 @@ requires input.
-r *user@domain*, \--rcpt=*user@domain*
: Emulate that message is for specified user
+\--helo=*helo_string*
+: Imitate SMTP HELO passing from MTA
+
+\--hostname=*hostname*
+: Imitate hostname passing from MTA (rspamd assumes that it is verified by MTA)
+
-t *seconds*, \--timeout=*seconds*
: Timeout for waiting for a reply
@@ -131,4 +137,4 @@ Add custom action's weight:
Rspamd documentation and source codes may be downloaded from
<https://rspamd.com/>.
-[rspamd-workers]: https://rspamd.com/doc/rspamd-workers.html \ No newline at end of file
+[rspamd-workers]: https://rspamd.com/doc/workers/ \ No newline at end of file
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index c90ad1fc8..00d85328d 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -38,6 +38,8 @@ static gchar *from = NULL;
static gchar *deliver_to = NULL;
static gchar *rcpt = NULL;
static gchar *user = NULL;
+static gchar *helo = NULL;
+static gchar *hostname = NULL;
static gchar *classifier = "bayes";
static gchar *local_addr = NULL;
static gint weight = 1;
@@ -63,6 +65,8 @@ static GOptionEntry entries[] =
{ "deliver", 'd', 0, G_OPTION_ARG_STRING, &deliver_to, "Emulate that message is delivered to specified user", NULL },
{ "from", 'F', 0, G_OPTION_ARG_STRING, &from, "Emulate that message is from specified user", NULL },
{ "rcpt", 'r', 0, G_OPTION_ARG_STRING, &rcpt, "Emulate that message is for specified user", NULL },
+ { "helo", 0, 0, G_OPTION_ARG_STRING, &helo, "Imitate SMTP HELO passing from MTA", NULL },
+ { "hostname", 0, 0, G_OPTION_ARG_STRING, &hostname, "Imitate hostname passing from MTA", NULL },
{ "timeout", 't', 0, G_OPTION_ARG_INT, &timeout, "Timeout for waiting for a reply", NULL },
{ "bind", 'b', 0, G_OPTION_ARG_STRING, &local_addr, "Bind to specified ip address", NULL },
{ "commands", 0, 0, G_OPTION_ARG_NONE, &print_commands, "List available commands", NULL },
@@ -454,6 +458,12 @@ add_options (GHashTable *opts)
if (deliver_to != NULL) {
g_hash_table_insert (opts, "Deliver-To", deliver_to);
}
+ if (helo != NULL) {
+ g_hash_table_insert (opts, "Helo", helo);
+ }
+ if (hostname != NULL) {
+ g_hash_table_insert (opts, "Hostname", hostname);
+ }
if (pass_all) {
g_hash_table_insert (opts, "Pass", "all");
}