mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-14 04:18:54 +03:00
reformat
Signed-off-by: Debanga Sarma <deb737@proton.me> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
5dd42dfa22
commit
d34bfdab69
@@ -2017,7 +2017,8 @@ static int ssh_bind_set_algo(ssh_bind sshbind,
|
||||
* - SSH_LOG_NOLOG: No logging
|
||||
* - SSH_LOG_WARNING: Only warnings
|
||||
* - SSH_LOG_PROTOCOL: High level protocol information
|
||||
* - SSH_LOG_PACKET: Lower level protocol information, packet level
|
||||
* - SSH_LOG_PACKET: Lower level protocol information,
|
||||
* packet level
|
||||
* - SSH_LOG_FUNCTIONS: Every function path
|
||||
* The default is SSH_LOG_NOLOG.
|
||||
*
|
||||
@@ -2026,8 +2027,8 @@ static int ssh_bind_set_algo(ssh_bind sshbind,
|
||||
* string that will be converted to a numerical
|
||||
* value (e.g. "3") and interpreted according
|
||||
* to the values of
|
||||
* SSH_BIND_OPTIONS_LOG_VERBOSITY above (const
|
||||
* char *).
|
||||
* SSH_BIND_OPTIONS_LOG_VERBOSITY above
|
||||
* (const char *).
|
||||
*
|
||||
* - SSH_BIND_OPTIONS_RSAKEY:
|
||||
* Deprecated alias to SSH_BIND_OPTIONS_HOSTKEY
|
||||
@@ -2048,16 +2049,16 @@ static int ssh_bind_set_algo(ssh_bind sshbind,
|
||||
* (ssh_key). It will be free'd by ssh_bind_free().
|
||||
*
|
||||
* - SSH_BIND_OPTIONS_CIPHERS_C_S:
|
||||
* Set the symmetric cipher client to server (const char *,
|
||||
* comma-separated list).
|
||||
* Set the symmetric cipher client to server
|
||||
* (const char *, comma-separated list).
|
||||
*
|
||||
* - SSH_BIND_OPTIONS_CIPHERS_S_C:
|
||||
* Set the symmetric cipher server to client (const char *,
|
||||
* comma-separated list).
|
||||
* Set the symmetric cipher server to client
|
||||
* (const char *, comma-separated list).
|
||||
*
|
||||
* - SSH_BIND_OPTIONS_KEY_EXCHANGE:
|
||||
* Set the key exchange method to be used (const char *,
|
||||
* comma-separated list). ex:
|
||||
* Set the key exchange method to be used
|
||||
* (const char *, comma-separated list). ex:
|
||||
* "ecdh-sha2-nistp256,diffie-hellman-group14-sha1"
|
||||
*
|
||||
* - SSH_BIND_OPTIONS_HMAC_C_S:
|
||||
@@ -2113,9 +2114,12 @@ static int ssh_bind_set_algo(ssh_bind sshbind,
|
||||
* datatype which should be used is described at the
|
||||
* corresponding value of type above.
|
||||
*
|
||||
* @return 0 on success, < 0 on error, invalid option, or parameter.
|
||||
* @return 0 on success, < 0 on error, invalid option, or
|
||||
* parameter.
|
||||
*/
|
||||
int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type,
|
||||
int
|
||||
ssh_bind_options_set(ssh_bind sshbind,
|
||||
enum ssh_bind_options_e type,
|
||||
const void *value)
|
||||
{
|
||||
bool allowed;
|
||||
@@ -2182,7 +2186,8 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type,
|
||||
default:
|
||||
ssh_set_error(sshbind,
|
||||
SSH_FATAL,
|
||||
"Unsupported key type %d", key_type);
|
||||
"Unsupported key type %d",
|
||||
key_type);
|
||||
}
|
||||
|
||||
if (bind_key_loc == NULL) {
|
||||
@@ -2242,7 +2247,8 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type,
|
||||
default:
|
||||
ssh_set_error(sshbind,
|
||||
SSH_FATAL,
|
||||
"Unsupported key type %d", key_type);
|
||||
"Unsupported key type %d",
|
||||
key_type);
|
||||
}
|
||||
if (bind_key_loc == NULL)
|
||||
return -1;
|
||||
@@ -2484,16 +2490,21 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type,
|
||||
} else {
|
||||
int *x = (int *)value;
|
||||
if (*x > 0 && *x < 768) {
|
||||
ssh_set_error(sshbind, SSH_REQUEST_DENIED,
|
||||
ssh_set_error(sshbind,
|
||||
SSH_REQUEST_DENIED,
|
||||
"The provided value (%u) for minimal RSA key "
|
||||
"size is too small. Use at least 768 bits.", *x);
|
||||
"size is too small. Use at least 768 bits.",
|
||||
*x);
|
||||
return -1;
|
||||
}
|
||||
sshbind->rsa_min_size = *x;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ssh_set_error(sshbind, SSH_REQUEST_DENIED, "Unknown ssh option %d", type);
|
||||
ssh_set_error(sshbind,
|
||||
SSH_REQUEST_DENIED,
|
||||
"Unknown ssh option %d",
|
||||
type);
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2049,7 +2049,8 @@ static int sshbind_teardown(void **state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void torture_bind_options_import_key(void **state)
|
||||
static void
|
||||
torture_bind_options_import_key(void **state)
|
||||
{
|
||||
struct bind_st *test_state;
|
||||
ssh_bind bind;
|
||||
@@ -2694,95 +2695,182 @@ static void torture_bind_options_set_hostkey_algorithms(void **state)
|
||||
|
||||
#endif /* WITH_SERVER */
|
||||
|
||||
|
||||
int torture_run_tests(void)
|
||||
int
|
||||
torture_run_tests(void)
|
||||
{
|
||||
int rc;
|
||||
struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_host, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_host, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_port, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_port, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_fd, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_user, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_user, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_identity, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_identity, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_global_knownhosts, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_global_knownhosts, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_knownhosts, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_knownhosts, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_proxycommand, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_control_master, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_control_path, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_ciphers, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_ciphers, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_key_exchange, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_key_exchange, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_hostkey, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_hostkey, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_pubkey_accepted_types, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_pubkey_accepted_types, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_macs, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_macs, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_compression, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_compression, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_host,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_host,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_port,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_port,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_fd,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_user,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_user,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_identity,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_identity,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_global_knownhosts,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_global_knownhosts,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_knownhosts,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_knownhosts,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_proxycommand,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_control_master,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_control_path,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_ciphers,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_ciphers,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_key_exchange,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_key_exchange,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_hostkey,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_hostkey,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(
|
||||
torture_options_set_pubkey_accepted_types,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(
|
||||
torture_options_get_pubkey_accepted_types,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_macs,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_macs,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_compression,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_get_compression,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_copy, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_config_host, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_config_host,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_config_match,
|
||||
setup, teardown),
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_config_match_multi,
|
||||
setup, teardown),
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_getopt,
|
||||
setup, teardown),
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_plus_sign,
|
||||
setup, teardown),
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_minus_sign,
|
||||
setup, teardown),
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_caret_sign,
|
||||
setup, teardown),
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_apply, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_verbosity, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_options_set_verbosity,
|
||||
setup,
|
||||
teardown),
|
||||
};
|
||||
|
||||
#ifdef WITH_SERVER
|
||||
struct CMUnitTest sshbind_tests[] = {
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_import_key,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_hostkey,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_bindaddr,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_bindport,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_bindport_str,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_log_verbosity,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_log_verbosity_str,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_rsakey,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
#ifdef HAVE_ECC
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_ecdsakey,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
#endif
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_banner,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_set_ciphers,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_set_key_exchange,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_set_macs,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_parse_config,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_config_dir,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_set_pubkey_accepted_key_types,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_bind_options_set_hostkey_algorithms,
|
||||
sshbind_setup, sshbind_teardown),
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(
|
||||
torture_bind_options_set_pubkey_accepted_key_types,
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
cmocka_unit_test_setup_teardown(
|
||||
torture_bind_options_set_hostkey_algorithms,
|
||||
sshbind_setup,
|
||||
sshbind_teardown),
|
||||
};
|
||||
#endif /* WITH_SERVER */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user