commit - b52f2785ca72c2a5e335e05fe50167f0cc149125
commit + 421c9a869ac123f10541b043bb90c9732c53a182
blob - 9466ccb87c208d397e9c01ec070331d586bc5321
blob + 058ec505a4fc0414c12fdbc283f639e34db14327
--- opensmtpd.c
+++ opensmtpd.c
char *, char *);
static void osmtpd_connect(struct osmtpd_callback *, struct osmtpd_ctx *,
char *, char *);
+static void osmtpd_identify(struct osmtpd_callback *, struct osmtpd_ctx *,
+ char *, char *);
static void osmtpd_link_connect(struct osmtpd_callback *, struct osmtpd_ctx *,
char *, char *);
static void osmtpd_link_disconnect(struct osmtpd_callback *,
OSMTPD_TYPE_FILTER,
OSMTPD_PHASE_HELO,
1,
- osmtpd_onearg,
+ osmtpd_identify,
NULL,
0,
0
OSMTPD_TYPE_FILTER,
OSMTPD_PHASE_EHLO,
1,
- osmtpd_onearg,
+ osmtpd_identify,
NULL,
0,
0
int registered = 0;
/* Doesn't leak, since it needs to exists until the application ends. */
struct io *io_stdin;
+ struct osmtpd_callback *hidenity, *eidentity, *ridentity;
event_init();
OSMTPD_PHASE_TX_COMMIT,
osmtpd_callbacks[i].incoming, 0, NULL);
}
+ if (osmtpd_callbacks[i].type == OSMTPD_TYPE_FILTER &&
+ osmtpd_callbacks[i].phase == OSMTPD_PHASE_HELO)
+ hidenity = &(osmtpd_callbacks[i]);
+ if (osmtpd_callbacks[i].type == OSMTPD_TYPE_FILTER &&
+ osmtpd_callbacks[i].phase == OSMTPD_PHASE_EHLO)
+ eidentity = &(osmtpd_callbacks[i]);
+ if (osmtpd_callbacks[i].type == OSMTPD_TYPE_REPORT &&
+ osmtpd_callbacks[i].phase ==
+ OSMTPD_PHASE_LINK_IDENTIFY &&
+ osmtpd_callbacks[i].incoming == 1)
+ ridentity = &(osmtpd_callbacks[i]);
}
}
+ if (ridentity->storereport) {
+ if (hidenity->doregister)
+ hidenity->storereport = 1;
+ if (eidentity->doregister)
+ eidentity->storereport = 1;
+ }
for (i = 0; i < NITEMS(osmtpd_callbacks); i++) {
if (osmtpd_callbacks[i].doregister) {
if (osmtpd_callbacks[i].cb != NULL)
}
static void
+osmtpd_identify(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx,
+ char *identity, char *linedup)
+{
+ void (*f)(struct osmtpd_ctx *, const char *);
+
+ if (cb->storereport) {
+ free(ctx->identity);
+ if ((ctx->identity = strdup(identity)) == NULL)
+ osmtpd_err(1, "strdup");
+ }
+
+ f = cb->cb;
+ f(ctx, identity);
+}
+
+static void
osmtpd_link_connect(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx,
char *params, char *linedup)
{
void (*f)(struct osmtpd_ctx *, const char *);
if (cb->storereport) {
+ free(ctx->greeting.identity);
if ((ctx->greeting.identity = strdup(identity)) == NULL)
osmtpd_err(1, NULL);
}
void (*f)(struct osmtpd_ctx *, const char *);
if (cb->storereport) {
+ free(ctx->identity);
if ((ctx->identity = strdup(identity)) == NULL)
osmtpd_err(1, NULL);
}