1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-01-27 00:18:12 +03:00

src: move outlier leading && and || to the end of lines

Closes #1767
This commit is contained in:
Viktor Szakats
2025-12-25 20:29:17 +01:00
parent 1d464325fe
commit 3865eabe6e
10 changed files with 146 additions and 156 deletions

View File

@@ -345,8 +345,8 @@ cleanup:
*total += bytes_transferred; \
if(!ret) { \
err = GetLastError(); \
if((!agent->pending_io && ERROR_IO_PENDING == err) \
|| (agent->pending_io && ERROR_IO_INCOMPLETE == err)) { \
if((!agent->pending_io && ERROR_IO_PENDING == err) || \
(agent->pending_io && ERROR_IO_INCOMPLETE == err)) { \
agent->pending_io = TRUE; \
return LIBSSH2_ERROR_EAGAIN; \
} \

View File

@@ -331,8 +331,7 @@ channel_error:
while((_libssh2_packet_ask(session, SSH_MSG_CHANNEL_DATA,
&session->open_data,
&session->open_data_len, 1,
channel_id, 4) >= 0)
||
channel_id, 4) >= 0) ||
(_libssh2_packet_ask(session, SSH_MSG_CHANNEL_EXTENDED_DATA,
&session->open_data,
&session->open_data_len, 1,
@@ -1687,11 +1686,10 @@ _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid)
packet_type = packet->data[0];
if(((packet_type == SSH_MSG_CHANNEL_DATA)
|| (packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA))
&& ((packet->data_len >= 5)
&& (_libssh2_ntohu32(packet->data + 1)
== channel->local.id))) {
if(((packet_type == SSH_MSG_CHANNEL_DATA) ||
(packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA)) &&
((packet->data_len >= 5) &&
(_libssh2_ntohu32(packet->data + 1) == channel->local.id))) {
/* It's our channel at least */
int packet_stream_id;
@@ -1708,12 +1706,12 @@ _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid)
"Unexpected packet length");
}
if((streamid == LIBSSH2_CHANNEL_FLUSH_ALL)
|| ((packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA)
&& ((streamid == LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA)
|| (streamid == packet_stream_id)))
|| ((packet_type == SSH_MSG_CHANNEL_DATA)
&& (streamid == 0))) {
if((streamid == LIBSSH2_CHANNEL_FLUSH_ALL) ||
((packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA) &&
((streamid == LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA) ||
(streamid == packet_stream_id))) ||
((packet_type == SSH_MSG_CHANNEL_DATA) &&
(streamid == 0))) {
size_t bytes_to_flush = packet->data_len -
packet->data_head;
@@ -1877,9 +1875,8 @@ _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
*store = channel->remote.window_size;
if(channel->adjust_state == libssh2_NB_state_idle) {
if(!force
&& (adjustment + channel->adjust_queue <
LIBSSH2_CHANNEL_MINADJUST)) {
if(!force &&
(adjustment + channel->adjust_queue < LIBSSH2_CHANNEL_MINADJUST)) {
_libssh2_debug((channel->session, LIBSSH2_TRACE_CONN,
"Queueing %u bytes for receive window adjustment "
"for channel %u/%u",
@@ -2150,18 +2147,18 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
* or the standard stream with extended_data_merge
* enabled and data was available
*/
if((stream_id
&& (readpkt->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
&& (channel->local.id == channel->read_local_id)
&& (readpkt->data_len >= 9)
&& (stream_id == (int) _libssh2_ntohu32(readpkt->data + 5)))
|| (!stream_id && (readpkt->data[0] == SSH_MSG_CHANNEL_DATA)
&& (channel->local.id == channel->read_local_id))
|| (!stream_id
&& (readpkt->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
&& (channel->local.id == channel->read_local_id)
&& (channel->remote.extended_data_ignore_mode ==
LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) {
if((stream_id &&
(readpkt->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) &&
(channel->local.id == channel->read_local_id) &&
(readpkt->data_len >= 9) &&
(stream_id == (int)_libssh2_ntohu32(readpkt->data + 5))) ||
(!stream_id && (readpkt->data[0] == SSH_MSG_CHANNEL_DATA) &&
(channel->local.id == channel->read_local_id)) ||
(!stream_id &&
(readpkt->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) &&
(channel->local.id == channel->read_local_id) &&
(channel->remote.extended_data_ignore_mode ==
LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) {
/* figure out much more data we want to read */
bytes_want = buflen - bytes_read;
@@ -2297,21 +2294,19 @@ _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel, int stream_id)
* or the standard stream with extended_data_merge
* enabled and data was available
*/
if((stream_id
&& (read_packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
&& (channel->local.id == read_local_id)
&& (read_packet->data_len >= 9)
&& (stream_id == (int) _libssh2_ntohu32(read_packet->data + 5)))
||
(!stream_id
&& (read_packet->data[0] == SSH_MSG_CHANNEL_DATA)
&& (channel->local.id == read_local_id))
||
(!stream_id
&& (read_packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
&& (channel->local.id == read_local_id)
&& (channel->remote.extended_data_ignore_mode
== LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) {
if((stream_id &&
(read_packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) &&
(channel->local.id == read_local_id) &&
(read_packet->data_len >= 9) &&
(stream_id == (int) _libssh2_ntohu32(read_packet->data + 5))) ||
(!stream_id &&
(read_packet->data[0] == SSH_MSG_CHANNEL_DATA) &&
(channel->local.id == read_local_id)) ||
(!stream_id &&
(read_packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) &&
(channel->local.id == read_local_id) &&
(channel->remote.extended_data_ignore_mode
== LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) {
return read_packet->data_len - read_packet->data_head;
}
@@ -2562,10 +2557,10 @@ libssh2_channel_eof(LIBSSH2_CHANNEL * channel)
continue;
}
if(((packet->data[0] == SSH_MSG_CHANNEL_DATA)
|| (packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA))
&& ((packet->data_len >= 5)
&& (channel->local.id == _libssh2_ntohu32(packet->data + 1)))) {
if(((packet->data[0] == SSH_MSG_CHANNEL_DATA) ||
(packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)) &&
((packet->data_len >= 5) &&
(channel->local.id == _libssh2_ntohu32(packet->data + 1)))) {
/* There's data waiting to be read yet, mask the EOF status */
return 0;
}
@@ -2829,8 +2824,8 @@ int _libssh2_channel_free(LIBSSH2_CHANNEL *channel)
}
/* Allow channel freeing even when the socket has lost its connection */
if(!channel->local.close
&& (session->socket_state == LIBSSH2_SOCKET_CONNECTED)) {
if(!channel->local.close &&
(session->socket_state == LIBSSH2_SOCKET_CONNECTED)) {
rc = _libssh2_channel_close(channel);
if(rc == LIBSSH2_ERROR_EAGAIN)
@@ -2855,8 +2850,7 @@ int _libssh2_channel_free(LIBSSH2_CHANNEL *channel)
/* Clear out packets meant for this channel */
_libssh2_htonu32(channel_id, channel->local.id);
while((_libssh2_packet_ask(session, SSH_MSG_CHANNEL_DATA, &data,
&data_len, 1, channel_id, 4) >= 0)
||
&data_len, 1, channel_id, 4) >= 0) ||
(_libssh2_packet_ask(session, SSH_MSG_CHANNEL_EXTENDED_DATA, &data,
&data_len, 1, channel_id, 4) >= 0)) {
LIBSSH2_FREE(session, data);
@@ -2947,11 +2941,10 @@ libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel,
packet_type = packet->data[0];
if(((packet_type == SSH_MSG_CHANNEL_DATA)
|| (packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA))
&& ((packet->data_len >= 5)
&& (_libssh2_ntohu32(packet->data + 1) ==
channel->local.id))) {
if(((packet_type == SSH_MSG_CHANNEL_DATA) ||
(packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA)) &&
((packet->data_len >= 5) &&
(_libssh2_ntohu32(packet->data + 1) == channel->local.id))) {
bytes_queued += packet->data_len - packet->data_head;
}

View File

@@ -3543,8 +3543,8 @@ _libssh2_kex_agree_instr(unsigned char *haystack, size_t haystack_len,
/* Needle at X position */
if((strncmp((char *) s, (const char *) needle, needle_len) == 0) &&
(((s - haystack) + needle_len) == haystack_len
|| s[needle_len] == ',')) {
(((s - haystack) + needle_len) == haystack_len ||
s[needle_len] == ',')) {
return s;
}
}
@@ -3952,26 +3952,27 @@ static int kex_agree_methods(LIBSSH2_SESSION * session, unsigned char *data,
return -1;
}
if(kex_agree_crypt(session, &session->local, crypt_cs, crypt_cs_len)
|| kex_agree_crypt(session, &session->remote, crypt_sc, crypt_sc_len)) {
if(kex_agree_crypt(session, &session->local, crypt_cs, crypt_cs_len) ||
kex_agree_crypt(session, &session->remote, crypt_sc, crypt_sc_len)) {
return -1;
}
/* This must happen after kex_agree_crypt since some MACs depend on the
negotiated crypto method */
if(kex_agree_mac(session, &session->local, mac_cs, mac_cs_len)
|| kex_agree_mac(session, &session->remote, mac_sc, mac_sc_len)) {
if(kex_agree_mac(session, &session->local, mac_cs, mac_cs_len) ||
kex_agree_mac(session, &session->remote, mac_sc, mac_sc_len)) {
return -1;
}
if(kex_agree_comp(session, &session->local, comp_cs, comp_cs_len)
|| kex_agree_comp(session, &session->remote, comp_sc, comp_sc_len)) {
if(kex_agree_comp(session, &session->local, comp_cs, comp_cs_len) ||
kex_agree_comp(session, &session->remote, comp_sc, comp_sc_len)) {
return -1;
}
#if 0
if(libssh2_kex_agree_lang(session, &session->local, lang_cs, lang_cs_len)
|| libssh2_kex_agree_lang(session, &session->remote, lang_sc,
if(libssh2_kex_agree_lang(session, &session->local, lang_cs,
lang_cs_len) ||
libssh2_kex_agree_lang(session, &session->remote, lang_sc,
lang_sc_len)) {
return -1;
}

View File

@@ -1130,10 +1130,9 @@ libssh2_packet_add_jump_point1:
"Channel %u received request type %.*s (wr %X)",
channel, (int)len, data + 9, want_reply));
if(len == strlen("exit-status")
&& (strlen("exit-status") + 9) <= datalen
&& !memcmp("exit-status", data + 9,
strlen("exit-status"))) {
if(len == strlen("exit-status") &&
(strlen("exit-status") + 9) <= datalen &&
!memcmp("exit-status", data + 9, strlen("exit-status"))) {
/* we've got "exit-status" packet. Set the session value */
if(datalen >= 20)
@@ -1153,10 +1152,10 @@ libssh2_packet_add_jump_point1:
}
}
else if(len == strlen("exit-signal")
&& (strlen("exit-signal") + 9) <= datalen
&& !memcmp("exit-signal", data + 9,
strlen("exit-signal"))) {
else if(len == strlen("exit-signal") &&
(strlen("exit-signal") + 9) <= datalen &&
!memcmp("exit-signal", data + 9,
strlen("exit-signal"))) {
/* command terminated due to signal */
if(datalen >= 20)
channelp = _libssh2_channel_locate(session, channel);
@@ -1249,11 +1248,10 @@ libssh2_packet_add_jump_point4:
if(datalen < 17)
;
else if((datalen >= (strlen("forwarded-tcpip") + 5)) &&
(strlen("forwarded-tcpip") ==
_libssh2_ntohu32(data + 1))
&&
(memcmp(data + 5, "forwarded-tcpip",
strlen("forwarded-tcpip")) == 0)) {
(strlen("forwarded-tcpip") ==
_libssh2_ntohu32(data + 1)) &&
(memcmp(data + 5, "forwarded-tcpip",
strlen("forwarded-tcpip")) == 0)) {
/* init the state struct */
memset(&session->packAdd_Qlstn_state, 0,
@@ -1413,11 +1411,10 @@ _libssh2_packet_ask(LIBSSH2_SESSION * session, unsigned char packet_type,
(unsigned int)packet_type));
while(packet) {
if(packet->data[0] == packet_type
&& (packet->data_len >= (match_ofs + match_len))
&& (!match_buf ||
(memcmp(packet->data + match_ofs, match_buf,
match_len) == 0))) {
if(packet->data[0] == packet_type &&
(packet->data_len >= (match_ofs + match_len)) &&
(!match_buf ||
(memcmp(packet->data + match_ofs, match_buf, match_len) == 0))) {
*data = packet->data;
*data_len = packet->data_len;

View File

@@ -408,8 +408,8 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
session->scpRecv_state = libssh2_NB_state_sent2;
}
if((session->scpRecv_state == libssh2_NB_state_sent2)
|| (session->scpRecv_state == libssh2_NB_state_sent3)) {
if((session->scpRecv_state == libssh2_NB_state_sent2) ||
(session->scpRecv_state == libssh2_NB_state_sent3)) {
while(sb && (session->scpRecv_response_len <
LIBSSH2_SCP_RESPONSE_BUFLEN)) {
unsigned char *s, *p;
@@ -477,26 +477,26 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
if((session->scpRecv_response_len > 1) &&
((session->
scpRecv_response[session->scpRecv_response_len - 1] <
'0')
|| (session->
scpRecv_response[session->scpRecv_response_len - 1] >
'9'))
&& (session->
scpRecv_response[session->scpRecv_response_len - 1] !=
' ')
&& (session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\r')
&& (session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\n')) {
'0') ||
(session->
scpRecv_response[session->scpRecv_response_len - 1] >
'9')) &&
(session->
scpRecv_response[session->scpRecv_response_len - 1] !=
' ') &&
(session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\r') &&
(session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\n')) {
_libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
"Invalid data in SCP response");
goto scp_recv_error;
}
if((session->scpRecv_response_len < 9)
|| (session->
if((session->scpRecv_response_len < 9) ||
(session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\n')) {
if(session->scpRecv_response_len ==
@@ -516,10 +516,10 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
logic above */
while((session->
scpRecv_response[session->scpRecv_response_len - 1] ==
'\r')
|| (session->
scpRecv_response[session->scpRecv_response_len -
1] == '\n'))
'\r') ||
(session->
scpRecv_response[session->scpRecv_response_len - 1] ==
'\n'))
session->scpRecv_response_len--;
session->scpRecv_response[session->scpRecv_response_len] =
'\0';
@@ -609,8 +609,8 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
session->scpRecv_state = libssh2_NB_state_sent5;
}
if((session->scpRecv_state == libssh2_NB_state_sent5)
|| (session->scpRecv_state == libssh2_NB_state_sent6)) {
if((session->scpRecv_state == libssh2_NB_state_sent5) ||
(session->scpRecv_state == libssh2_NB_state_sent6)) {
while(session->scpRecv_response_len < LIBSSH2_SCP_RESPONSE_BUFLEN) {
char *s, *p, *e = NULL;
@@ -644,11 +644,10 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
if((session->scpRecv_response_len > 1) &&
(session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\r')
&& (session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\n')
&&
'\r') &&
(session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\n') &&
(session->
scpRecv_response[session->scpRecv_response_len - 1]
< 32)) {
@@ -657,10 +656,10 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
goto scp_recv_error;
}
if((session->scpRecv_response_len < 7)
|| (session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\n')) {
if((session->scpRecv_response_len < 7) ||
(session->
scpRecv_response[session->scpRecv_response_len - 1] !=
'\n')) {
if(session->scpRecv_response_len ==
LIBSSH2_SCP_RESPONSE_BUFLEN) {
/* You had your chance */
@@ -678,10 +677,10 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
logic above */
while((session->
scpRecv_response[session->scpRecv_response_len - 1] ==
'\r')
|| (session->
scpRecv_response[session->scpRecv_response_len -
1] == '\n')) {
'\r') ||
(session->
scpRecv_response[session->scpRecv_response_len - 1] ==
'\n')) {
session->scpRecv_response_len--;
}
session->scpRecv_response[session->scpRecv_response_len] =

View File

@@ -119,8 +119,8 @@ banner_receive(LIBSSH2_SESSION * session)
}
while((banner_len < sizeof(session->banner_TxRx_banner)) &&
((banner_len == 0)
|| (session->banner_TxRx_banner[banner_len - 1] != '\n'))) {
((banner_len == 0) ||
(session->banner_TxRx_banner[banner_len - 1] != '\n'))) {
char c = '\0';
/* no incoming block yet! */
@@ -854,10 +854,10 @@ session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock)
session->startup_service_length =
_libssh2_ntohu32(session->startup_data + 1);
if((session->startup_service_length != (sizeof("ssh-userauth") - 1))
|| strncmp("ssh-userauth",
(const char *) session->startup_data + 5,
session->startup_service_length)) {
if((session->startup_service_length != (sizeof("ssh-userauth") - 1)) ||
strncmp("ssh-userauth",
(const char *) session->startup_data + 5,
session->startup_service_length)) {
LIBSSH2_FREE(session, session->startup_data);
session->startup_data = NULL;
return _libssh2_error(session, LIBSSH2_ERROR_PROTO,
@@ -1560,8 +1560,8 @@ libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended)
if(channel->local.id == _libssh2_ntohu32(packet->data + 1)) {
if(extended == 1 &&
(packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA
|| packet->data[0] == SSH_MSG_CHANNEL_DATA)) {
(packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA ||
packet->data[0] == SSH_MSG_CHANNEL_DATA)) {
return 1;
}
else if(extended == 0 &&
@@ -1775,8 +1775,8 @@ libssh2_poll(LIBSSH2_POLLFD * fds, unsigned int nfds, long timeout)
poll_channel_write(fds[i].fd. channel) ?
LIBSSH2_POLLFD_POLLOUT : 0;
}
if(fds[i].fd.channel->remote.close
|| fds[i].fd.channel->local.close) {
if(fds[i].fd.channel->remote.close ||
fds[i].fd.channel->local.close) {
fds[i].revents |= LIBSSH2_POLLFD_CHANNEL_CLOSED;
}
if(fds[i].fd.channel->session->socket_state ==

View File

@@ -231,8 +231,8 @@ sftp_packet_add(LIBSSH2_SFTP *sftp, unsigned char *data,
request_id));
/* Don't add the packet if it answers a request we've given up on. */
if((data[0] == SSH_FXP_STATUS || data[0] == SSH_FXP_DATA)
&& find_zombie_request(sftp, request_id)) {
if((data[0] == SSH_FXP_STATUS || data[0] == SSH_FXP_DATA) &&
find_zombie_request(sftp, request_id)) {
/* If we get here, the file ended before the response arrived. We
are no longer interested in the request so we discard it */
@@ -1000,8 +1000,8 @@ static LIBSSH2_SFTP *sftp_init(LIBSSH2_SESSION *session)
extversion = (uint32_t)strtol(extversion_str, NULL, 10);
LIBSSH2_FREE(session, extversion_str);
}
if(extname_len == 24
&& strncmp("posix-rename@openssh.com", (char *)extname, 24) == 0) {
if(extname_len == 24 &&
strncmp("posix-rename@openssh.com", (char *)extname, 24) == 0) {
sftp_handle->posix_rename_version = extversion;
}

View File

@@ -147,8 +147,8 @@ decrypt(LIBSSH2_SESSION * session, unsigned char *source,
/* If the last block would be less than a whole blocksize, combine it
with the previous block to make it larger. This ensures that the
whole MAC is included in a single decrypt call. */
if(CRYPT_FLAG_R(session, PKTLEN_AAD) && IS_LAST(firstlast)
&& (len < blocksize*2)) {
if(CRYPT_FLAG_R(session, PKTLEN_AAD) && IS_LAST(firstlast) &&
(len < blocksize*2)) {
decryptlen = len;
lowerfirstlast = LAST_BLOCK;
}
@@ -462,8 +462,8 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
assert(remainbuf >= 0);
if(remainbuf < blocksize ||
(CRYPT_FLAG_R(session, REQUIRES_FULL_PACKET)
&& ((ssize_t)p->total_num) > remainbuf)) {
(CRYPT_FLAG_R(session, REQUIRES_FULL_PACKET) &&
((ssize_t)p->total_num) > remainbuf)) {
/* If we have less than a blocksize left, it is too
little data to deal with, read more */
ssize_t nread;
@@ -1209,8 +1209,8 @@ int _libssh2_transport_send(LIBSSH2_SESSION *session,
/* The INTEGRATED_MAC case always has an extra call below, so
it will never be LAST_BLOCK up here. */
int firstlast = i == 0 ? FIRST_BLOCK :
(!CRYPT_FLAG_L(session, INTEGRATED_MAC)
&& (i == packet_length - session->local.crypt->blocksize)
(!CRYPT_FLAG_L(session, INTEGRATED_MAC) &&
(i == packet_length - session->local.crypt->blocksize)
? LAST_BLOCK : MIDDLE_BLOCK);
/* In the AAD case, the last block would be only 4 bytes
because everything is offset by 4 since the initial

View File

@@ -367,9 +367,9 @@ userauth_password(LIBSSH2_SESSION *session,
password_response:
if((session->userauth_pswd_state == libssh2_NB_state_sent)
|| (session->userauth_pswd_state == libssh2_NB_state_sent1)
|| (session->userauth_pswd_state == libssh2_NB_state_sent2)) {
if((session->userauth_pswd_state == libssh2_NB_state_sent) ||
(session->userauth_pswd_state == libssh2_NB_state_sent1) ||
(session->userauth_pswd_state == libssh2_NB_state_sent2)) {
if(session->userauth_pswd_state == libssh2_NB_state_sent) {
rc = _libssh2_packet_requirev(session, reply_codes,
&session->userauth_pswd_data,
@@ -426,9 +426,9 @@ password_response:
}
if((session->userauth_pswd_data[0] ==
SSH_MSG_USERAUTH_PASSWD_CHANGEREQ)
|| (session->userauth_pswd_data0 ==
SSH_MSG_USERAUTH_PASSWD_CHANGEREQ)) {
SSH_MSG_USERAUTH_PASSWD_CHANGEREQ) ||
(session->userauth_pswd_data0 ==
SSH_MSG_USERAUTH_PASSWD_CHANGEREQ)) {
session->userauth_pswd_data0 = SSH_MSG_USERAUTH_PASSWD_CHANGEREQ;
if((session->userauth_pswd_state == libssh2_NB_state_sent1) ||
@@ -759,9 +759,9 @@ memory_read_privatekey(LIBSSH2_SESSION * session,
*hostkey_method = NULL;
*hostkey_abstract = NULL;
while(*hostkey_methods_avail && (*hostkey_methods_avail)->name) {
if((*hostkey_methods_avail)->initPEMFromMemory
&& strncmp((*hostkey_methods_avail)->name, (const char *) method,
method_len) == 0) {
if((*hostkey_methods_avail)->initPEMFromMemory &&
strncmp((*hostkey_methods_avail)->name, (const char *) method,
method_len) == 0) {
*hostkey_method = *hostkey_methods_avail;
break;
}
@@ -801,9 +801,9 @@ file_read_privatekey(LIBSSH2_SESSION * session,
*hostkey_method = NULL;
*hostkey_abstract = NULL;
while(*hostkey_methods_avail && (*hostkey_methods_avail)->name) {
if((*hostkey_methods_avail)->initPEM
&& strncmp((*hostkey_methods_avail)->name, (const char *) method,
method_len) == 0) {
if((*hostkey_methods_avail)->initPEM &&
strncmp((*hostkey_methods_avail)->name, (const char *) method,
method_len) == 0) {
*hostkey_method = *hostkey_methods_avail;
break;
}

View File

@@ -1033,8 +1033,8 @@ _libssh2_wincng_bn_ltob(unsigned char *pbInput,
}
pbOutput[0] = 0;
for(index = 0; ((index + offset) < cbOutput)
&& (index < cbInput); index++) {
for(index = 0; ((index + offset) < cbOutput) &&
(index < cbInput); index++) {
pbOutput[index + offset] = pbInput[length - index];
}