"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/manage_pg.c" between
gvmd-21.4.2.tar.gz and gvmd-21.4.3.tar.gz

About: OpenVAS Greenbone Vulnerability Manager is a layer between OpenVAS-Scanner and various client applications such as OpenVAS-Client or Greenbone Security Assistant. Among other features, it adds server-side storage of scan results and it makes it unnecessary for scan clients to keep connection until a scan finishes.

manage_pg.c  (gvmd-21.4.2):manage_pg.c  (gvmd-21.4.3)
skipping to change at line 865 skipping to change at line 865
" FROM role_users" " FROM role_users"
" WHERE \"user\" = user_id)))" " WHERE \"user\" = user_id)))"
" AND (is_get OR name = arg_permission)) > 0;" " AND (is_get OR name = arg_permission)) > 0;"
" RETURN ret;" " RETURN ret;"
" END;" " END;"
"$$ LANGUAGE plpgsql" "$$ LANGUAGE plpgsql"
" STABLE COST 1000;"); " STABLE COST 1000;");
/* Functions in SQL. */ /* Functions in SQL. */
if (sql_int ("SELECT (EXISTS (SELECT * FROM information_schema.tables"
" WHERE table_catalog = '%s'"
" AND table_schema = 'public'"
" AND table_name = 'nvts')"
" AND EXISTS (SELECT * FROM information_schema.tables"
" WHERE table_catalog = '%s'"
" AND table_schema = 'public'"
" AND table_name = 'nvt_preferences'))"
" ::integer;",
sql_database (),
sql_database ()))
{
char *quoted_collation;
if (get_vt_verification_collation ())
{
gchar *string_quoted_collation;
string_quoted_collation
= sql_quote (get_vt_verification_collation ());
quoted_collation = sql_string ("SELECT quote_ident('%s')",
string_quoted_collation);
g_free (string_quoted_collation);
}
else
{
char *encoding;
encoding = sql_string ("SHOW server_encoding;");
if (g_str_match_string ("UTF-8", encoding, 0)
|| g_str_match_string ("UTF8", encoding, 0))
quoted_collation = strdup ("ucs_basic");
else
// quote C collation because this seems to be required
// without quoting it an error is raised
// other collations don't need quoting
quoted_collation = strdup ("\"C\"");
free (encoding);
}
g_debug ("Using vt verification collation %s", quoted_collation);
sql ("CREATE OR REPLACE FUNCTION vts_verification_str ()"
" RETURNS text AS $$"
" WITH pref_str AS ("
" SELECT name,"
" substring(name, '^(.*?):') AS oid,"
" substring (name, '^.*?:([^:]+):') AS pref_id,"
" (substring (name, '^.*?:([^:]+):')"
" || substring (name,"
" '^[^:]*:[^:]*:[^:]*:(.*)')"
" || value) AS pref"
" FROM nvt_preferences"
" ),"
" nvt_str AS ("
" SELECT (SELECT nvts.oid"
" || max(modification_time)"
" || coalesce (string_agg"
" (pref_str.pref, ''"
" ORDER BY (pref_id"
" COLLATE %s)),"
" ''))"
" AS vt_string"
" FROM nvts"
" LEFT JOIN pref_str ON nvts.oid = pref_str.oid"
" GROUP BY nvts.oid"
" ORDER BY (nvts.oid COLLATE %s) ASC"
" )"
" SELECT coalesce (string_agg (nvt_str.vt_string, ''), '')"
" FROM nvt_str"
"$$ LANGUAGE SQL"
" STABLE;",
quoted_collation,
quoted_collation);
g_free (quoted_collation);
}
sql ("CREATE OR REPLACE FUNCTION t () RETURNS boolean AS $$" sql ("CREATE OR REPLACE FUNCTION t () RETURNS boolean AS $$"
" SELECT true;" " SELECT true;"
"$$ LANGUAGE SQL" "$$ LANGUAGE SQL"
" IMMUTABLE;"); " IMMUTABLE;");
sql ("CREATE OR REPLACE FUNCTION m_now () RETURNS integer AS $$" sql ("CREATE OR REPLACE FUNCTION m_now () RETURNS integer AS $$"
" SELECT extract (epoch FROM now ())::integer;" " SELECT extract (epoch FROM now ())::integer;"
"$$ LANGUAGE SQL" "$$ LANGUAGE SQL"
" STABLE;"); " STABLE;");
 End of changes. 1 change blocks. 
0 lines changed or deleted 77 lines changed or added

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