# HG changeset patch # User carl # Date 1194718854 28800 # Node ID 2a80c9b5d2c9de26e7d7c3f2cc4f3abdd97159fe # Parent 505283ab296c55872659167497fe81332cff5ff6 fix null pointer dereference from missing HELO command diff -r 505283ab296c -r 2a80c9b5d2c9 src/dnsbl.cpp --- a/src/dnsbl.cpp Sat Oct 13 17:42:30 2007 -0700 +++ b/src/dnsbl.cpp Sat Nov 10 10:20:54 2007 -0800 @@ -64,7 +64,6 @@ extern "C" { - #include sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr); sfsistat mlfi_helo(SMFICTX * ctx, char *helohost); sfsistat mlfi_envfrom(SMFICTX *ctx, char **argv); @@ -425,7 +424,16 @@ } } -#define MLFIPRIV ((struct mlfiPriv *) smfi_getpriv(ctx)) + +mlfiPriv* fetch_priv_from_ctx(SMFICTX *ctx); +mlfiPriv* fetch_priv_from_ctx(SMFICTX *ctx) +{ + mlfiPriv *priv = (struct mlfiPriv *)smfi_getpriv(ctx); + priv.ctx = ctx; + return priv; +} +#define MLFIPRIV fetch_priv_from_ctx(ctx) + //////////////////////////////////////////////// @@ -559,6 +567,11 @@ // int dns_interface(mlfiPriv &priv, char *question, bool maybe_ip, ns_map *nameservers); int dns_interface(mlfiPriv &priv, char *question, bool maybe_ip, ns_map *nameservers) { + // tell sendmail we are still working + #if _FFR_SMFI_PROGRESS + smfi_progress(priv.ctx); + #endif + // this part can be done without locking the resolver mutex. Each // milter thread is talking over its own socket to a separate resolver // process, which does the actual dns resolution. @@ -972,7 +985,7 @@ sfsistat mlfi_helo(SMFICTX * ctx, char *helohost) { mlfiPriv &priv = *MLFIPRIV; - priv.helo = strdup(helohost); + priv.helo = (helohost) ? strdup(helohost) : strdup("missing"); return SMFIS_CONTINUE; }