Commit 606fca10 606fca10b6570f9fc4be3e3117fd147aac2a2039 by Sergey Poznyakoff

New tag :user.

1 parent 7cc7c42f
......@@ -235,6 +235,7 @@ sigpipe_handler (int sig MU_ARG_UNUSED)
/* Syntax: spamd [":host" <tcp-host: string]
[":port" <tcp-port: number> /
":socket" <unix-socket: string>]
[":user" <name: string>]
[":over" / ":under" <limit: string>]
The "spamd" test is an interface to "spamd" facility of
......@@ -269,7 +270,6 @@ spamd_test (mu_sieve_machine_t mach, mu_list_t args, mu_list_t tags)
mu_sieve_value_t *arg;
mu_message_t msg;
size_t m_size, m_lines, size;
struct mu_auth_data *auth;
signal_handler handler;
char *host;
mu_header_t hdr;
......@@ -302,12 +302,17 @@ spamd_test (mu_sieve_machine_t mach, mu_list_t args, mu_list_t tags)
mu_message_size (msg, &m_size);
mu_message_lines (msg, &m_lines);
auth = mu_get_auth_by_uid (geteuid ());
spamd_send_command (stream, "SYMBOLS SPAMC/1.2");
spamd_send_command (stream, "Content-length: %lu",
(u_long) (m_size + m_lines));
if (mu_sieve_tag_lookup (tags, "user", &arg))
spamd_send_command (stream, "User: %s", arg);
else
{
struct mu_auth_data *auth = mu_get_auth_by_uid (geteuid ());
spamd_send_command (stream, "User: %s", auth ? auth->name : "root");
mu_auth_data_free (auth);
}
got_sigpipe = 0;
handler = set_signal_handler (SIGPIPE, sigpipe_handler);
......@@ -411,6 +416,7 @@ static mu_sieve_tag_def_t spamd_tags[] = {
{ "host", SVT_STRING },
{ "port", SVT_NUMBER },
{ "socket", SVT_STRING },
{ "user", SVT_STRING },
{ "over", SVT_STRING },
{ "under", SVT_STRING },
{ NULL }
......