diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-04-27 20:51:56 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-04-27 20:51:56 +0400 |
commit | 8fe7e64dfae9c4da3a6b38769bf5d54d46d50beb (patch) | |
tree | c750b1e0a00803fe329977943275be6c4d433d2a /src/client/rspamc.c | |
parent | fe5e1614f36236654623667df4f317ae5e5e1806 (diff) | |
download | rspamd-8fe7e64dfae9c4da3a6b38769bf5d54d46d50beb.tar.gz rspamd-8fe7e64dfae9c4da3a6b38769bf5d54d46d50beb.zip |
* Add ability to specify dnsbls for smtp_proxy.
Fix handling of params with the same name in configuration.
Add ability for rspamc to bind on a local address.
Diffstat (limited to 'src/client/rspamc.c')
-rw-r--r-- | src/client/rspamc.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 7219d35b5..c96b5246a 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -39,6 +39,7 @@ static gchar *deliver_to = NULL; static gchar *rcpt = NULL; static gchar *user = NULL; static gchar *classifier = NULL; +static gchar *local_addr = NULL; static gint weight = 1; static gint flag; static gint timeout = 5; @@ -63,6 +64,7 @@ static GOptionEntry entries[] = { "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 }, { "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 }, { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; @@ -639,10 +641,24 @@ main (gint argc, gchar **argv, gchar **env) { enum rspamc_command cmd; gint i; + struct in_addr ina; - client = rspamd_client_init (); read_cmd_line (&argc, &argv); + + if (local_addr) { + if (inet_aton (local_addr, &ina) != 0) { + client = rspamd_client_init_binded (&ina); + } + else { + fprintf (stderr, "%s is not a valid ip address\n", local_addr); + exit (EXIT_FAILURE); + } + } + else { + client = rspamd_client_init (); + } + rspamd_set_timeout (client, 1000, timeout * 1000); tty = isatty (STDOUT_FILENO); /* Now read other args from argc and argv */ |