"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "util/nvticache.c" between
gvm-libs-10.0.1.tar.gz and gvm-libs-11.0.0.tar.gz

About: GVM Libraries for the Greenbone Vulnerability Management (GVM-10) framework (derived from the former openvas-libraries).

nvticache.c  (gvm-libs-10.0.1):nvticache.c  (gvm-libs-11.0.0)
skipping to change at line 87 skipping to change at line 87
if (src_path) if (src_path)
g_free (src_path); g_free (src_path);
src_path = g_strdup (src); src_path = g_strdup (src);
if (cache_kb) if (cache_kb)
kb_lnk_reset (cache_kb); kb_lnk_reset (cache_kb);
cache_kb = kb_find (kb_path, NVTICACHE_STR); cache_kb = kb_find (kb_path, NVTICACHE_STR);
if (cache_kb) if (cache_kb)
return 0; return 0;
if (kb_new (&cache_kb, kb_path) if (kb_new (&cache_kb, kb_path)
|| kb_item_set_str (cache_kb, NVTICACHE_STR, "1", 0)) || kb_item_set_str (cache_kb, NVTICACHE_STR, "0", 0))
return -1; return -1;
return 0; return 0;
} }
/** /**
* @brief Return the nvticache kb. * @brief Return the nvticache kb.
* *
* @return Cache kb. * @return Cache kb.
*/ */
kb_t kb_t
skipping to change at line 184 skipping to change at line 184
g_free (fcontent); g_free (fcontent);
return plugin_set; return plugin_set;
} }
/** /**
* @brief Save the nvticache to disk. * @brief Save the nvticache to disk.
*/ */
void void
nvticache_save () nvticache_save ()
{ {
char *feed_version; char *feed_version, *old_version;
if (cache_kb && !cache_saved) if (cache_kb && !cache_saved)
{ {
kb_save (cache_kb); kb_save (cache_kb);
cache_saved = 1; cache_saved = 1;
} }
if ((feed_version = nvt_feed_version ())) old_version = nvticache_feed_version ();
kb_item_set_str (cache_kb, NVTICACHE_STR, feed_version, 0); feed_version = nvt_feed_version ();
if (g_strcmp0 (old_version, feed_version))
{
kb_item_set_str (cache_kb, NVTICACHE_STR, feed_version, 0);
g_message ("Updated NVT cache from version %s to %s", old_version,
feed_version);
}
g_free (old_version);
g_free (feed_version); g_free (feed_version);
} }
/** /**
* @brief Add a NVT Information to the cache. * @brief Add a NVT Information to the cache.
* *
* @param nvti The NVT Information to add * @param nvti The NVT Information to add
* *
* @param filename The name of the original NVT without the path * @param filename The name of the original NVT without the path
* to the base location of NVTs (e.g. * to the base location of NVTs (e.g.
skipping to change at line 537 skipping to change at line 544
assert (cache_kb); assert (cache_kb);
g_snprintf (pattern, sizeof (pattern), "oid:%s:prefs", oid); g_snprintf (pattern, sizeof (pattern), "oid:%s:prefs", oid);
prefs = element = kb_item_get_all (cache_kb, pattern); prefs = element = kb_item_get_all (cache_kb, pattern);
while (element) while (element)
{ {
nvtpref_t *np; nvtpref_t *np;
char **array = g_strsplit (element->v_str, "|||", -1); char **array = g_strsplit (element->v_str, "|||", -1);
assert (array[2]); assert (array[3]);
assert (!array[3]); assert (!array[4]);
np = g_malloc0 (sizeof (nvtpref_t)); np = nvtpref_new (atoi (array[0]), array[1], array[2], array[3]);
np->name = array[0]; g_strfreev (array);
np->type = array[1];
np->dflt = array[2];
g_free (array);
list = g_slist_append (list, np); list = g_slist_append (list, np);
element = element->next; element = element->next;
} }
kb_item_free (prefs); kb_item_free (prefs);
return list; return list;
} }
/** /**
* @brief Get the list of nvti OIDs. * @brief Get the list of nvti OIDs.
 End of changes. 4 change blocks. 
11 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)