mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-15 18:32:26 +03:00
fix printf format warning
uint32_t should be formated by PRI?32 Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Change-Id: I811cfd764010f9e8bb599b370155ac065ee1905c
This commit is contained in:
@@ -50,18 +50,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
/* Visual Studio hasn't inttypes.h so it doesn't know uint32_t */
|
|
||||||
typedef int int32_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
typedef int mode_t;
|
typedef int mode_t;
|
||||||
#else /* _MSC_VER */
|
#else /* _MSC_VER */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ static int agent_talk(struct ssh_session_struct *session,
|
|||||||
char err_msg[SSH_ERRNO_MSG_MAX] = {0};
|
char err_msg[SSH_ERRNO_MSG_MAX] = {0};
|
||||||
|
|
||||||
len = ssh_buffer_get_len(request);
|
len = ssh_buffer_get_len(request);
|
||||||
SSH_LOG(SSH_LOG_TRACE, "Request length: %u", len);
|
SSH_LOG(SSH_LOG_TRACE, "Request length: %" PRIu32, len);
|
||||||
PUSH_BE_U32(payload, 0, len);
|
PUSH_BE_U32(payload, 0, len);
|
||||||
|
|
||||||
/* send length and then the request packet */
|
/* send length and then the request packet */
|
||||||
@@ -299,10 +299,10 @@ static int agent_talk(struct ssh_session_struct *session,
|
|||||||
len = PULL_BE_U32(payload, 0);
|
len = PULL_BE_U32(payload, 0);
|
||||||
if (len > 256 * 1024) {
|
if (len > 256 * 1024) {
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
"Authentication response too long: %u", len);
|
"Authentication response too long: %" PRIu32, len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_TRACE, "Response length: %u", len);
|
SSH_LOG(SSH_LOG_TRACE, "Response length: %" PRIu32, len);
|
||||||
|
|
||||||
payload = ssh_buffer_allocate(reply, len);
|
payload = ssh_buffer_allocate(reply, len);
|
||||||
if (payload == NULL) {
|
if (payload == NULL) {
|
||||||
@@ -359,7 +359,7 @@ uint32_t ssh_agent_get_ident_count(struct ssh_session_struct *session)
|
|||||||
rc = ssh_buffer_get_u8(reply, (uint8_t *) &type);
|
rc = ssh_buffer_get_u8(reply, (uint8_t *) &type);
|
||||||
if (rc != sizeof(uint8_t)) {
|
if (rc != sizeof(uint8_t)) {
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
"Bad authentication reply size: %d", rc);
|
"Bad authentication reply size: %" PRId32, rc);
|
||||||
SSH_BUFFER_FREE(reply);
|
SSH_BUFFER_FREE(reply);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1769,10 +1769,10 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"%d keyboard-interactive prompts", nprompts);
|
"%" PRId32 " keyboard-interactive prompts", nprompts);
|
||||||
if (nprompts > KBDINT_MAX_PROMPT) {
|
if (nprompts > KBDINT_MAX_PROMPT) {
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
"Too much prompts requested by the server: %u (0x%.4x)",
|
"Too much prompts requested by the server: %" PRIu32 " (0x%.4" PRIx32 ")",
|
||||||
nprompts, nprompts);
|
nprompts, nprompts);
|
||||||
ssh_kbdint_free(session->kbdint);
|
ssh_kbdint_free(session->kbdint);
|
||||||
session->kbdint = NULL;
|
session->kbdint = NULL;
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf){
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"Received a CHANNEL_OPEN_CONFIRMATION for channel %d:%d",
|
"Received a CHANNEL_OPEN_CONFIRMATION for channel %" PRId32 ":%" PRId32,
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel);
|
channel->remote_channel);
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open_fail){
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssh_set_error(session, SSH_REQUEST_DENIED,
|
ssh_set_error(session, SSH_REQUEST_DENIED,
|
||||||
"Channel opening failure: channel %u error (%"PRIu32") %s",
|
"Channel opening failure: channel %" PRIu32 " error (%" PRIu32 ") %s",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
(uint32_t) code,
|
(uint32_t) code,
|
||||||
error);
|
error);
|
||||||
@@ -328,7 +328,7 @@ channel_open(ssh_channel channel,
|
|||||||
channel->local_window = window;
|
channel->local_window = window;
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"Creating a channel %d with %d window and %d max packet",
|
"Creating a channel %" PRId32 " with %" PRId32 " window and %" PRId32 " max packet",
|
||||||
channel->local_channel, window, maxpacket);
|
channel->local_channel, window, maxpacket);
|
||||||
|
|
||||||
rc = ssh_buffer_pack(session->out_buffer,
|
rc = ssh_buffer_pack(session->out_buffer,
|
||||||
@@ -356,7 +356,7 @@ channel_open(ssh_channel channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Sent a SSH_MSG_CHANNEL_OPEN type %s for channel %d",
|
"Sent a SSH_MSG_CHANNEL_OPEN type %s for channel %" PRId32,
|
||||||
type, channel->local_channel);
|
type, channel->local_channel);
|
||||||
|
|
||||||
pending:
|
pending:
|
||||||
@@ -418,7 +418,7 @@ static int grow_window(ssh_session session,
|
|||||||
|
|
||||||
if (new_window <= channel->local_window) {
|
if (new_window <= channel->local_window) {
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"growing window (channel %d:%d) to %d bytes : not needed (%d bytes)",
|
"growing window (channel %" PRId32 ":%" PRId32 ") to %" PRId32 " bytes : not needed (%" PRId32 " bytes)",
|
||||||
channel->local_channel, channel->remote_channel, new_window,
|
channel->local_channel, channel->remote_channel, new_window,
|
||||||
channel->local_window);
|
channel->local_window);
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ static int grow_window(ssh_session session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"growing window (channel %d:%d) to %d bytes",
|
"growing window (channel %" PRId32 ":%" PRId32 ") to %" PRId32 " bytes",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel,
|
channel->remote_channel,
|
||||||
new_window);
|
new_window);
|
||||||
@@ -513,7 +513,7 @@ SSH_PACKET_CALLBACK(channel_rcv_change_window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"Adding %d bytes to channel (%d:%d) (from %d bytes)",
|
"Adding %" PRId32 " bytes to channel (%" PRId32 ":%" PRId32 ") (from %" PRId32 " bytes)",
|
||||||
bytes,
|
bytes,
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel,
|
channel->remote_channel,
|
||||||
@@ -562,7 +562,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){
|
|||||||
len = ssh_string_len(str);
|
len = ssh_string_len(str);
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Channel receiving %u bytes data in %d (local win=%d remote win=%d)",
|
"Channel receiving %" PRIu32 " bytes data in %d (local win=%" PRId32 " remote win=%" PRId32 ")",
|
||||||
len,
|
len,
|
||||||
is_stderr,
|
is_stderr,
|
||||||
channel->local_window,
|
channel->local_window,
|
||||||
@@ -571,7 +571,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){
|
|||||||
/* What shall we do in this case? Let's accept it anyway */
|
/* What shall we do in this case? Let's accept it anyway */
|
||||||
if (len > channel->local_window) {
|
if (len > channel->local_window) {
|
||||||
SSH_LOG(SSH_LOG_RARE,
|
SSH_LOG(SSH_LOG_RARE,
|
||||||
"Data packet too big for our window(%u vs %d)",
|
"Data packet too big for our window(%" PRIu32 " vs %" PRId32 ")",
|
||||||
len,
|
len,
|
||||||
channel->local_window);
|
channel->local_window);
|
||||||
}
|
}
|
||||||
@@ -590,7 +590,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Channel windows are now (local win=%d remote win=%d)",
|
"Channel windows are now (local win=%" PRId32 " remote win=%" PRId32 ")",
|
||||||
channel->local_window,
|
channel->local_window,
|
||||||
channel->remote_window);
|
channel->remote_window);
|
||||||
|
|
||||||
@@ -644,7 +644,7 @@ SSH_PACKET_CALLBACK(channel_rcv_eof) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Received eof on channel (%d:%d)",
|
"Received eof on channel (%" PRId32 ":%" PRId32 ")",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel);
|
channel->remote_channel);
|
||||||
/* channel->remote_window = 0; */
|
/* channel->remote_window = 0; */
|
||||||
@@ -689,7 +689,7 @@ SSH_PACKET_CALLBACK(channel_rcv_close) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Received close on channel (%d:%d)",
|
"Received close on channel (%" PRId32 ":%" PRId32 ")",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel);
|
channel->remote_channel);
|
||||||
|
|
||||||
@@ -916,7 +916,7 @@ int channel_default_bufferize(ssh_channel channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"placing %u bytes into channel buffer (%s)",
|
"placing %" PRIu32 " bytes into channel buffer (%s)",
|
||||||
len,
|
len,
|
||||||
is_stderr ? "stderr" : "stdout");
|
is_stderr ? "stderr" : "stdout");
|
||||||
if (!is_stderr) {
|
if (!is_stderr) {
|
||||||
@@ -1306,7 +1306,7 @@ int ssh_channel_send_eof(ssh_channel channel)
|
|||||||
|
|
||||||
rc = ssh_packet_send(session);
|
rc = ssh_packet_send(session);
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Sent a EOF on client channel (%d:%d)",
|
"Sent a EOF on client channel (%" PRId32 ":%" PRId32 ")",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel);
|
channel->remote_channel);
|
||||||
if (rc != SSH_OK) {
|
if (rc != SSH_OK) {
|
||||||
@@ -1371,7 +1371,7 @@ int ssh_channel_close(ssh_channel channel)
|
|||||||
|
|
||||||
rc = ssh_packet_send(session);
|
rc = ssh_packet_send(session);
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Sent a close on client channel (%d:%d)",
|
"Sent a close on client channel (%" PRId32 ":%" PRId32 ")",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel);
|
channel->remote_channel);
|
||||||
|
|
||||||
@@ -1454,7 +1454,7 @@ static int channel_write_common(ssh_channel channel,
|
|||||||
|
|
||||||
if (len > INT_MAX) {
|
if (len > INT_MAX) {
|
||||||
SSH_LOG(SSH_LOG_TRACE,
|
SSH_LOG(SSH_LOG_TRACE,
|
||||||
"Length (%u) is bigger than INT_MAX", len);
|
"Length (%" PRIu32 ") is bigger than INT_MAX", len);
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1466,7 +1466,7 @@ static int channel_write_common(ssh_channel channel,
|
|||||||
|
|
||||||
if (channel->local_eof) {
|
if (channel->local_eof) {
|
||||||
ssh_set_error(session, SSH_REQUEST_DENIED,
|
ssh_set_error(session, SSH_REQUEST_DENIED,
|
||||||
"Can't write to channel %d:%d after EOF was sent",
|
"Can't write to channel %" PRId32 ":%" PRId32 " after EOF was sent",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel);
|
channel->remote_channel);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1491,7 +1491,7 @@ static int channel_write_common(ssh_channel channel,
|
|||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
if (channel->remote_window < len) {
|
if (channel->remote_window < len) {
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"Remote window is %d bytes. going to write %d bytes",
|
"Remote window is %" PRId32 " bytes. going to write %" PRId32 " bytes",
|
||||||
channel->remote_window,
|
channel->remote_window,
|
||||||
len);
|
len);
|
||||||
/* What happens when the channel window is zero? */
|
/* What happens when the channel window is zero? */
|
||||||
@@ -1705,7 +1705,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_success){
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Received SSH_CHANNEL_SUCCESS on channel (%d:%d)",
|
"Received SSH_CHANNEL_SUCCESS on channel (%" PRId32 ":%" PRId32 ")",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel);
|
channel->remote_channel);
|
||||||
if(channel->request_state != SSH_CHANNEL_REQ_STATE_PENDING){
|
if(channel->request_state != SSH_CHANNEL_REQ_STATE_PENDING){
|
||||||
@@ -1736,7 +1736,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_failure){
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Received SSH_CHANNEL_FAILURE on channel (%d:%d)",
|
"Received SSH_CHANNEL_FAILURE on channel (%" PRId32 ":%" PRId32 ")",
|
||||||
channel->local_channel,
|
channel->local_channel,
|
||||||
channel->remote_channel);
|
channel->remote_channel);
|
||||||
if(channel->request_state != SSH_CHANNEL_REQ_STATE_PENDING){
|
if(channel->request_state != SSH_CHANNEL_REQ_STATE_PENDING){
|
||||||
@@ -3007,7 +3007,7 @@ int ssh_channel_read_timeout(ssh_channel channel,
|
|||||||
* as asked
|
* as asked
|
||||||
*/
|
*/
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Read (%d) buffered : %d bytes. Window: %d",
|
"Read (%" PRId32 ") buffered : %" PRId32 " bytes. Window: %" PRId32,
|
||||||
count,
|
count,
|
||||||
ssh_buffer_get_len(stdbuf),
|
ssh_buffer_get_len(stdbuf),
|
||||||
channel->local_window);
|
channel->local_window);
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ static int ssh_retrieve_dhgroup_file(FILE *moduli,
|
|||||||
line);
|
line);
|
||||||
} else {
|
} else {
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"No moduli found for [%u:%u:%u]",
|
"No moduli found for [%" PRIu32 ":%" PRIu32 ":%" PRIu32 "]",
|
||||||
pmin,
|
pmin,
|
||||||
pn,
|
pn,
|
||||||
pmax);
|
pmax);
|
||||||
@@ -621,12 +621,12 @@ static SSH_PACKET_CALLBACK(ssh_packet_server_dhgex_request)
|
|||||||
ssh_set_error_invalid(session);
|
ssh_set_error_invalid(session);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_DEBUG, "dh-gex: DHGEX_REQUEST[%u:%u:%u]", pmin, pn, pmax);
|
SSH_LOG(SSH_LOG_DEBUG, "dh-gex: DHGEX_REQUEST[%" PRIu32 ":%" PRIu32 ":%" PRIu32 "]", pmin, pn, pmax);
|
||||||
|
|
||||||
if (pmin > pn || pn > pmax || pn > DH_PMAX || pmax < DH_PMIN) {
|
if (pmin > pn || pn > pmax || pn > DH_PMAX || pmax < DH_PMIN) {
|
||||||
ssh_set_error(session,
|
ssh_set_error(session,
|
||||||
SSH_FATAL,
|
SSH_FATAL,
|
||||||
"Invalid dh-gex arguments [%u:%u:%u]",
|
"Invalid dh-gex arguments [%" PRIu32 ":%" PRIu32 ":%" PRIu32 "]",
|
||||||
pmin,
|
pmin,
|
||||||
pn,
|
pn,
|
||||||
pmax);
|
pmax);
|
||||||
@@ -653,7 +653,7 @@ static SSH_PACKET_CALLBACK(ssh_packet_server_dhgex_request)
|
|||||||
if (rc == SSH_ERROR) {
|
if (rc == SSH_ERROR) {
|
||||||
ssh_set_error(session,
|
ssh_set_error(session,
|
||||||
SSH_FATAL,
|
SSH_FATAL,
|
||||||
"Couldn't find DH group for [%u:%u:%u]",
|
"Couldn't find DH group for [%" PRIu32 ":%" PRIu32 ":%" PRIu32 "]",
|
||||||
pmin,
|
pmin,
|
||||||
pn,
|
pn,
|
||||||
pmax);
|
pmax);
|
||||||
|
|||||||
@@ -1076,10 +1076,10 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){
|
|||||||
session->kbdint->nanswers = 0;
|
session->kbdint->nanswers = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,"kbdint: %d answers",nanswers);
|
SSH_LOG(SSH_LOG_PACKET,"kbdint: %" PRId32 " answers",nanswers);
|
||||||
if (nanswers > KBDINT_MAX_PROMPT) {
|
if (nanswers > KBDINT_MAX_PROMPT) {
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
"Too much answers received from client: %u (0x%.4x)",
|
"Too much answers received from client: %" PRIu32 " (0x%.4" PRIx32 ")",
|
||||||
nanswers, nanswers);
|
nanswers, nanswers);
|
||||||
ssh_kbdint_free(session->kbdint);
|
ssh_kbdint_free(session->kbdint);
|
||||||
session->kbdint = NULL;
|
session->kbdint = NULL;
|
||||||
@@ -1090,7 +1090,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){
|
|||||||
if(nanswers != session->kbdint->nprompts) {
|
if(nanswers != session->kbdint->nprompts) {
|
||||||
/* warn but let the application handle this case */
|
/* warn but let the application handle this case */
|
||||||
SSH_LOG(SSH_LOG_DEBUG, "Warning: Number of prompts and answers"
|
SSH_LOG(SSH_LOG_DEBUG, "Warning: Number of prompts and answers"
|
||||||
" mismatch: p=%u a=%u", session->kbdint->nprompts, nanswers);
|
" mismatch: p=%" PRIu32 " a=%" PRIu32, session->kbdint->nprompts, nanswers);
|
||||||
}
|
}
|
||||||
session->kbdint->nanswers = nanswers;
|
session->kbdint->nanswers = nanswers;
|
||||||
|
|
||||||
@@ -1282,7 +1282,7 @@ int ssh_message_channel_request_open_reply_accept_channel(ssh_message msg, ssh_c
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Accepting a channel request_open for chan %d",
|
"Accepting a channel request_open for chan %" PRId32,
|
||||||
chan->remote_channel);
|
chan->remote_channel);
|
||||||
|
|
||||||
rc = ssh_packet_send(session);
|
rc = ssh_packet_send(session);
|
||||||
@@ -1353,7 +1353,7 @@ int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Received a %s channel_request for channel (%d:%d) (want_reply=%hhd)",
|
"Received a %s channel_request for channel (%" PRId32 ":%" PRId32 ") (want_reply=%hhd)",
|
||||||
request, channel->local_channel, channel->remote_channel, want_reply);
|
request, channel->local_channel, channel->remote_channel, want_reply);
|
||||||
|
|
||||||
msg->type = SSH_REQUEST_CHANNEL;
|
msg->type = SSH_REQUEST_CHANNEL;
|
||||||
@@ -1473,7 +1473,7 @@ int ssh_message_channel_request_reply_success(ssh_message msg) {
|
|||||||
channel = msg->channel_request.channel->remote_channel;
|
channel = msg->channel_request.channel->remote_channel;
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Sending a channel_request success to channel %d", channel);
|
"Sending a channel_request success to channel %" PRId32, channel);
|
||||||
|
|
||||||
rc = ssh_buffer_pack(msg->session->out_buffer,
|
rc = ssh_buffer_pack(msg->session->out_buffer,
|
||||||
"bd",
|
"bd",
|
||||||
|
|||||||
14
src/packet.c
14
src/packet.c
@@ -1161,7 +1161,7 @@ size_t ssh_packet_socket_callback(const void *data, size_t receivedlen, void *us
|
|||||||
if (packet_len > MAX_PACKET_LEN) {
|
if (packet_len > MAX_PACKET_LEN) {
|
||||||
ssh_set_error(session,
|
ssh_set_error(session,
|
||||||
SSH_FATAL,
|
SSH_FATAL,
|
||||||
"read_packet(): Packet len too high(%u %.4x)",
|
"read_packet(): Packet len too high(%" PRIu32 " %.4" PRIx32 ")",
|
||||||
packet_len, packet_len);
|
packet_len, packet_len);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@@ -1187,7 +1187,7 @@ size_t ssh_packet_socket_callback(const void *data, size_t receivedlen, void *us
|
|||||||
/* give up, not enough data in buffer */
|
/* give up, not enough data in buffer */
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"packet: partial packet (read len) "
|
"packet: partial packet (read len) "
|
||||||
"[len=%d, receivedlen=%d, to_be_read=%ld]",
|
"[len=%" PRId32 ", receivedlen=%d, to_be_read=%ld]",
|
||||||
packet_len,
|
packet_len,
|
||||||
(int)receivedlen,
|
(int)receivedlen,
|
||||||
to_be_read);
|
to_be_read);
|
||||||
@@ -1286,7 +1286,7 @@ size_t ssh_packet_socket_callback(const void *data, size_t receivedlen, void *us
|
|||||||
if (padding > ssh_buffer_get_len(session->in_buffer)) {
|
if (padding > ssh_buffer_get_len(session->in_buffer)) {
|
||||||
ssh_set_error(session,
|
ssh_set_error(session,
|
||||||
SSH_FATAL,
|
SSH_FATAL,
|
||||||
"Invalid padding: %d (%d left)",
|
"Invalid padding: %d (%" PRId32 " left)",
|
||||||
padding,
|
padding,
|
||||||
ssh_buffer_get_len(session->in_buffer));
|
ssh_buffer_get_len(session->in_buffer));
|
||||||
goto error;
|
goto error;
|
||||||
@@ -1324,7 +1324,7 @@ size_t ssh_packet_socket_callback(const void *data, size_t receivedlen, void *us
|
|||||||
session->packet_state = PACKET_STATE_PROCESSING;
|
session->packet_state = PACKET_STATE_PROCESSING;
|
||||||
ssh_packet_parse_type(session);
|
ssh_packet_parse_type(session);
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"packet: read type %hhd [len=%d,padding=%hhd,comp=%d,payload=%d]",
|
"packet: read type %hhd [len=%" PRId32 ",padding=%hhd,comp=%" PRId32 ",payload=%" PRId32 "]",
|
||||||
session->in_packet.type, packet_len, padding, compsize, payloadsize);
|
session->in_packet.type, packet_len, padding, compsize, payloadsize);
|
||||||
|
|
||||||
/* Check if the packet is expected */
|
/* Check if the packet is expected */
|
||||||
@@ -1548,7 +1548,7 @@ SSH_PACKET_CALLBACK(ssh_packet_unimplemented){
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_RARE,
|
SSH_LOG(SSH_LOG_RARE,
|
||||||
"Received SSH_MSG_UNIMPLEMENTED (sequence number %d)",seq);
|
"Received SSH_MSG_UNIMPLEMENTED (sequence number %" PRId32 ")",seq);
|
||||||
|
|
||||||
return SSH_PACKET_USED;
|
return SSH_PACKET_USED;
|
||||||
}
|
}
|
||||||
@@ -1714,8 +1714,8 @@ static int packet_send2(ssh_session session)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"packet: wrote [type=%u, len=%u, padding_size=%hhd, comp=%u, "
|
"packet: wrote [type=%u, len=%" PRIu32 ", padding_size=%hhd, comp=%" PRIu32 ", "
|
||||||
"payload=%u]",
|
"payload=%" PRIu32 "]",
|
||||||
type,
|
type,
|
||||||
finallen,
|
finallen,
|
||||||
padding_size,
|
padding_size,
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ SSH_PACKET_CALLBACK(ssh_packet_disconnect_callback){
|
|||||||
error = ssh_string_to_char(error_s);
|
error = ssh_string_to_char(error_s);
|
||||||
SSH_STRING_FREE(error_s);
|
SSH_STRING_FREE(error_s);
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT %d:%s",
|
SSH_LOG(SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT %" PRId32 ":%s",
|
||||||
code, error != NULL ? error : "no error");
|
code, error != NULL ? error : "no error");
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
"Received SSH_MSG_DISCONNECT: %d:%s",
|
"Received SSH_MSG_DISCONNECT: %" PRId32 ":%s",
|
||||||
code, error != NULL ? error : "no error");
|
code, error != NULL ? error : "no error");
|
||||||
SAFE_FREE(error);
|
SAFE_FREE(error);
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ SSH_PACKET_CALLBACK(ssh_packet_ext_info)
|
|||||||
return SSH_PACKET_USED;
|
return SSH_PACKET_USED;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET, "Follows %u extensions", nr_extensions);
|
SSH_LOG(SSH_LOG_PACKET, "Follows %" PRIu32 " extensions", nr_extensions);
|
||||||
|
|
||||||
for (i = 0; i < nr_extensions; i++) {
|
for (i = 0; i < nr_extensions; i++) {
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ static int pki_private_key_decrypt(ssh_string blob,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"Decryption: %d key, %d IV, %d rounds, %zu bytes salt",
|
"Decryption: %d key, %d IV, %" PRId32 " rounds, %zu bytes salt",
|
||||||
cipher.keysize/8,
|
cipher.keysize/8,
|
||||||
cipher.blocksize,
|
cipher.blocksize,
|
||||||
rounds,
|
rounds,
|
||||||
@@ -299,12 +299,12 @@ ssh_pki_openssh_import(const char *text_key,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"Opening OpenSSH private key: ciphername: %s, kdf: %s, nkeys: %d",
|
"Opening OpenSSH private key: ciphername: %s, kdf: %s, nkeys: %" PRId32,
|
||||||
ciphername,
|
ciphername,
|
||||||
kdfname,
|
kdfname,
|
||||||
nkeys);
|
nkeys);
|
||||||
if (nkeys != 1) {
|
if (nkeys != 1) {
|
||||||
SSH_LOG(SSH_LOG_TRACE, "Opening OpenSSH private key: only 1 key supported (%d available)", nkeys);
|
SSH_LOG(SSH_LOG_TRACE, "Opening OpenSSH private key: only 1 key supported (%" PRId32 " available)", nkeys);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,7 +478,7 @@ static int pki_private_key_encrypt(ssh_buffer privkey_buffer,
|
|||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_DEBUG, "Encryption: %d key, %d IV, %d rounds, %zu bytes salt",
|
SSH_LOG(SSH_LOG_DEBUG, "Encryption: %d key, %d IV, %" PRId32 " rounds, %zu bytes salt",
|
||||||
cipher.keysize/8,
|
cipher.keysize/8,
|
||||||
cipher.blocksize, rounds, ssh_string_len(salt));
|
cipher.blocksize, rounds, ssh_string_len(salt));
|
||||||
|
|
||||||
|
|||||||
@@ -671,7 +671,7 @@ static int ssh_message_channel_request_reply_default(ssh_message msg) {
|
|||||||
channel = msg->channel_request.channel->remote_channel;
|
channel = msg->channel_request.channel->remote_channel;
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Sending a default channel_request denied to channel %d", channel);
|
"Sending a default channel_request denied to channel %" PRId32, channel);
|
||||||
|
|
||||||
rc = ssh_buffer_pack(msg->session->out_buffer,
|
rc = ssh_buffer_pack(msg->session->out_buffer,
|
||||||
"bd",
|
"bd",
|
||||||
|
|||||||
24
src/sftp.c
24
src/sftp.c
@@ -290,7 +290,7 @@ int sftp_server_init(sftp_session sftp){
|
|||||||
|
|
||||||
ssh_buffer_get_u32(packet->payload, &version);
|
ssh_buffer_get_u32(packet->payload, &version);
|
||||||
version = ntohl(version);
|
version = ntohl(version);
|
||||||
SSH_LOG(SSH_LOG_PACKET, "Client version: %d", version);
|
SSH_LOG(SSH_LOG_PACKET, "Client version: %" PRId32, version);
|
||||||
sftp->client_version = (int)version;
|
sftp->client_version = (int)version;
|
||||||
|
|
||||||
reply = ssh_buffer_new();
|
reply = ssh_buffer_new();
|
||||||
@@ -416,7 +416,7 @@ int sftp_packet_write(sftp_session sftp, uint8_t type, ssh_buffer payload)
|
|||||||
|
|
||||||
if ((uint32_t)size != ssh_buffer_get_len(payload)) {
|
if ((uint32_t)size != ssh_buffer_get_len(payload)) {
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Had to write %d bytes, wrote only %d",
|
"Had to write %" PRId32 " bytes, wrote only %d",
|
||||||
ssh_buffer_get_len(payload),
|
ssh_buffer_get_len(payload),
|
||||||
size);
|
size);
|
||||||
}
|
}
|
||||||
@@ -614,7 +614,7 @@ static sftp_message sftp_get_message(sftp_packet packet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Packet with id %d type %d",
|
"Packet with id %" PRId32 " type %d",
|
||||||
msg->id,
|
msg->id,
|
||||||
msg->packet_type);
|
msg->packet_type);
|
||||||
|
|
||||||
@@ -702,7 +702,7 @@ int sftp_init(sftp_session sftp) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"SFTP server version %d",
|
"SFTP server version %" PRId32,
|
||||||
version);
|
version);
|
||||||
rc = ssh_buffer_unpack(packet->payload, "s", &ext_name);
|
rc = ssh_buffer_unpack(packet->payload, "s", &ext_name);
|
||||||
while (rc == SSH_OK) {
|
while (rc == SSH_OK) {
|
||||||
@@ -849,7 +849,7 @@ static int sftp_enqueue(sftp_session sftp, sftp_message msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Queued msg id %d type %d",
|
"Queued msg id %" PRId32 " type %d",
|
||||||
msg->id, msg->packet_type);
|
msg->id, msg->packet_type);
|
||||||
|
|
||||||
if(sftp->queue == NULL) {
|
if(sftp->queue == NULL) {
|
||||||
@@ -890,7 +890,7 @@ static sftp_message sftp_dequeue(sftp_session sftp, uint32_t id){
|
|||||||
msg = queue->message;
|
msg = queue->message;
|
||||||
request_queue_free(queue);
|
request_queue_free(queue);
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Dequeued msg id %d type %d",
|
"Dequeued msg id %" PRId32 " type %d",
|
||||||
msg->id,
|
msg->id,
|
||||||
msg->packet_type);
|
msg->packet_type);
|
||||||
return msg;
|
return msg;
|
||||||
@@ -1368,7 +1368,7 @@ static sftp_attributes sftp_parse_attr_3(sftp_session sftp, ssh_buffer buf,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_DEBUG,
|
SSH_LOG(SSH_LOG_DEBUG,
|
||||||
"Flags: %.8"PRIx32"\n", (uint32_t) attr->flags);
|
"Flags: %.8" PRIx32 "\n", attr->flags);
|
||||||
|
|
||||||
if (attr->flags & SSH_FILEXFER_ATTR_SIZE) {
|
if (attr->flags & SSH_FILEXFER_ATTR_SIZE) {
|
||||||
rc = ssh_buffer_unpack(buf, "q", &attr->size);
|
rc = ssh_buffer_unpack(buf, "q", &attr->size);
|
||||||
@@ -1581,7 +1581,7 @@ sftp_attributes sftp_readdir(sftp_session sftp, sftp_dir dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET,
|
SSH_LOG(SSH_LOG_PACKET,
|
||||||
"Sent a ssh_fxp_readdir with id %d", id);
|
"Sent a ssh_fxp_readdir with id %" PRId32, id);
|
||||||
|
|
||||||
while (msg == NULL) {
|
while (msg == NULL) {
|
||||||
if (sftp_read_and_dispatch(sftp) < 0) {
|
if (sftp_read_and_dispatch(sftp) < 0) {
|
||||||
@@ -1609,7 +1609,7 @@ sftp_attributes sftp_readdir(sftp_session sftp, sftp_dir dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssh_set_error(sftp->session, SSH_FATAL,
|
ssh_set_error(sftp->session, SSH_FATAL,
|
||||||
"Unknown error status: %d", status->status);
|
"Unknown error status: %" PRId32, status->status);
|
||||||
status_msg_free(status);
|
status_msg_free(status);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1638,7 +1638,7 @@ sftp_attributes sftp_readdir(sftp_session sftp, sftp_dir dir)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_DEBUG, "Count is %d", dir->count);
|
SSH_LOG(SSH_LOG_DEBUG, "Count is %" PRId32, dir->count);
|
||||||
|
|
||||||
attr = sftp_parse_attr(sftp, dir->buffer, 1);
|
attr = sftp_parse_attr(sftp, dir->buffer, 1);
|
||||||
if (attr == NULL) {
|
if (attr == NULL) {
|
||||||
@@ -1824,7 +1824,7 @@ sftp_file sftp_open(sftp_session sftp,
|
|||||||
if ((flags & O_APPEND) == O_APPEND) {
|
if ((flags & O_APPEND) == O_APPEND) {
|
||||||
sftp_flags |= SSH_FXF_APPEND;
|
sftp_flags |= SSH_FXF_APPEND;
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_PACKET,"Opening file %s with sftp flags %x",file,sftp_flags);
|
SSH_LOG(SSH_LOG_PACKET, "Opening file %s with sftp flags %" PRIx32, file, sftp_flags);
|
||||||
id = sftp_get_new_id(sftp);
|
id = sftp_get_new_id(sftp);
|
||||||
|
|
||||||
rc = ssh_buffer_pack(buffer,
|
rc = ssh_buffer_pack(buffer,
|
||||||
@@ -2125,7 +2125,7 @@ int sftp_async_read(sftp_file file, void *data, uint32_t size, uint32_t id){
|
|||||||
if (ssh_string_len(datastring) > size) {
|
if (ssh_string_len(datastring) > size) {
|
||||||
ssh_set_error(sftp->session, SSH_FATAL,
|
ssh_set_error(sftp->session, SSH_FATAL,
|
||||||
"Received a too big DATA packet from sftp server: "
|
"Received a too big DATA packet from sftp server: "
|
||||||
"%zu and asked for %u",
|
"%zu and asked for %" PRIu32,
|
||||||
ssh_string_len(datastring), size);
|
ssh_string_len(datastring), size);
|
||||||
SSH_STRING_FREE(datastring);
|
SSH_STRING_FREE(datastring);
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p,
|
|||||||
if (!ssh_socket_is_open(s)) {
|
if (!ssh_socket_is_open(s)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_TRACE, "Poll callback on socket %d (%s%s%s), out buffer %d",fd,
|
SSH_LOG(SSH_LOG_TRACE, "Poll callback on socket %d (%s%s%s), out buffer %" PRId32, fd,
|
||||||
(revents & POLLIN) ? "POLLIN ":"",
|
(revents & POLLIN) ? "POLLIN ":"",
|
||||||
(revents & POLLOUT) ? "POLLOUT ":"",
|
(revents & POLLOUT) ? "POLLOUT ":"",
|
||||||
(revents & POLLERR) ? "POLLERR":"",
|
(revents & POLLERR) ? "POLLERR":"",
|
||||||
|
|||||||
Reference in New Issue
Block a user