Skip to content

Commit

Permalink
Declare handle_get_credentials variables where they are used
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell authored and a-h-abdelsalam committed Jun 12, 2024
1 parent 68fb3fd commit 4f1582a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -12252,7 +12252,7 @@ handle_get_credentials (gmp_parser_t *gmp_parser, GError **error)
SEND_GET_START("credential");
while (1)
{
const char *private_key, *public_key, *login, *type, *cert;
const char *login, *type, *cert;
gchar *formats_xml;

ret = get_next (&credentials, &get_credentials_data->get,
Expand All @@ -12266,8 +12266,6 @@ handle_get_credentials (gmp_parser_t *gmp_parser, GError **error)
}

SEND_GET_COMMON (credential, &get_credentials_data->get, &credentials);
private_key = credential_iterator_private_key (&credentials);
public_key = credential_iterator_public_key (&credentials);
login = credential_iterator_login (&credentials);
type = credential_iterator_type (&credentials);
cert = credential_iterator_certificate (&credentials);
Expand Down Expand Up @@ -12346,6 +12344,10 @@ handle_get_credentials (gmp_parser_t *gmp_parser, GError **error)

case CREDENTIAL_FORMAT_KEY:
{
const char *public_key;

public_key = credential_iterator_public_key (&credentials);

if (public_key && strcmp (public_key, ""))
{
SENDF_TO_CLIENT_OR_FAIL
Expand All @@ -12354,8 +12356,9 @@ handle_get_credentials (gmp_parser_t *gmp_parser, GError **error)
else
{
char *pub;
const char *pass;
const char *pass, *private_key;

private_key = credential_iterator_private_key (&credentials);
pass = credential_iterator_password (&credentials);
pub = gvm_ssh_public_from_private (private_key, pass);
SENDF_TO_CLIENT_OR_FAIL
Expand Down

0 comments on commit 4f1582a

Please sign in to comment.