changeset 16289:9a5b132b6832

zlib: Don't crash when trying to use zlib_save for handler that isn't compiled in.
author Timo Sirainen <tss@iki.fi>
date Mon, 15 Apr 2013 21:40:35 +0300
parents b38d5ebacf25
children f33bacb03cc2
files src/plugins/zlib/zlib-plugin.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/zlib/zlib-plugin.c	Mon Apr 15 17:22:06 2013 +0300
+++ b/src/plugins/zlib/zlib-plugin.c	Mon Apr 15 21:40:35 2013 +0300
@@ -295,6 +295,10 @@
 		zuser->save_handler = compression_lookup_handler(name);
 		if (zuser->save_handler == NULL)
 			i_error("zlib_save: Unknown handler: %s", name);
+		else if (zuser->save_handler->create_ostream == NULL) {
+			i_error("zlib_save: Support not compiled in for handler: %s", name);
+			zuser->save_handler = NULL;
+		}
 	}
 	name = mail_user_plugin_getenv(user, "zlib_save_level");
 	if (name != NULL) {