Author: bh
Date: 2007-07-04 18:17:37 +0200 (Wed, 04 Jul 2007)
New Revision: 250
Modified:
trunk/openvas-server/ChangeLog
trunk/openvas-server/openvasd/comm.c
trunk/openvas-server/openvasd/plugs_hash.c
Log:
* openvasd/plugs_hash.c (plugins_hash): Handle errors from
gcry_md_open. plugins_hash may return NULL now.
* openvasd/comm.c (comm_send_md5_plugins): Handle case where
plugins_hash returns NULL.
Modified: trunk/openvas-server/ChangeLog
===================================================================
--- trunk/openvas-server/ChangeLog 2007-07-02 20:03:21 UTC (rev 249)
+++ trunk/openvas-server/ChangeLog 2007-07-04 16:17:37 UTC (rev 250)
@@ -1,3 +1,11 @@
+2007-07-04 Bernhard Herzog <[EMAIL PROTECTED]>
+
+ * openvasd/plugs_hash.c (plugins_hash): Handle errors from
+ gcry_md_open. plugins_hash may return NULL now.
+
+ * openvasd/comm.c (comm_send_md5_plugins): Handle case where
+ plugins_hash returns NULL.
+
2007-07-02 Bernhard Herzog <[EMAIL PROTECTED]>
* openvasd/plugs_hash.c (file_hash, plugins_hash): Use unsigned
Modified: trunk/openvas-server/openvasd/comm.c
===================================================================
--- trunk/openvas-server/openvasd/comm.c 2007-07-02 20:03:21 UTC (rev
249)
+++ trunk/openvas-server/openvasd/comm.c 2007-07-04 16:17:37 UTC (rev
250)
@@ -627,6 +627,12 @@
char buf[2048];
md5 = plugins_hash(globals);
+ if (md5 == NULL)
+ {
+ /* This should only happen in severe circumstances */
+ log_write("comm_send_md5_plugins: could not determine plugins hash\n");
+ return;
+ }
auth_printf(globals, "SERVER <|> PLUGINS_MD5 <|> %s <|> SERVER\n", md5);
efree(&md5);
Modified: trunk/openvas-server/openvasd/plugs_hash.c
===================================================================
--- trunk/openvas-server/openvasd/plugs_hash.c 2007-07-02 20:03:21 UTC (rev
249)
+++ trunk/openvas-server/openvasd/plugs_hash.c 2007-07-04 16:17:37 UTC (rev
250)
@@ -133,8 +133,10 @@
/*
- * returns the hash of the hashes of the plugins in the
- * plugins dir + plugins in the user home dir
+ * returns the hash of the hashes of the plugins in the plugins dir +
+ * plugins in the user home dir. Returns NULL in case of severe errors
+ * (for instance if libgrypt cannot initialize the md5 message digest
+ * object).
*/
char *
plugins_hash(globals)
@@ -144,10 +146,18 @@
char *dir = arg_get_value(preferences, "plugins_folder");
char *uhome;
gcry_md_hd_t ctx;
+ gcry_error_t err;
unsigned char * digest;
char * ret;
-
- gcry_md_open(&ctx, GCRY_MD_MD5, 0);
+
+ err = gcry_md_open(&ctx, GCRY_MD_MD5, 0);
+ if (err)
+ {
+ log_write("plugins_hash(): gcry_md_open failed: %s/%s\n",
+ gcry_strsource(err), gcry_strerror(err));
+ return NULL;
+ }
+
/* FIXME: check for error return from gcry_md_open */
dir_plugins_hash(ctx, dir);
uhome = user_home(globals);
_______________________________________________
Openvas-commits mailing list
[email protected]
http://lists.wald.intevation.org/mailman/listinfo/openvas-commits