diff --git a/src/agent.c b/src/agent.c index 5c1634ee..6ca2d75a 100644 --- a/src/agent.c +++ b/src/agent.c @@ -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); if (rc != sizeof(uint8_t)) { ssh_set_error(session, SSH_FATAL, - "Bad authentication reply size: %" PRId32, rc); + "Bad authentication reply size: %" PRIu32, rc); SSH_BUFFER_FREE(reply); return 0; } diff --git a/src/auth.c b/src/auth.c index eedf583e..b55308ac 100644 --- a/src/auth.c +++ b/src/auth.c @@ -1769,7 +1769,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request) { } SSH_LOG(SSH_LOG_DEBUG, - "%" PRId32 " keyboard-interactive prompts", nprompts); + "%" PRIu32 " keyboard-interactive prompts", nprompts); if (nprompts > KBDINT_MAX_PROMPT) { ssh_set_error(session, SSH_FATAL, "Too much prompts requested by the server: %" PRIu32 " (0x%.4" PRIx32 ")", diff --git a/src/channels.c b/src/channels.c index 9631b4a8..de148f13 100644 --- a/src/channels.c +++ b/src/channels.c @@ -193,7 +193,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf){ goto error; SSH_LOG(SSH_LOG_DEBUG, - "Received a CHANNEL_OPEN_CONFIRMATION for channel %" PRId32 ":%" PRId32, + "Received a CHANNEL_OPEN_CONFIRMATION for channel %" PRIu32 ":%" PRIu32, channel->local_channel, channel->remote_channel); @@ -328,7 +328,7 @@ channel_open(ssh_channel channel, channel->local_window = window; SSH_LOG(SSH_LOG_DEBUG, - "Creating a channel %" PRId32 " with %" PRId32 " window and %" PRId32 " max packet", + "Creating a channel %" PRIu32 " with %" PRIu32 " window and %" PRIu32 " max packet", channel->local_channel, window, maxpacket); rc = ssh_buffer_pack(session->out_buffer, @@ -356,7 +356,7 @@ channel_open(ssh_channel channel, } SSH_LOG(SSH_LOG_PACKET, - "Sent a SSH_MSG_CHANNEL_OPEN type %s for channel %" PRId32, + "Sent a SSH_MSG_CHANNEL_OPEN type %s for channel %" PRIu32, type, channel->local_channel); pending: @@ -418,7 +418,7 @@ static int grow_window(ssh_session session, if (new_window <= channel->local_window) { SSH_LOG(SSH_LOG_DEBUG, - "growing window (channel %" PRId32 ":%" PRId32 ") to %" PRId32 " bytes : not needed (%" PRId32 " bytes)", + "growing window (channel %" PRIu32 ":%" PRIu32 ") to %" PRIu32 " bytes : not needed (%" PRIu32 " bytes)", channel->local_channel, channel->remote_channel, new_window, channel->local_window); @@ -442,7 +442,7 @@ static int grow_window(ssh_session session, } SSH_LOG(SSH_LOG_DEBUG, - "growing window (channel %" PRId32 ":%" PRId32 ") to %" PRId32 " bytes", + "growing window (channel %" PRIu32 ":%" PRIu32 ") to %" PRIu32 " bytes", channel->local_channel, channel->remote_channel, new_window); @@ -513,7 +513,7 @@ SSH_PACKET_CALLBACK(channel_rcv_change_window) { } SSH_LOG(SSH_LOG_DEBUG, - "Adding %" PRId32 " bytes to channel (%" PRId32 ":%" PRId32 ") (from %" PRId32 " bytes)", + "Adding %" PRIu32 " bytes to channel (%" PRIu32 ":%" PRIu32 ") (from %" PRIu32 " bytes)", bytes, channel->local_channel, channel->remote_channel, @@ -562,7 +562,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){ len = ssh_string_len(str); SSH_LOG(SSH_LOG_PACKET, - "Channel receiving %" PRIu32 " bytes data in %d (local win=%" PRId32 " remote win=%" PRId32 ")", + "Channel receiving %" PRIu32 " bytes data in %d (local win=%" PRIu32 " remote win=%" PRIu32 ")", len, is_stderr, 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 */ if (len > channel->local_window) { SSH_LOG(SSH_LOG_RARE, - "Data packet too big for our window(%" PRIu32 " vs %" PRId32 ")", + "Data packet too big for our window(%" PRIu32 " vs %" PRIu32 ")", len, channel->local_window); } @@ -590,7 +590,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){ } SSH_LOG(SSH_LOG_PACKET, - "Channel windows are now (local win=%" PRId32 " remote win=%" PRId32 ")", + "Channel windows are now (local win=%" PRIu32 " remote win=%" PRIu32 ")", channel->local_window, channel->remote_window); @@ -644,7 +644,7 @@ SSH_PACKET_CALLBACK(channel_rcv_eof) { } SSH_LOG(SSH_LOG_PACKET, - "Received eof on channel (%" PRId32 ":%" PRId32 ")", + "Received eof on channel (%" PRIu32 ":%" PRIu32 ")", channel->local_channel, channel->remote_channel); /* channel->remote_window = 0; */ @@ -689,7 +689,7 @@ SSH_PACKET_CALLBACK(channel_rcv_close) { } SSH_LOG(SSH_LOG_PACKET, - "Received close on channel (%" PRId32 ":%" PRId32 ")", + "Received close on channel (%" PRIu32 ":%" PRIu32 ")", channel->local_channel, channel->remote_channel); @@ -1306,7 +1306,7 @@ int ssh_channel_send_eof(ssh_channel channel) rc = ssh_packet_send(session); SSH_LOG(SSH_LOG_PACKET, - "Sent a EOF on client channel (%" PRId32 ":%" PRId32 ")", + "Sent a EOF on client channel (%" PRIu32 ":%" PRIu32 ")", channel->local_channel, channel->remote_channel); if (rc != SSH_OK) { @@ -1371,7 +1371,7 @@ int ssh_channel_close(ssh_channel channel) rc = ssh_packet_send(session); SSH_LOG(SSH_LOG_PACKET, - "Sent a close on client channel (%" PRId32 ":%" PRId32 ")", + "Sent a close on client channel (%" PRIu32 ":%" PRIu32 ")", channel->local_channel, channel->remote_channel); @@ -1466,7 +1466,7 @@ static int channel_write_common(ssh_channel channel, if (channel->local_eof) { ssh_set_error(session, SSH_REQUEST_DENIED, - "Can't write to channel %" PRId32 ":%" PRId32 " after EOF was sent", + "Can't write to channel %" PRIu32 ":%" PRIu32 " after EOF was sent", channel->local_channel, channel->remote_channel); return -1; @@ -1491,7 +1491,7 @@ static int channel_write_common(ssh_channel channel, while (len > 0) { if (channel->remote_window < len) { SSH_LOG(SSH_LOG_DEBUG, - "Remote window is %" PRId32 " bytes. going to write %" PRId32 " bytes", + "Remote window is %" PRIu32 " bytes. going to write %" PRIu32 " bytes", channel->remote_window, len); /* What happens when the channel window is zero? */ @@ -1705,7 +1705,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_success){ } SSH_LOG(SSH_LOG_PACKET, - "Received SSH_CHANNEL_SUCCESS on channel (%" PRId32 ":%" PRId32 ")", + "Received SSH_CHANNEL_SUCCESS on channel (%" PRIu32 ":%" PRIu32 ")", channel->local_channel, channel->remote_channel); 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, - "Received SSH_CHANNEL_FAILURE on channel (%" PRId32 ":%" PRId32 ")", + "Received SSH_CHANNEL_FAILURE on channel (%" PRIu32 ":%" PRIu32 ")", channel->local_channel, channel->remote_channel); if(channel->request_state != SSH_CHANNEL_REQ_STATE_PENDING){ @@ -3007,7 +3007,7 @@ int ssh_channel_read_timeout(ssh_channel channel, * as asked */ SSH_LOG(SSH_LOG_PACKET, - "Read (%" PRId32 ") buffered : %" PRId32 " bytes. Window: %" PRId32, + "Read (%" PRIu32 ") buffered : %" PRIu32 " bytes. Window: %" PRIu32, count, ssh_buffer_get_len(stdbuf), channel->local_window); diff --git a/src/messages.c b/src/messages.c index 052f60f5..289dd6c2 100644 --- a/src/messages.c +++ b/src/messages.c @@ -1076,7 +1076,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){ session->kbdint->nanswers = 0; } - SSH_LOG(SSH_LOG_PACKET,"kbdint: %" PRId32 " answers",nanswers); + SSH_LOG(SSH_LOG_PACKET,"kbdint: %" PRIu32 " answers", nanswers); if (nanswers > KBDINT_MAX_PROMPT) { ssh_set_error(session, SSH_FATAL, "Too much answers received from client: %" PRIu32 " (0x%.4" PRIx32 ")", @@ -1282,7 +1282,7 @@ int ssh_message_channel_request_open_reply_accept_channel(ssh_message msg, ssh_c } SSH_LOG(SSH_LOG_PACKET, - "Accepting a channel request_open for chan %" PRId32, + "Accepting a channel request_open for chan %" PRIu32, chan->remote_channel); 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, - "Received a %s channel_request for channel (%" PRId32 ":%" PRId32 ") (want_reply=%hhd)", + "Received a %s channel_request for channel (%" PRIu32 ":%" PRIu32 ") (want_reply=%hhd)", request, channel->local_channel, channel->remote_channel, want_reply); 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; SSH_LOG(SSH_LOG_PACKET, - "Sending a channel_request success to channel %" PRId32, channel); + "Sending a channel_request success to channel %" PRIu32, channel); rc = ssh_buffer_pack(msg->session->out_buffer, "bd", diff --git a/src/packet.c b/src/packet.c index 7a0ba780..d47d943d 100644 --- a/src/packet.c +++ b/src/packet.c @@ -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 */ SSH_LOG(SSH_LOG_PACKET, "packet: partial packet (read len) " - "[len=%" PRId32 ", receivedlen=%d, to_be_read=%ld]", + "[len=%" PRIu32 ", receivedlen=%d, to_be_read=%ld]", packet_len, (int)receivedlen, 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)) { ssh_set_error(session, SSH_FATAL, - "Invalid padding: %d (%" PRId32 " left)", + "Invalid padding: %d (%" PRIu32 " left)", padding, ssh_buffer_get_len(session->in_buffer)); 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; ssh_packet_parse_type(session); SSH_LOG(SSH_LOG_PACKET, - "packet: read type %hhd [len=%" PRId32 ",padding=%hhd,comp=%" PRId32 ",payload=%" PRId32 "]", + "packet: read type %hhd [len=%" PRIu32 ",padding=%hhd,comp=%" PRIu32 ",payload=%" PRIu32 "]", session->in_packet.type, packet_len, padding, compsize, payloadsize); /* Check if the packet is expected */ @@ -1548,7 +1548,7 @@ SSH_PACKET_CALLBACK(ssh_packet_unimplemented){ } SSH_LOG(SSH_LOG_RARE, - "Received SSH_MSG_UNIMPLEMENTED (sequence number %" PRId32 ")",seq); + "Received SSH_MSG_UNIMPLEMENTED (sequence number %" PRIu32 ")",seq); return SSH_PACKET_USED; } diff --git a/src/packet_cb.c b/src/packet_cb.c index ddf93020..812db758 100644 --- a/src/packet_cb.c +++ b/src/packet_cb.c @@ -63,10 +63,10 @@ SSH_PACKET_CALLBACK(ssh_packet_disconnect_callback){ error = ssh_string_to_char(error_s); SSH_STRING_FREE(error_s); } - SSH_LOG(SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT %" PRId32 ":%s", + SSH_LOG(SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT %" PRIu32 ":%s", code, error != NULL ? error : "no error"); ssh_set_error(session, SSH_FATAL, - "Received SSH_MSG_DISCONNECT: %" PRId32 ":%s", + "Received SSH_MSG_DISCONNECT: %" PRIu32 ":%s", code, error != NULL ? error : "no error"); SAFE_FREE(error); diff --git a/src/pki_container_openssh.c b/src/pki_container_openssh.c index fa9d3db2..8eae592d 100644 --- a/src/pki_container_openssh.c +++ b/src/pki_container_openssh.c @@ -172,7 +172,7 @@ static int pki_private_key_decrypt(ssh_string blob, } SSH_LOG(SSH_LOG_DEBUG, - "Decryption: %d key, %d IV, %" PRId32 " rounds, %zu bytes salt", + "Decryption: %d key, %d IV, %" PRIu32 " rounds, %zu bytes salt", cipher.keysize/8, cipher.blocksize, rounds, @@ -299,12 +299,12 @@ ssh_pki_openssh_import(const char *text_key, goto out; } SSH_LOG(SSH_LOG_DEBUG, - "Opening OpenSSH private key: ciphername: %s, kdf: %s, nkeys: %" PRId32, + "Opening OpenSSH private key: ciphername: %s, kdf: %s, nkeys: %" PRIu32, ciphername, kdfname, nkeys); if (nkeys != 1) { - SSH_LOG(SSH_LOG_TRACE, "Opening OpenSSH private key: only 1 key supported (%" PRId32 " available)", nkeys); + SSH_LOG(SSH_LOG_TRACE, "Opening OpenSSH private key: only 1 key supported (%" PRIu32 " available)", nkeys); goto out; } @@ -478,7 +478,7 @@ static int pki_private_key_encrypt(ssh_buffer privkey_buffer, return SSH_ERROR; } - SSH_LOG(SSH_LOG_DEBUG, "Encryption: %d key, %d IV, %" PRId32 " rounds, %zu bytes salt", + SSH_LOG(SSH_LOG_DEBUG, "Encryption: %d key, %d IV, %" PRIu32 " rounds, %zu bytes salt", cipher.keysize/8, cipher.blocksize, rounds, ssh_string_len(salt)); diff --git a/src/server.c b/src/server.c index 40f61745..0e04b9ed 100644 --- a/src/server.c +++ b/src/server.c @@ -671,7 +671,7 @@ static int ssh_message_channel_request_reply_default(ssh_message msg) { channel = msg->channel_request.channel->remote_channel; SSH_LOG(SSH_LOG_PACKET, - "Sending a default channel_request denied to channel %" PRId32, channel); + "Sending a default channel_request denied to channel %" PRIu32, channel); rc = ssh_buffer_pack(msg->session->out_buffer, "bd", diff --git a/src/sftp.c b/src/sftp.c index 0279913d..49f36751 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -290,7 +290,7 @@ int sftp_server_init(sftp_session sftp){ ssh_buffer_get_u32(packet->payload, &version); version = ntohl(version); - SSH_LOG(SSH_LOG_PACKET, "Client version: %" PRId32, version); + SSH_LOG(SSH_LOG_PACKET, "Client version: %" PRIu32, version); sftp->client_version = (int)version; 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)) { SSH_LOG(SSH_LOG_PACKET, - "Had to write %" PRId32 " bytes, wrote only %d", + "Had to write %" PRIu32 " bytes, wrote only %d", ssh_buffer_get_len(payload), size); } @@ -614,7 +614,7 @@ static sftp_message sftp_get_message(sftp_packet packet) } SSH_LOG(SSH_LOG_PACKET, - "Packet with id %" PRId32 " type %d", + "Packet with id %" PRIu32 " type %d", msg->id, msg->packet_type); @@ -702,7 +702,7 @@ int sftp_init(sftp_session sftp) { return -1; } SSH_LOG(SSH_LOG_DEBUG, - "SFTP server version %" PRId32, + "SFTP server version %" PRIu32, version); rc = ssh_buffer_unpack(packet->payload, "s", &ext_name); while (rc == SSH_OK) { @@ -849,7 +849,7 @@ static int sftp_enqueue(sftp_session sftp, sftp_message msg) { } SSH_LOG(SSH_LOG_PACKET, - "Queued msg id %" PRId32 " type %d", + "Queued msg id %" PRIu32 " type %d", msg->id, msg->packet_type); if(sftp->queue == NULL) { @@ -890,7 +890,7 @@ static sftp_message sftp_dequeue(sftp_session sftp, uint32_t id){ msg = queue->message; request_queue_free(queue); SSH_LOG(SSH_LOG_PACKET, - "Dequeued msg id %" PRId32 " type %d", + "Dequeued msg id %" PRIu32 " type %d", msg->id, msg->packet_type); return msg; @@ -1581,7 +1581,7 @@ sftp_attributes sftp_readdir(sftp_session sftp, sftp_dir dir) } SSH_LOG(SSH_LOG_PACKET, - "Sent a ssh_fxp_readdir with id %" PRId32, id); + "Sent a ssh_fxp_readdir with id %" PRIu32, id); while (msg == NULL) { 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, - "Unknown error status: %" PRId32, status->status); + "Unknown error status: %" PRIu32, status->status); status_msg_free(status); return NULL; @@ -1638,7 +1638,7 @@ sftp_attributes sftp_readdir(sftp_session sftp, sftp_dir dir) return NULL; } - SSH_LOG(SSH_LOG_DEBUG, "Count is %" PRId32, dir->count); + SSH_LOG(SSH_LOG_DEBUG, "Count is %" PRIu32, dir->count); attr = sftp_parse_attr(sftp, dir->buffer, 1); if (attr == NULL) { diff --git a/src/socket.c b/src/socket.c index e5c03dcc..b8bc89b0 100644 --- a/src/socket.c +++ b/src/socket.c @@ -252,7 +252,7 @@ int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, if (!ssh_socket_is_open(s)) { return -1; } - SSH_LOG(SSH_LOG_TRACE, "Poll callback on socket %d (%s%s%s), out buffer %" PRId32, fd, + SSH_LOG(SSH_LOG_TRACE, "Poll callback on socket %d (%s%s%s), out buffer %" PRIu32, fd, (revents & POLLIN) ? "POLLIN ":"", (revents & POLLOUT) ? "POLLOUT ":"", (revents & POLLERR) ? "POLLERR":"",