Skip to content

Commit

Permalink
Merge branch 'master' into nvt-pref-name
Browse files Browse the repository at this point in the history
  • Loading branch information
timopollmeier authored Feb 19, 2019
2 parents 01fb573 + cc8f3bb commit b9258b2
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -41030,9 +41030,22 @@ manage_nvt_preference_add (const char* name, const char* value)
gchar* quoted_value = sql_quote (value);

if (strcmp (name, "port_range"))
sql ("INSERT into nvt_preferences (name, value)"
" VALUES ('%s', '%s');",
quoted_name, quoted_value);
{
if (sql_int ("SELECT EXISTS"
" (SELECT * FROM nvt_preferences"
" WHERE name = '%s')",
quoted_name))
{
g_warning ("%s: preference '%s' already exists",
__FUNCTION__, name);
}
else
{
sql ("INSERT into nvt_preferences (name, value)"
" VALUES ('%s', '%s');",
quoted_name, quoted_value);
}
}

g_free (quoted_name);
g_free (quoted_value);
Expand Down

0 comments on commit b9258b2

Please sign in to comment.