Skip to content

Commit

Permalink
Small fixes in adding Kerberos to targets
Browse files Browse the repository at this point in the history
The not found error for the Kerberos credential in create_target now
uses the correct id.
For create_target the mutual exclusion of SMB and Kerberos is
checked earlier.
If the type check for the Kerberos credential in create_target or
modify_target fails, the type string is now freed.
  • Loading branch information
timopollmeier committed Dec 5, 2024
1 parent 166ef3c commit 0e49e1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23094,6 +23094,12 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context,
(XML_ERROR_SYNTAX ("create_target",
"Hosts must be at least one"
" character long"));
else if (create_target_data->smb_credential_id
&& create_target_data->krb5_credential_id)
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("create_target",
"Targets cannot have both an SMB and"
" Kerberos 5 credential"));
else if (create_target_data->ssh_credential_id
&& find_credential_with_permission
(create_target_data->ssh_credential_id,
Expand Down Expand Up @@ -23213,19 +23219,13 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context,
{
if (send_find_error_to_client
("create_target", "Credential",
create_target_data->snmp_credential_id,
create_target_data->krb5_credential_id,
gmp_parser))
{
error_send_to_client (error);
return;
}
}
else if (create_target_data->smb_credential_id
&& create_target_data->krb5_credential_id)
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("create_target",
"Targets cannot have both an SMB and"
" Kerberos 5 credential"));

/* Create target from host string. */
else switch (create_target
Expand Down
2 changes: 2 additions & 0 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -32946,6 +32946,7 @@ create_target (const char* name, const char* asset_hosts_filter,
if (strcmp (type, "krb5"))
{
sql_rollback ();
g_free (type);
return 16;
}
g_free (type);
Expand Down Expand Up @@ -33600,6 +33601,7 @@ modify_target (const char *target_id, const char *name, const char *hosts,
if (strcmp (type, "krb5"))
{
sql_rollback ();
g_free (type);
return 27;
}
g_free (type);
Expand Down

0 comments on commit 0e49e1e

Please sign in to comment.