mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-18 15:20:56 +03:00
checksrc: verify label indent, fix fallouts
Also update two labels to match the rest of the source. checksrc update credit: Emanuele Torre @emanuele6 Ref: https://github.com/curl/curl/pull/11134 Closes #1042
This commit is contained in:
@@ -75,6 +75,7 @@ my %warnings = (
|
|||||||
'INCLUDEDUP', => 'same file is included again',
|
'INCLUDEDUP', => 'same file is included again',
|
||||||
'INDENTATION' => 'wrong start column for code',
|
'INDENTATION' => 'wrong start column for code',
|
||||||
'LONGLINE' => "Line longer than $max_column",
|
'LONGLINE' => "Line longer than $max_column",
|
||||||
|
'SPACEBEFORELABEL' => 'labels not at the start of the line',
|
||||||
'MULTISPACE' => 'multiple spaces used when not suitable',
|
'MULTISPACE' => 'multiple spaces used when not suitable',
|
||||||
'NOSPACEEQUALS' => 'equals sign without preceding space',
|
'NOSPACEEQUALS' => 'equals sign without preceding space',
|
||||||
'NOTEQUALSZERO', => 'if/while comparison with != 0',
|
'NOTEQUALSZERO', => 'if/while comparison with != 0',
|
||||||
@@ -697,6 +698,11 @@ sub scanfile {
|
|||||||
$line, length($1), $file, $ol, "no space before colon of switch label");
|
$line, length($1), $file, $ol, "no space before colon of switch label");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($prevl !~ /\?\z/ && $l =~ /^ +([A-Za-z_][A-Za-z0-9_]*):$/ && $1 ne 'default') {
|
||||||
|
checkwarn("SPACEBEFORELABEL",
|
||||||
|
$line, length($1), $file, $ol, "no space before label");
|
||||||
|
}
|
||||||
|
|
||||||
# scan for use of banned functions
|
# scan for use of banned functions
|
||||||
if($l =~ /^(.*\W)
|
if($l =~ /^(.*\W)
|
||||||
(gmtime|localtime|
|
(gmtime|localtime|
|
||||||
|
|||||||
@@ -584,7 +584,7 @@ agent_sign(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len,
|
|||||||
}
|
}
|
||||||
memcpy(*sig, s, *sig_len);
|
memcpy(*sig, s, *sig_len);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if(method_name)
|
if(method_name)
|
||||||
LIBSSH2_FREE(session, method_name);
|
LIBSSH2_FREE(session, method_name);
|
||||||
@@ -727,7 +727,7 @@ agent_list_identities(LIBSSH2_AGENT *agent)
|
|||||||
|
|
||||||
_libssh2_list_add(&agent->head, &identity->node);
|
_libssh2_list_add(&agent->head, &identity->node);
|
||||||
}
|
}
|
||||||
error:
|
error:
|
||||||
LIBSSH2_FREE(agent->session, transctx->response);
|
LIBSSH2_FREE(agent->session, transctx->response);
|
||||||
transctx->response = NULL;
|
transctx->response = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ _libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
channel_error:
|
channel_error:
|
||||||
|
|
||||||
if(session->open_data) {
|
if(session->open_data) {
|
||||||
LIBSSH2_FREE(session, session->open_data);
|
LIBSSH2_FREE(session, session->open_data);
|
||||||
|
|||||||
@@ -889,7 +889,7 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_exit:
|
clean_exit:
|
||||||
libssh2_dh_dtor(&exchange_state->x);
|
libssh2_dh_dtor(&exchange_state->x);
|
||||||
_libssh2_bn_free(exchange_state->e);
|
_libssh2_bn_free(exchange_state->e);
|
||||||
exchange_state->e = NULL;
|
exchange_state->e = NULL;
|
||||||
@@ -1437,7 +1437,7 @@ kex_method_diffie_hellman_group_exchange_sha1_key_exchange(
|
|||||||
LIBSSH2_FREE(session, key_state->data);
|
LIBSSH2_FREE(session, key_state->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
dh_gex_clean_exit:
|
dh_gex_clean_exit:
|
||||||
key_state->state = libssh2_NB_state_idle;
|
key_state->state = libssh2_NB_state_idle;
|
||||||
_libssh2_bn_free(key_state->g);
|
_libssh2_bn_free(key_state->g);
|
||||||
key_state->g = NULL;
|
key_state->g = NULL;
|
||||||
@@ -1556,7 +1556,7 @@ kex_method_diffie_hellman_group_exchange_sha256_key_exchange(
|
|||||||
LIBSSH2_FREE(session, key_state->data);
|
LIBSSH2_FREE(session, key_state->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
dh_gex_clean_exit:
|
dh_gex_clean_exit:
|
||||||
key_state->state = libssh2_NB_state_idle;
|
key_state->state = libssh2_NB_state_idle;
|
||||||
_libssh2_bn_free(key_state->g);
|
_libssh2_bn_free(key_state->g);
|
||||||
key_state->g = NULL;
|
key_state->g = NULL;
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
|
|||||||
*store = knownhost_to_external(entry);
|
*store = knownhost_to_external(entry);
|
||||||
|
|
||||||
return LIBSSH2_ERROR_NONE;
|
return LIBSSH2_ERROR_NONE;
|
||||||
error:
|
error:
|
||||||
free_host(hosts->session, entry);
|
free_host(hosts->session, entry);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ _libssh2_rsa_new_private(libssh2_rsa_ctx ** rsa,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
LIBSSH2_FREE(session, save_data);
|
LIBSSH2_FREE(session, save_data);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ _libssh2_dsa_new_private(libssh2_dsa_ctx ** dsa,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
LIBSSH2_FREE(session, save_data);
|
LIBSSH2_FREE(session, save_data);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -520,10 +520,10 @@ _libssh2_dsa_sha1_sign(libssh2_dsa_ctx * dsactx,
|
|||||||
memcpy(sig + 20 + (20 - size), tmp, size);
|
memcpy(sig + 20 + (20 - size), tmp, size);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if(sig_sexp) {
|
if(sig_sexp) {
|
||||||
gcry_sexp_release(sig_sexp);
|
gcry_sexp_release(sig_sexp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -824,7 +824,7 @@ gen_publickey_from_rsa_evp(LIBSSH2_SESSION *session,
|
|||||||
*pubkeydata_len = key_len;
|
*pubkeydata_len = key_len;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
__alloc_error:
|
__alloc_error:
|
||||||
if(rsa) {
|
if(rsa) {
|
||||||
RSA_free(rsa);
|
RSA_free(rsa);
|
||||||
}
|
}
|
||||||
@@ -1223,7 +1223,7 @@ gen_publickey_from_dsa_evp(LIBSSH2_SESSION *session,
|
|||||||
*pubkeydata_len = key_len;
|
*pubkeydata_len = key_len;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
__alloc_error:
|
__alloc_error:
|
||||||
if(dsa) {
|
if(dsa) {
|
||||||
DSA_free(dsa);
|
DSA_free(dsa);
|
||||||
}
|
}
|
||||||
@@ -1486,18 +1486,18 @@ _libssh2_curve25519_new(LIBSSH2_SESSION *session,
|
|||||||
|
|
||||||
if(EVP_PKEY_keygen_init(pctx) != 1 ||
|
if(EVP_PKEY_keygen_init(pctx) != 1 ||
|
||||||
EVP_PKEY_keygen(pctx, &key) != 1) {
|
EVP_PKEY_keygen(pctx, &key) != 1) {
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(out_private_key) {
|
if(out_private_key) {
|
||||||
privLen = LIBSSH2_ED25519_KEY_LEN;
|
privLen = LIBSSH2_ED25519_KEY_LEN;
|
||||||
priv = LIBSSH2_ALLOC(session, privLen);
|
priv = LIBSSH2_ALLOC(session, privLen);
|
||||||
if(!priv)
|
if(!priv)
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
|
|
||||||
if(EVP_PKEY_get_raw_private_key(key, priv, &privLen) != 1 ||
|
if(EVP_PKEY_get_raw_private_key(key, priv, &privLen) != 1 ||
|
||||||
privLen != LIBSSH2_ED25519_KEY_LEN) {
|
privLen != LIBSSH2_ED25519_KEY_LEN) {
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_private_key = priv;
|
*out_private_key = priv;
|
||||||
@@ -1508,11 +1508,11 @@ _libssh2_curve25519_new(LIBSSH2_SESSION *session,
|
|||||||
pubLen = LIBSSH2_ED25519_KEY_LEN;
|
pubLen = LIBSSH2_ED25519_KEY_LEN;
|
||||||
pub = LIBSSH2_ALLOC(session, pubLen);
|
pub = LIBSSH2_ALLOC(session, pubLen);
|
||||||
if(!pub)
|
if(!pub)
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
|
|
||||||
if(EVP_PKEY_get_raw_public_key(key, pub, &pubLen) != 1 ||
|
if(EVP_PKEY_get_raw_public_key(key, pub, &pubLen) != 1 ||
|
||||||
pubLen != LIBSSH2_ED25519_KEY_LEN) {
|
pubLen != LIBSSH2_ED25519_KEY_LEN) {
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_public_key = pub;
|
*out_public_key = pub;
|
||||||
@@ -1522,7 +1522,7 @@ _libssh2_curve25519_new(LIBSSH2_SESSION *session,
|
|||||||
/* success */
|
/* success */
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
cleanExit:
|
clean_exit:
|
||||||
|
|
||||||
if(pctx)
|
if(pctx)
|
||||||
EVP_PKEY_CTX_free(pctx);
|
EVP_PKEY_CTX_free(pctx);
|
||||||
@@ -2640,7 +2640,7 @@ gen_publickey_from_ec_evp(LIBSSH2_SESSION *session,
|
|||||||
key = LIBSSH2_ALLOC(session, key_len);
|
key = LIBSSH2_ALLOC(session, key_len);
|
||||||
if(!key) {
|
if(!key) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto clean_exit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process key encoding. */
|
/* Process key encoding. */
|
||||||
@@ -3311,32 +3311,32 @@ _libssh2_curve25519_gen_k(_libssh2_bn **k,
|
|||||||
LIBSSH2_ED25519_KEY_LEN);
|
LIBSSH2_ED25519_KEY_LEN);
|
||||||
|
|
||||||
if(!peer_key || !server_key) {
|
if(!peer_key || !server_key) {
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
server_key_ctx = EVP_PKEY_CTX_new(server_key, NULL);
|
server_key_ctx = EVP_PKEY_CTX_new(server_key, NULL);
|
||||||
if(!server_key_ctx) {
|
if(!server_key_ctx) {
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = EVP_PKEY_derive_init(server_key_ctx);
|
rc = EVP_PKEY_derive_init(server_key_ctx);
|
||||||
if(rc <= 0) {
|
if(rc <= 0) {
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = EVP_PKEY_derive_set_peer(server_key_ctx, peer_key);
|
rc = EVP_PKEY_derive_set_peer(server_key_ctx, peer_key);
|
||||||
if(rc <= 0) {
|
if(rc <= 0) {
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = EVP_PKEY_derive(server_key_ctx, NULL, &out_len);
|
rc = EVP_PKEY_derive(server_key_ctx, NULL, &out_len);
|
||||||
if(rc <= 0) {
|
if(rc <= 0) {
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(out_len != LIBSSH2_ED25519_KEY_LEN) {
|
if(out_len != LIBSSH2_ED25519_KEY_LEN) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto cleanExit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = EVP_PKEY_derive(server_key_ctx, out_shared_key, &out_len);
|
rc = EVP_PKEY_derive(server_key_ctx, out_shared_key, &out_len);
|
||||||
@@ -3348,7 +3348,7 @@ _libssh2_curve25519_gen_k(_libssh2_bn **k,
|
|||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanExit:
|
clean_exit:
|
||||||
|
|
||||||
if(server_key_ctx)
|
if(server_key_ctx)
|
||||||
EVP_PKEY_CTX_free(server_key_ctx);
|
EVP_PKEY_CTX_free(server_key_ctx);
|
||||||
@@ -3379,7 +3379,7 @@ _libssh2_ed25519_verify(libssh2_ed25519_ctx *ctx, const uint8_t *s,
|
|||||||
|
|
||||||
ret = EVP_DigestVerify(md_ctx, s, s_len, m, m_len);
|
ret = EVP_DigestVerify(md_ctx, s, s_len, m, m_len);
|
||||||
|
|
||||||
clean_exit:
|
clean_exit:
|
||||||
|
|
||||||
EVP_MD_CTX_free(md_ctx);
|
EVP_MD_CTX_free(md_ctx);
|
||||||
|
|
||||||
|
|||||||
14
src/packet.c
14
src/packet.c
@@ -429,7 +429,7 @@ packet_x11_open(LIBSSH2_SESSION * session, unsigned char *data,
|
|||||||
else
|
else
|
||||||
failure_code = SSH_OPEN_RESOURCE_SHORTAGE;
|
failure_code = SSH_OPEN_RESOURCE_SHORTAGE;
|
||||||
/* fall-trough */
|
/* fall-trough */
|
||||||
x11_exit:
|
x11_exit:
|
||||||
p = x11open_state->packet;
|
p = x11open_state->packet;
|
||||||
*(p++) = SSH_MSG_CHANNEL_OPEN_FAILURE;
|
*(p++) = SSH_MSG_CHANNEL_OPEN_FAILURE;
|
||||||
_libssh2_store_u32(&p, x11open_state->sender_channel);
|
_libssh2_store_u32(&p, x11open_state->sender_channel);
|
||||||
@@ -848,7 +848,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
|
|||||||
if(want_reply) {
|
if(want_reply) {
|
||||||
static const unsigned char packet =
|
static const unsigned char packet =
|
||||||
SSH_MSG_REQUEST_FAILURE;
|
SSH_MSG_REQUEST_FAILURE;
|
||||||
libssh2_packet_add_jump_point5:
|
libssh2_packet_add_jump_point5:
|
||||||
session->packAdd_state = libssh2_NB_state_jump5;
|
session->packAdd_state = libssh2_NB_state_jump5;
|
||||||
rc = _libssh2_transport_send(session, &packet, 1, NULL, 0);
|
rc = _libssh2_transport_send(session, &packet, 1, NULL, 0);
|
||||||
if(rc == LIBSSH2_ERROR_EAGAIN)
|
if(rc == LIBSSH2_ERROR_EAGAIN)
|
||||||
@@ -934,7 +934,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
|
|||||||
session->packAdd_channelp = channelp;
|
session->packAdd_channelp = channelp;
|
||||||
|
|
||||||
/* Adjust the window based on the block we just freed */
|
/* Adjust the window based on the block we just freed */
|
||||||
libssh2_packet_add_jump_point1:
|
libssh2_packet_add_jump_point1:
|
||||||
session->packAdd_state = libssh2_NB_state_jump1;
|
session->packAdd_state = libssh2_NB_state_jump1;
|
||||||
rc = _libssh2_channel_receive_window_adjust(session->
|
rc = _libssh2_channel_receive_window_adjust(session->
|
||||||
packAdd_channelp,
|
packAdd_channelp,
|
||||||
@@ -1110,7 +1110,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
|
|||||||
|
|
||||||
if(want_reply) {
|
if(want_reply) {
|
||||||
unsigned char packet[5];
|
unsigned char packet[5];
|
||||||
libssh2_packet_add_jump_point4:
|
libssh2_packet_add_jump_point4:
|
||||||
session->packAdd_state = libssh2_NB_state_jump4;
|
session->packAdd_state = libssh2_NB_state_jump4;
|
||||||
packet[0] = SSH_MSG_CHANNEL_FAILURE;
|
packet[0] = SSH_MSG_CHANNEL_FAILURE;
|
||||||
memcpy(&packet[1], data + 1, 4);
|
memcpy(&packet[1], data + 1, 4);
|
||||||
@@ -1173,7 +1173,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
|
|||||||
memset(&session->packAdd_Qlstn_state, 0,
|
memset(&session->packAdd_Qlstn_state, 0,
|
||||||
sizeof(session->packAdd_Qlstn_state));
|
sizeof(session->packAdd_Qlstn_state));
|
||||||
|
|
||||||
libssh2_packet_add_jump_point2:
|
libssh2_packet_add_jump_point2:
|
||||||
session->packAdd_state = libssh2_NB_state_jump2;
|
session->packAdd_state = libssh2_NB_state_jump2;
|
||||||
rc = packet_queue_listener(session, data, datalen,
|
rc = packet_queue_listener(session, data, datalen,
|
||||||
&session->packAdd_Qlstn_state);
|
&session->packAdd_Qlstn_state);
|
||||||
@@ -1186,7 +1186,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
|
|||||||
memset(&session->packAdd_x11open_state, 0,
|
memset(&session->packAdd_x11open_state, 0,
|
||||||
sizeof(session->packAdd_x11open_state));
|
sizeof(session->packAdd_x11open_state));
|
||||||
|
|
||||||
libssh2_packet_add_jump_point3:
|
libssh2_packet_add_jump_point3:
|
||||||
session->packAdd_state = libssh2_NB_state_jump3;
|
session->packAdd_state = libssh2_NB_state_jump3;
|
||||||
rc = packet_x11_open(session, data, datalen,
|
rc = packet_x11_open(session, data, datalen,
|
||||||
&session->packAdd_x11open_state);
|
&session->packAdd_x11open_state);
|
||||||
@@ -1201,7 +1201,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
|
|||||||
memset(&session->packAdd_authagent_state, 0,
|
memset(&session->packAdd_authagent_state, 0,
|
||||||
sizeof(session->packAdd_authagent_state));
|
sizeof(session->packAdd_authagent_state));
|
||||||
|
|
||||||
libssh2_packet_add_jump_authagent:
|
libssh2_packet_add_jump_authagent:
|
||||||
session->packAdd_state = libssh2_NB_state_jumpauthagent;
|
session->packAdd_state = libssh2_NB_state_jumpauthagent;
|
||||||
rc = packet_authagent_open(session, data, datalen,
|
rc = packet_authagent_open(session, data, datalen,
|
||||||
&session->packAdd_authagent_state);
|
&session->packAdd_authagent_state);
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ _libssh2_pem_parse(LIBSSH2_SESSION * session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
out:
|
out:
|
||||||
if(b64data) {
|
if(b64data) {
|
||||||
_libssh2_explicit_zero(b64data, b64datalen);
|
_libssh2_explicit_zero(b64data, b64datalen);
|
||||||
LIBSSH2_FREE(session, b64data);
|
LIBSSH2_FREE(session, b64data);
|
||||||
@@ -362,7 +362,7 @@ _libssh2_pem_parse_memory(LIBSSH2_SESSION * session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
out:
|
out:
|
||||||
if(b64data) {
|
if(b64data) {
|
||||||
_libssh2_explicit_zero(b64data, b64datalen);
|
_libssh2_explicit_zero(b64data, b64datalen);
|
||||||
LIBSSH2_FREE(session, b64data);
|
LIBSSH2_FREE(session, b64data);
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ publickey_response_success(LIBSSH2_PUBLICKEY * pkey)
|
|||||||
data = NULL;
|
data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err_exit:
|
err_exit:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,7 +539,7 @@ static LIBSSH2_PUBLICKEY *publickey_init(LIBSSH2_SESSION *session)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Never reached except by direct goto */
|
/* Never reached except by direct goto */
|
||||||
err_exit:
|
err_exit:
|
||||||
session->pkeyInit_state = libssh2_NB_state_sent4;
|
session->pkeyInit_state = libssh2_NB_state_sent4;
|
||||||
if(session->pkeyInit_channel) {
|
if(session->pkeyInit_channel) {
|
||||||
rc = _libssh2_channel_close(session->pkeyInit_channel);
|
rc = _libssh2_channel_close(session->pkeyInit_channel);
|
||||||
@@ -1201,7 +1201,7 @@ libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY * pkey, unsigned long *num_keys,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Only reached via explicit goto */
|
/* Only reached via explicit goto */
|
||||||
err_exit:
|
err_exit:
|
||||||
if(pkey->listFetch_data) {
|
if(pkey->listFetch_data) {
|
||||||
LIBSSH2_FREE(session, pkey->listFetch_data);
|
LIBSSH2_FREE(session, pkey->listFetch_data);
|
||||||
pkey->listFetch_data = NULL;
|
pkey->listFetch_data = NULL;
|
||||||
|
|||||||
@@ -769,7 +769,7 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
|
|||||||
session->scpRecv_state = libssh2_NB_state_idle;
|
session->scpRecv_state = libssh2_NB_state_idle;
|
||||||
return session->scpRecv_channel;
|
return session->scpRecv_channel;
|
||||||
|
|
||||||
scp_recv_empty_channel:
|
scp_recv_empty_channel:
|
||||||
/* the code only jumps here as a result of a zero read from channel_read()
|
/* the code only jumps here as a result of a zero read from channel_read()
|
||||||
so we check EOF status to avoid getting stuck in a loop */
|
so we check EOF status to avoid getting stuck in a loop */
|
||||||
if(libssh2_channel_eof(session->scpRecv_channel))
|
if(libssh2_channel_eof(session->scpRecv_channel))
|
||||||
@@ -778,7 +778,7 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
|
|||||||
else
|
else
|
||||||
return session->scpRecv_channel;
|
return session->scpRecv_channel;
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
scp_recv_error:
|
scp_recv_error:
|
||||||
tmp_err_code = session->err_code;
|
tmp_err_code = session->err_code;
|
||||||
tmp_err_msg = session->err_msg;
|
tmp_err_msg = session->err_msg;
|
||||||
while(libssh2_channel_free(session->scpRecv_channel) ==
|
while(libssh2_channel_free(session->scpRecv_channel) ==
|
||||||
@@ -1127,7 +1127,7 @@ scp_send(LIBSSH2_SESSION * session, const char *path, int mode,
|
|||||||
session->scpSend_state = libssh2_NB_state_idle;
|
session->scpSend_state = libssh2_NB_state_idle;
|
||||||
return session->scpSend_channel;
|
return session->scpSend_channel;
|
||||||
|
|
||||||
scp_send_empty_channel:
|
scp_send_empty_channel:
|
||||||
/* the code only jumps here as a result of a zero read from channel_read()
|
/* the code only jumps here as a result of a zero read from channel_read()
|
||||||
so we check EOF status to avoid getting stuck in a loop */
|
so we check EOF status to avoid getting stuck in a loop */
|
||||||
if(libssh2_channel_eof(session->scpSend_channel)) {
|
if(libssh2_channel_eof(session->scpSend_channel)) {
|
||||||
@@ -1137,7 +1137,7 @@ scp_send(LIBSSH2_SESSION * session, const char *path, int mode,
|
|||||||
else
|
else
|
||||||
return session->scpSend_channel;
|
return session->scpSend_channel;
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
scp_send_error:
|
scp_send_error:
|
||||||
tmp_err_code = session->err_code;
|
tmp_err_code = session->err_code;
|
||||||
tmp_err_msg = session->err_msg;
|
tmp_err_msg = session->err_msg;
|
||||||
while(libssh2_channel_free(session->scpSend_channel) ==
|
while(libssh2_channel_free(session->scpSend_channel) ==
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ sftp_packet_read(LIBSSH2_SFTP *sftp)
|
|||||||
sftp->partial_received = 5;
|
sftp->partial_received = 5;
|
||||||
memcpy(packet, sftp->packet_header + 4, 5);
|
memcpy(packet, sftp->packet_header + 4, 5);
|
||||||
|
|
||||||
window_adjust:
|
window_adjust:
|
||||||
recv_window = libssh2_channel_window_read_ex(channel, NULL, NULL);
|
recv_window = libssh2_channel_window_read_ex(channel, NULL, NULL);
|
||||||
|
|
||||||
if(sftp->partial_len > recv_window) {
|
if(sftp->partial_len > recv_window) {
|
||||||
@@ -1018,7 +1018,7 @@ static LIBSSH2_SFTP *sftp_init(LIBSSH2_SESSION *session)
|
|||||||
|
|
||||||
return sftp_handle;
|
return sftp_handle;
|
||||||
|
|
||||||
sftp_init_error:
|
sftp_init_error:
|
||||||
session->sftpInit_state = libssh2_NB_state_error_closing;
|
session->sftpInit_state = libssh2_NB_state_error_closing;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1918,7 +1918,7 @@ static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer,
|
|||||||
if((--handle->u.dir.names_left) == 0)
|
if((--handle->u.dir.names_left) == 0)
|
||||||
LIBSSH2_FREE(session, handle->u.dir.names_packet);
|
LIBSSH2_FREE(session, handle->u.dir.names_packet);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
_libssh2_debug((session, LIBSSH2_TRACE_SFTP,
|
_libssh2_debug((session, LIBSSH2_TRACE_SFTP,
|
||||||
"libssh2_sftp_readdir_ex() return %d",
|
"libssh2_sftp_readdir_ex() return %d",
|
||||||
filename_len));
|
filename_len));
|
||||||
|
|||||||
@@ -725,7 +725,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
|
|||||||
|
|
||||||
if(!remainpack) {
|
if(!remainpack) {
|
||||||
/* we have a full packet */
|
/* we have a full packet */
|
||||||
libssh2_transport_read_point1:
|
libssh2_transport_read_point1:
|
||||||
rc = fullpacket(session, encrypted);
|
rc = fullpacket(session, encrypted);
|
||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
|
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ userauth_password(LIBSSH2_SESSION *session,
|
|||||||
session->userauth_pswd_state = libssh2_NB_state_sent;
|
session->userauth_pswd_state = libssh2_NB_state_sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
password_response:
|
password_response:
|
||||||
|
|
||||||
if((session->userauth_pswd_state == libssh2_NB_state_sent)
|
if((session->userauth_pswd_state == libssh2_NB_state_sent)
|
||||||
|| (session->userauth_pswd_state == libssh2_NB_state_sent1)
|
|| (session->userauth_pswd_state == libssh2_NB_state_sent1)
|
||||||
@@ -1448,7 +1448,7 @@ _libssh2_userauth_publickey(LIBSSH2_SESSION *session,
|
|||||||
unsigned char *s;
|
unsigned char *s;
|
||||||
int auth_attempts = 0;
|
int auth_attempts = 0;
|
||||||
|
|
||||||
retry_auth:
|
retry_auth:
|
||||||
auth_attempts++;
|
auth_attempts++;
|
||||||
|
|
||||||
if(session->userauth_pblc_state == libssh2_NB_state_idle) {
|
if(session->userauth_pblc_state == libssh2_NB_state_idle) {
|
||||||
@@ -2232,7 +2232,7 @@ userauth_keyboard_interactive(LIBSSH2_SESSION * session,
|
|||||||
session->userauth_kybd_auth_failure = 0;
|
session->userauth_kybd_auth_failure = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
/*
|
/*
|
||||||
* It's safe to clean all the data here, because unallocated pointers
|
* It's safe to clean all the data here, because unallocated pointers
|
||||||
* are filled by zeroes
|
* are filled by zeroes
|
||||||
|
|||||||
Reference in New Issue
Block a user