From 97a03083ba75c7d9b2f14ff7e122a3ea1ae335e4 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 10 May 2022 11:39:47 +0200 Subject: [PATCH] unsorted formatting cleanup Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- src/auth.c | 9 ++++++--- src/options.c | 13 ++++++------- src/pki.c | 8 ++++---- src/pki_ed25519.c | 2 +- tests/client/torture_auth.c | 6 +++--- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/auth.c b/src/auth.c index b8121aa9..24e109ee 100644 --- a/src/auth.c +++ b/src/auth.c @@ -523,7 +523,8 @@ int ssh_userauth_try_publickey(ssh_session session, "Invalid key type (unknown)"); return SSH_AUTH_DENIED; } - if (!ssh_key_algorithm_allowed(session, sig_type_c)) { + rc = ssh_key_algorithm_allowed(session, sig_type_c); + if (!rc) { ssh_set_error(session, SSH_REQUEST_DENIED, "The key algorithm '%s' is not allowed to be used by" " PUBLICKEY_ACCEPTED_TYPES configuration option", @@ -647,7 +648,8 @@ int ssh_userauth_publickey(ssh_session session, "Invalid key type (unknown)"); return SSH_AUTH_DENIED; } - if (!ssh_key_algorithm_allowed(session, sig_type_c)) { + rc = ssh_key_algorithm_allowed(session, sig_type_c); + if (!rc) { ssh_set_error(session, SSH_REQUEST_DENIED, "The key algorithm '%s' is not allowed to be used by" " PUBLICKEY_ACCEPTED_TYPES configuration option", @@ -765,7 +767,8 @@ static int ssh_userauth_agent_publickey(ssh_session session, SSH_STRING_FREE(pubkey_s); return SSH_AUTH_DENIED; } - if (!ssh_key_algorithm_allowed(session, sig_type_c)) { + rc = ssh_key_algorithm_allowed(session, sig_type_c); + if (!rc) { ssh_set_error(session, SSH_REQUEST_DENIED, "The key algorithm '%s' is not allowed to be used by" " PUBLICKEY_ACCEPTED_TYPES configuration option", diff --git a/src/options.c b/src/options.c index 0dea536a..a16c70f7 100644 --- a/src/options.c +++ b/src/options.c @@ -906,7 +906,6 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type, session->opts.StrictHostKeyChecking = (*x & 0xff) > 0 ? 1 : 0; } - session->opts.StrictHostKeyChecking = *(int*)value; break; case SSH_OPTIONS_PROXYCOMMAND: v = value; @@ -1700,9 +1699,9 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type, bind_key_path_loc = &sshbind->dsakey; #else ssh_set_error(sshbind, - SSH_FATAL, - "DSS key used and libssh compiled " - "without DSA support"); + SSH_FATAL, + "DSS key used and libssh compiled " + "without DSA support"); #endif break; case SSH_KEYTYPE_ECDSA_P256: @@ -1723,9 +1722,9 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type, bind_key_path_loc = &sshbind->rsakey; break; case SSH_KEYTYPE_ED25519: - bind_key_loc = &sshbind->ed25519; - bind_key_path_loc = &sshbind->ed25519key; - break; + bind_key_loc = &sshbind->ed25519; + bind_key_path_loc = &sshbind->ed25519key; + break; default: ssh_set_error(sshbind, SSH_FATAL, diff --git a/src/pki.c b/src/pki.c index 5a23d163..d3f91a8b 100644 --- a/src/pki.c +++ b/src/pki.c @@ -2687,7 +2687,7 @@ ssh_string ssh_srv_pki_do_sign_sessionid(ssh_session session, session->current_crypto; if (crypto->secret_hash == NULL){ - ssh_set_error(session,SSH_FATAL,"Missing secret_hash"); + ssh_set_error(session, SSH_FATAL, "Missing secret_hash"); return NULL; } @@ -2708,9 +2708,9 @@ ssh_string ssh_srv_pki_do_sign_sessionid(ssh_session session, /* Generate the signature */ sig = pki_do_sign(privkey, - ssh_buffer_get(sign_input), - ssh_buffer_get_len(sign_input), - digest); + ssh_buffer_get(sign_input), + ssh_buffer_get_len(sign_input), + digest); if (sig == NULL) { goto end; } diff --git a/src/pki_ed25519.c b/src/pki_ed25519.c index fdf94b4e..6a5a4a8a 100644 --- a/src/pki_ed25519.c +++ b/src/pki_ed25519.c @@ -1,5 +1,5 @@ /* - * pki_ed25519 .c - PKI infrastructure using ed25519 + * pki_ed25519.c - PKI infrastructure using ed25519 * * This file is part of the SSH Library * diff --git a/tests/client/torture_auth.c b/tests/client/torture_auth.c index d02fd6e2..191de103 100644 --- a/tests/client/torture_auth.c +++ b/tests/client/torture_auth.c @@ -558,7 +558,7 @@ static void torture_auth_agent(void **state) { assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY); rc = ssh_userauth_agent(session, NULL); - assert_int_equal(rc, SSH_AUTH_SUCCESS); + assert_ssh_return_code(session, rc); } static void torture_auth_agent_nonblocking(void **state) { @@ -589,7 +589,7 @@ static void torture_auth_agent_nonblocking(void **state) { do { rc = ssh_userauth_agent(session, NULL); } while (rc == SSH_AUTH_AGAIN); - assert_int_equal(rc, SSH_AUTH_SUCCESS); + assert_ssh_return_code(session, rc); } static void torture_auth_cert(void **state) { @@ -631,7 +631,7 @@ static void torture_auth_cert(void **state) { assert_int_equal(rc, SSH_OK); rc = ssh_userauth_try_publickey(session, NULL, cert); - assert_int_equal(rc, SSH_AUTH_SUCCESS); + assert_ssh_return_code(session, rc); rc = ssh_userauth_publickey(session, NULL, privkey); assert_int_equal(rc, SSH_AUTH_SUCCESS);