return SSM_PASS;
}
-#define SAVEPARM(x) \
-static int \
-ssm_nmsg_##x(struct conn *c, const char *cmd, int len, int argoff) { \
- struct ssm_nmsg_state *nms = ssm_getpriv(&ss_module, c); \
- const uint8_t *data = (const uint8_t *)cmd; \
- if (nms && nms->msg) \
- nmsg_message_set_field(nms->msg, #x, 0, data + argoff, \
- len - argoff + 1); \
- return SSM_PASS; \
+static int
+ssm_nmsg_helo(struct conn *c, const char *cmd, int len, int argoff)
+{
+ struct ssm_nmsg_state *nms = ssm_getpriv(&ss_module, c);
+ uint8_t *data = malloc(len + 1);
+
+ memcpy(data,cmd,len);
+ data[len] = 0;
+ if (nms && nms->msg)
+ nmsg_message_set_field(nms->msg, "helo", 0, data+argoff,
+ len - argoff + 1);
+ free(data);
+ return SSM_PASS;
}
-SAVEPARM(helo)
-SAVEPARM(from)
-SAVEPARM(rcpt)
-
static void
ssm_nmsg_body(struct conn *c, const char *data, int len)
{
ssm_nmsg_connect,
ssm_nmsg_helo,
- ssm_nmsg_from,
- ssm_nmsg_rcpt,
+ 0,
+ 0,
0,
ssm_nmsg_body,
ssm_nmsg_enddata,