Skip to content

Commit

Permalink
Disable license GMP if libtheia is unavailable
Browse files Browse the repository at this point in the history
If gvmd is build without libtheia, the commands `get_license` and
`modify_license` will be disabled as if they were disabled with in the
`--disable-cmds` option.
  • Loading branch information
timopollmeier committed Oct 28, 2021
1 parent 95370bb commit 3afd1a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/gvmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,8 @@ gvmd (int argc, char** argv)
static int feed_lock_timeout = 0;
static gchar *vt_verification_collation = NULL;

GString *full_disable_commands = g_string_new ("");

int sentry_initialized;
GError *error = NULL;
lockfile_t lockfile_checking, lockfile_serving;
Expand Down Expand Up @@ -3062,7 +3064,18 @@ gvmd (int argc, char** argv)
/* Setup global variables. */

if (disable)
disabled_commands = g_strsplit (disable, ",", 0);
g_string_append (full_disable_commands, disable);

#ifndef HAS_LIBTHEIA
if (full_disable_commands->len)
g_string_append_c (full_disable_commands, ',');
g_string_append (full_disable_commands, "get_license,modify_license");
#endif

if (full_disable_commands->len)
disabled_commands = g_strsplit (full_disable_commands->str, ",", 0);

g_string_free(full_disable_commands, TRUE);

scheduling_enabled = (disable_scheduling == FALSE);

Expand Down
8 changes: 8 additions & 0 deletions src/schema_formats/XML/GMP.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -12606,6 +12606,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p>
The client uses the get_license command to get the current license.
</p>
<p>
This command is only available if gvmd is built with the licensing
library (libtheia).
</p>
</description>
<pattern>
</pattern>
Expand Down Expand Up @@ -23812,6 +23816,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p>
The license has to be provided as a valid license TOML file.
</p>
<p>
This command is only available if gvmd is built with the licensing
library (libtheia).
</p>
</description>
<pattern>
<attrib>
Expand Down

0 comments on commit 3afd1a6

Please sign in to comment.