rspamd_milter_on_protocol_error (struct rspamd_milter_session *session,
struct rspamd_milter_private *priv, GError *err)
{
+ msg_debug_milter ("protocol error: %e", err);
priv->state = RSPAMD_MILTER_WANNA_DIE;
REF_RETAIN (session);
priv->err_cb (priv->fd, session, priv->ud, err);
case RSPAMD_MILTER_REJECT:
case RSPAMD_MILTER_TEMPFAIL:
/* No additional arguments */
+ msg_debug_milter ("send %c command", cmd);
SET_COMMAND (cmd, 0, reply, pos);
break;
case RSPAMD_MILTER_QUARANTINE:
}
len = strlen (reason);
+ msg_debug_milter ("send quarantine action %s", reason);
SET_COMMAND (cmd, len + 1, reply, pos);
memcpy (pos, reason, len + 1);
break;
value = va_arg (ap, GString *);
/* Name and value must be zero terminated */
+ msg_debug_milter ("add header command - \"%v\"=\"%v\"", name, value);
SET_COMMAND (cmd, name->len + value->len + 2, reply, pos);
memcpy (pos, name->str, name->len + 1);
pos += name->len + 1;
break;
case RSPAMD_MILTER_CHGHEADER:
case RSPAMD_MILTER_INSHEADER:
- idx = htonl (va_arg (ap, guint32));
+ idx = va_arg (ap, guint32);
name = va_arg (ap, GString *);
value = va_arg (ap, GString *);
+ msg_debug_milter ("change/insert header command pos = %d- \"%v\"=\"%v\"",
+ idx, name, value);
/* Name and value must be zero terminated */
SET_COMMAND (cmd, name->len + value->len + 2 + sizeof (guint32),
reply, pos);
+ idx = htonl (idx);
memcpy (pos, &idx, sizeof (idx));
pos += sizeof (idx);
memcpy (pos, name->str, name->len + 1);
case RSPAMD_MILTER_CHGFROM:
/* Single GString * argument */
value = va_arg (ap, GString *);
+ msg_debug_milter ("command %c; value=%v", cmd, value);
SET_COMMAND (cmd, value->len + 1, reply, pos);
memcpy (pos, value->str, value->len + 1);
break;
case RSPAMD_MILTER_OPTNEG:
- ver = htonl (va_arg (ap, guint32));
- actions = htonl (va_arg (ap, guint32));
- protocol = htonl (va_arg (ap, guint32));
-
+ ver = va_arg (ap, guint32);
+ actions = va_arg (ap, guint32);
+ protocol = va_arg (ap, guint32);
+
+ msg_debug_milter ("optneg reply: ver=%d, actions=%d, protocol=%d",
+ ver, actions, protocol);
+ ver = htonl (ver);
+ actions = htonl (actions);
+ protocol = htonl (protocol);
SET_COMMAND (cmd, sizeof (guint32) * 3, reply, pos);
memcpy (pos, &ver, sizeof (ver));
pos += sizeof (ver);