1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

buffers: adapt packet.c to ssh_buffer_(un)pack()

Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Aris Adamantiadis
2014-04-16 20:37:40 +02:00
committed by Andreas Schneider
parent cfd2e4894e
commit e9fd14c7f0

View File

@@ -442,19 +442,19 @@ void ssh_packet_process(ssh_session session, uint8_t type){
* @return SSH_ERROR on error, else SSH_OK * @return SSH_ERROR on error, else SSH_OK
*/ */
int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){ int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){
int r; int rc;
r = buffer_add_u8(session->out_buffer, SSH2_MSG_UNIMPLEMENTED); rc = ssh_buffer_pack(session->out_buffer,
if (r < 0) { "bd",
return SSH_ERROR; SSH2_MSG_UNIMPLEMENTED,
} seqnum);
r = buffer_add_u32(session->out_buffer, htonl(seqnum)); if (rc != SSH_OK) {
if (r < 0) { ssh_set_error_oom(session);
return SSH_ERROR; return SSH_ERROR;
} }
r = packet_send(session); rc = packet_send(session);
return r; return rc;
} }
/** @internal /** @internal
@@ -465,8 +465,7 @@ SSH_PACKET_CALLBACK(ssh_packet_unimplemented){
(void)session; /* unused */ (void)session; /* unused */
(void)type; (void)type;
(void)user; (void)user;
buffer_get_u32(packet,&seq); ssh_buffer_unpack(packet, "d", &seq);
seq=ntohl(seq);
SSH_LOG(SSH_LOG_RARE, SSH_LOG(SSH_LOG_RARE,
"Received SSH_MSG_UNIMPLEMENTED (sequence number %d)",seq); "Received SSH_MSG_UNIMPLEMENTED (sequence number %d)",seq);
return SSH_PACKET_USED; return SSH_PACKET_USED;