From cd70c003175437ac28df21249bbf005a9848b3f5 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 8 Mar 2010 23:29:46 +0000 Subject: [PATCH] - Fixed bug #51237 (milter SAPI crash on startup) patch by: igmar at palsenberg dot com --- NEWS | 1 + sapi/milter/php_milter.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8c5a3ec525..e1f3bc1c86 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2010, PHP 5.2.14 - Updated timezone database to version 2010.3. (Derick) +- Fixed bug #51237 (milter SAPI crash on startup). (igmar at palsenberg dot com) - Fixed bug #51213 (pdo_mssql is trimming value of the money column). (Ilia, alexr at oplot dot com) - Fixed bug #51192 (FILTER_VALIDATE_URL will invalidate a hostname that diff --git a/sapi/milter/php_milter.c b/sapi/milter/php_milter.c index 79ca631126..5d7d1f86b5 100644 --- a/sapi/milter/php_milter.c +++ b/sapi/milter/php_milter.c @@ -92,7 +92,7 @@ extern char *ap_php_optarg; extern int ap_php_optind; static int flag_debug=0; -static char *filename; +static char *filename = NULL; /* per thread */ ZEND_BEGIN_MODULE_GLOBALS(milter) @@ -127,6 +127,11 @@ static int mlfi_init() /* disable headers */ SG(headers_sent) = 1; SG(request_info).no_headers = 1; + + if (filename == NULL) { + php_printf("No input file specified"); + return SMFIS_TEMPFAIL; + } if (!(file_handle.handle.fp = VCWD_FOPEN(filename, "rb"))) { php_printf("Could not open input file: %s\n", filename); @@ -189,6 +194,11 @@ static sfsistat mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) SG(headers_sent) = 1; SG(request_info).no_headers = 1; + if (filename == NULL) { + php_printf("No input file specified"); + return SMFIS_TEMPFAIL; + } + if (!(file_handle.handle.fp = VCWD_FOPEN(filename, "rb"))) { php_printf("Could not open input file: %s\n", filename); return SMFIS_TEMPFAIL; -- 2.50.1