aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/agent.c6
-rw-r--r--src/buffer.c2
-rw-r--r--src/channels.c12
-rw-r--r--src/crypt.c2
-rw-r--r--src/dh.c14
-rw-r--r--src/gzip.c6
-rw-r--r--src/keyfiles.c4
-rw-r--r--src/keys.c10
-rw-r--r--src/known_hosts.c12
-rw-r--r--src/messages.c2
-rw-r--r--src/packet.c18
-rw-r--r--src/pcap.c6
-rw-r--r--src/server.c2
-rw-r--r--src/sftp.c12
-rw-r--r--src/sftpserver.c4
15 files changed, 56 insertions, 56 deletions
diff --git a/src/agent.c b/src/agent.c
index 16b38b8c..a457d5e3 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -208,7 +208,7 @@ static int agent_talk(struct ssh_session_struct *session,
uint32_t len = 0;
uint8_t payload[1024] = {0};
- len = ssh_buffer_get_len(request);
+ len = buffer_get_rest_len(request);
ssh_log(session, SSH_LOG_PACKET, "agent_talk - len of request: %u", len);
agent_put_u32(payload, len);
@@ -425,11 +425,11 @@ ssh_string agent_sign_data(struct ssh_session_struct *session,
}
/* Add data */
- dlen = ssh_buffer_get_len(data);
+ dlen = buffer_get_rest_len(data);
if (buffer_add_u32(request, htonl(dlen)) < 0) {
goto error;
}
- if (buffer_add_data(request, ssh_buffer_get_begin(data), dlen) < 0) {
+ if (buffer_add_data(request, buffer_get_rest(data), dlen) < 0) {
goto error;
}
diff --git a/src/buffer.c b/src/buffer.c
index 6f737dac..465f618a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -319,7 +319,7 @@ int buffer_prepend_data(struct ssh_buffer_struct *buffer, const void *data,
*/
int buffer_add_buffer(struct ssh_buffer_struct *buffer,
struct ssh_buffer_struct *source) {
- if (buffer_add_data(buffer, ssh_buffer_get_begin(source), ssh_buffer_get_len(source)) < 0) {
+ if (buffer_add_data(buffer, buffer_get_rest(source), buffer_get_rest_len(source)) < 0) {
return -1;
}
diff --git a/src/channels.c b/src/channels.c
index 9d726fe5..ce94225d 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1317,8 +1317,8 @@ static int channel_request(ssh_channel channel, const char *request,
ssh_string_free(req);
if (buffer != NULL) {
- if (buffer_add_data(session->out_buffer, ssh_buffer_get_begin(buffer),
- ssh_buffer_get_len(buffer)) < 0) {
+ if (buffer_add_data(session->out_buffer, buffer_get_rest(buffer),
+ buffer_get_rest_len(buffer)) < 0) {
goto error;
}
}
@@ -1773,8 +1773,8 @@ static int global_request(ssh_session session, const char *request,
req=NULL;
if (buffer != NULL) {
- if (buffer_add_data(session->out_buffer, ssh_buffer_get_begin(buffer),
- ssh_buffer_get_len(buffer)) < 0) {
+ if (buffer_add_data(session->out_buffer, buffer_get_rest(buffer),
+ buffer_get_rest_len(buffer)) < 0) {
goto error;
}
}
@@ -2409,8 +2409,8 @@ static int channel_protocol_select(ssh_channel *rchans, ssh_channel *wchans,
ssh_handle_packets(chan->session,-1);
}
- if ((chan->stdout_buffer && ssh_buffer_get_len(chan->stdout_buffer) > 0) ||
- (chan->stderr_buffer && ssh_buffer_get_len(chan->stderr_buffer) > 0) ||
+ if ((chan->stdout_buffer && buffer_get_rest_len(chan->stdout_buffer) > 0) ||
+ (chan->stderr_buffer && buffer_get_rest_len(chan->stderr_buffer) > 0) ||
chan->remote_eof) {
rout[j] = chan;
j++;
diff --git a/src/crypt.c b/src/crypt.c
index 1085c4aa..363517e6 100644
--- a/src/crypt.c
+++ b/src/crypt.c
@@ -198,7 +198,7 @@ int packet_hmac_verify(ssh_session session, ssh_buffer buffer,
seq = htonl(session->recv_seq);
hmac_update(ctx, (unsigned char *) &seq, sizeof(uint32_t));
- hmac_update(ctx, ssh_buffer_get_begin(buffer), ssh_buffer_get_len(buffer));
+ hmac_update(ctx, buffer_get_rest(buffer), buffer_get_rest_len(buffer));
hmac_final(ctx, hmacbuf, &len);
#ifdef DEBUG_CRYPTO
diff --git a/src/dh.c b/src/dh.c
index 74d799e6..a4790d55 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -542,21 +542,21 @@ int make_sessionid(ssh_session session) {
goto error;
}
- len = ntohl(ssh_buffer_get_len(client_hash));
+ len = ntohl(buffer_get_rest_len(client_hash));
if (buffer_add_u32(buf,len) < 0) {
goto error;
}
- if (buffer_add_data(buf, ssh_buffer_get_begin(client_hash),
- ssh_buffer_get_len(client_hash)) < 0) {
+ if (buffer_add_data(buf, buffer_get_rest(client_hash),
+ buffer_get_rest_len(client_hash)) < 0) {
goto error;
}
- len = ntohl(ssh_buffer_get_len(server_hash));
+ len = ntohl(buffer_get_rest_len(server_hash));
if (buffer_add_u32(buf, len) < 0) {
goto error;
}
- if (buffer_add_data(buf, ssh_buffer_get_begin(server_hash),
- ssh_buffer_get_len(server_hash)) < 0) {
+ if (buffer_add_data(buf, buffer_get_rest(server_hash),
+ buffer_get_rest_len(server_hash)) < 0) {
goto error;
}
@@ -601,7 +601,7 @@ int make_sessionid(ssh_session session) {
ssh_print_hexa("hash buffer", ssh_buffer_get_begin(buf), ssh_buffer_get_len(buf));
#endif
- sha1_update(ctx, ssh_buffer_get_begin(buf), ssh_buffer_get_len(buf));
+ sha1_update(ctx, buffer_get_rest(buf), buffer_get_rest_len(buf));
sha1_final(session->next_crypto->session_id, ctx);
#ifdef DEBUG_CRYPTO
diff --git a/src/gzip.c b/src/gzip.c
index 08497ca6..c95bf9d8 100644
--- a/src/gzip.c
+++ b/src/gzip.c
@@ -58,8 +58,8 @@ static z_stream *initcompress(ssh_session session, int level) {
static ssh_buffer gzip_compress(ssh_session session,ssh_buffer source,int level){
z_stream *zout = session->current_crypto->compress_out_ctx;
- void *in_ptr = ssh_buffer_get_begin(source);
- unsigned long in_size = ssh_buffer_get_len(source);
+ void *in_ptr = buffer_get_rest(source);
+ unsigned long in_size = buffer_get_rest_len(source);
ssh_buffer dest = NULL;
unsigned char out_buf[BLOCKSIZE] = {0};
unsigned long len;
@@ -113,7 +113,7 @@ int compress_buffer(ssh_session session, ssh_buffer buf) {
return -1;
}
- if (buffer_add_data(buf, ssh_buffer_get_begin(dest), ssh_buffer_get_len(dest)) < 0) {
+ if (buffer_add_data(buf, buffer_get_rest(dest), buffer_get_rest_len(dest)) < 0) {
ssh_buffer_free(dest);
return -1;
}
diff --git a/src/keyfiles.c b/src/keyfiles.c
index 2bb85eb3..854123a9 100644
--- a/src/keyfiles.c
+++ b/src/keyfiles.c
@@ -1072,14 +1072,14 @@ ssh_string publickey_from_file(ssh_session session, const char *filename,
return NULL;
}
- str = ssh_string_new(ssh_buffer_get_len(buffer));
+ str = ssh_string_new(buffer_get_rest_len(buffer));
if (str == NULL) {
ssh_set_error(session, SSH_FATAL, "Not enough space");
ssh_buffer_free(buffer);
return NULL;
}
- ssh_string_fill(str, ssh_buffer_get_begin(buffer), ssh_buffer_get_len(buffer));
+ ssh_string_fill(str, buffer_get_rest(buffer), buffer_get_rest_len(buffer));
ssh_buffer_free(buffer);
if (type) {
diff --git a/src/keys.c b/src/keys.c
index f0ebc155..9f5a49f8 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -707,12 +707,12 @@ ssh_string publickey_to_string(ssh_public_key key) {
break;
}
- ret = ssh_string_new(ssh_buffer_get_len(buf));
+ ret = ssh_string_new(buffer_get_rest_len(buf));
if (ret == NULL) {
goto error;
}
- ssh_string_fill(ret, ssh_buffer_get_begin(buf), ssh_buffer_get_len(buf));
+ ssh_string_fill(ret, buffer_get_rest(buf), buffer_get_rest_len(buf));
error:
ssh_buffer_free(buf);
ssh_string_free(type);
@@ -853,12 +853,12 @@ static ssh_string signature_to_string(SIGNATURE *sign) {
break;
}
- str = ssh_string_new(ssh_buffer_get_len(tmpbuf));
+ str = ssh_string_new(buffer_get_rest_len(tmpbuf));
if (str == NULL) {
ssh_buffer_free(tmpbuf);
return NULL;
}
- ssh_string_fill(str, ssh_buffer_get_begin(tmpbuf), ssh_buffer_get_len(tmpbuf));
+ ssh_string_fill(str, buffer_get_rest(tmpbuf), buffer_get_rest_len(tmpbuf));
ssh_buffer_free(tmpbuf);
return str;
@@ -1260,7 +1260,7 @@ ssh_string ssh_do_sign(ssh_session session, ssh_buffer sigbuf,
sha1_update(ctx, session_str, ssh_string_len(session_str) + 4);
ssh_string_free(session_str);
- sha1_update(ctx, ssh_buffer_get_begin(sigbuf), ssh_buffer_get_len(sigbuf));
+ sha1_update(ctx, buffer_get_rest(sigbuf), buffer_get_rest_len(sigbuf));
sha1_final(hash + 1,ctx);
hash[0] = 0;
diff --git a/src/known_hosts.c b/src/known_hosts.c
index aeb3f36e..60241b7a 100644
--- a/src/known_hosts.c
+++ b/src/known_hosts.c
@@ -266,14 +266,14 @@ static int check_public_key(ssh_session session, char **tokens) {
return -1;
}
- if (ssh_buffer_get_len(pubkey_buffer) != ssh_string_len(pubkey)) {
+ if (buffer_get_rest_len(pubkey_buffer) != ssh_string_len(pubkey)) {
ssh_buffer_free(pubkey_buffer);
return 0;
}
/* now test that they are identical */
- if (memcmp(ssh_buffer_get_begin(pubkey_buffer), pubkey->string,
- ssh_buffer_get_len(pubkey_buffer)) != 0) {
+ if (memcmp(buffer_get_rest(pubkey_buffer), pubkey->string,
+ buffer_get_rest_len(pubkey_buffer)) != 0) {
ssh_buffer_free(pubkey_buffer);
return 0;
}
@@ -346,7 +346,7 @@ static int match_hashed_host(ssh_session session, const char *host,
return 0;
}
- mac = hmac_init(ssh_buffer_get_begin(salt), ssh_buffer_get_len(salt), HMAC_SHA1);
+ mac = hmac_init(buffer_get_rest(salt), buffer_get_rest_len(salt), HMAC_SHA1);
if (mac == NULL) {
ssh_buffer_free(salt);
ssh_buffer_free(hash);
@@ -357,8 +357,8 @@ static int match_hashed_host(ssh_session session, const char *host,
hmac_update(mac, host, strlen(host));
hmac_final(mac, buffer, &size);
- if (size == ssh_buffer_get_len(hash) &&
- memcmp(buffer, ssh_buffer_get_begin(hash), size) == 0) {
+ if (size == buffer_get_rest_len(hash) &&
+ memcmp(buffer, buffer_get_rest(hash), size) == 0) {
match = 1;
} else {
match = 0;
diff --git a/src/messages.c b/src/messages.c
index e1297c2c..6bd8d974 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -323,7 +323,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
if ((digest == NULL || signature == NULL) ||
(digest != NULL && signature != NULL &&
sig_verify(session, public_key, signature,
- ssh_buffer_get_begin(digest), ssh_buffer_get_len(digest)) < 0)) {
+ buffer_get_rest(digest), buffer_get_rest_len(digest)) < 0)) {
ssh_log(session, SSH_LOG_PACKET, "Wrong signature from peer");
ssh_string_free(sign);
diff --git a/src/packet.c b/src/packet.c
index ed645780..db27f79f 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -431,8 +431,8 @@ static int ssh_packet_write(ssh_session session) {
enter_function();
rc=ssh_socket_write(session->socket,
- ssh_buffer_get_begin(session->out_buffer),
- ssh_buffer_get_len(session->out_buffer));
+ buffer_get_rest(session->out_buffer),
+ buffer_get_rest_len(session->out_buffer));
leave_function();
return rc;
}
@@ -440,7 +440,7 @@ static int ssh_packet_write(ssh_session session) {
static int packet_send2(ssh_session session) {
unsigned int blocksize = (session->current_crypto ?
session->current_crypto->out_cipher->blocksize : 8);
- uint32_t currentlen = ssh_buffer_get_len(session->out_buffer);
+ uint32_t currentlen = buffer_get_rest_len(session->out_buffer);
unsigned char *hmac = NULL;
char padstring[32] = {0};
int rc = SSH_ERROR;
@@ -454,11 +454,11 @@ static int packet_send2(ssh_session session) {
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
if (session->current_crypto && session->current_crypto->do_compress_out) {
- ssh_log(session, SSH_LOG_PACKET, "Compressing in_buffer ...");
+ ssh_log(session, SSH_LOG_PACKET, "Compressing out_buffer ...");
if (compress_buffer(session,session->out_buffer) < 0) {
goto error;
}
- currentlen = ssh_buffer_get_len(session->out_buffer);
+ currentlen = buffer_get_rest_len(session->out_buffer);
}
#endif
padding = (blocksize - ((currentlen +5) % blocksize));
@@ -489,12 +489,12 @@ static int packet_send2(ssh_session session) {
#ifdef WITH_PCAP
if(session->pcap_ctx){
ssh_pcap_context_write(session->pcap_ctx,SSH_PCAP_DIR_OUT,
- ssh_buffer_get_begin(session->out_buffer),ssh_buffer_get_len(session->out_buffer)
- ,ssh_buffer_get_len(session->out_buffer));
+ buffer_get_rest(session->out_buffer),buffer_get_rest_len(session->out_buffer)
+ ,buffer_get_rest_len(session->out_buffer));
}
#endif
- hmac = packet_encrypt(session, ssh_buffer_get_begin(session->out_buffer),
- ssh_buffer_get_len(session->out_buffer));
+ hmac = packet_encrypt(session, buffer_get_rest(session->out_buffer),
+ buffer_get_rest_len(session->out_buffer));
if (hmac) {
if (buffer_add_data(session->out_buffer, hmac, 20) < 0) {
goto error;
diff --git a/src/pcap.c b/src/pcap.c
index 56bf3316..fb44e9c5 100644
--- a/src/pcap.c
+++ b/src/pcap.c
@@ -141,8 +141,8 @@ static int ssh_pcap_file_write(ssh_pcap_file pcap, ssh_buffer packet){
uint32_t len;
if(pcap == NULL || pcap->output==NULL)
return SSH_ERROR;
- len=ssh_buffer_get_len(packet);
- err=fwrite(ssh_buffer_get_begin(packet),len,1,pcap->output);
+ len=buffer_get_rest_len(packet);
+ err=fwrite(buffer_get_rest(packet),len,1,pcap->output);
if(err<0)
return SSH_ERROR;
else
@@ -162,7 +162,7 @@ int ssh_pcap_file_write_packet(ssh_pcap_file pcap, ssh_buffer packet, uint32_t o
gettimeofday(&now,NULL);
buffer_add_u32(header,htonl(now.tv_sec));
buffer_add_u32(header,htonl(now.tv_usec));
- buffer_add_u32(header,htonl(ssh_buffer_get_len(packet)));
+ buffer_add_u32(header,htonl(buffer_get_rest_len(packet)));
buffer_add_u32(header,htonl(original_len));
buffer_add_buffer(header,packet);
err=ssh_pcap_file_write(pcap,header);
diff --git a/src/server.c b/src/server.c
index 639b2aa0..ee59cc9a 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1121,7 +1121,7 @@ int ssh_message_global_request_port(ssh_message msg){
return msg->global_request.bind_port;
}
-/** @brief defines the SSH_MESSAGE callback
+/** @brief defines the ssh_message callback
* @param session the current ssh session
* @param[in] ssh_bind_message_callback a function pointer to a callback taking the
* current ssh session and received message as parameters. the function returns
diff --git a/src/sftp.c b/src/sftp.c
index 8ea7e837..a2b22f81 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -267,20 +267,20 @@ int sftp_packet_write(sftp_session sftp, uint8_t type, ssh_buffer payload){
return -1;
}
- size = htonl(ssh_buffer_get_len(payload));
+ size = htonl(buffer_get_rest_len(payload));
if (buffer_prepend_data(payload, &size, sizeof(uint32_t)) < 0) {
ssh_set_error_oom(sftp->session);
return -1;
}
- size = ssh_channel_write(sftp->channel, ssh_buffer_get_begin(payload),
- ssh_buffer_get_len(payload));
+ size = ssh_channel_write(sftp->channel, buffer_get_rest(payload),
+ buffer_get_rest_len(payload));
if (size < 0) {
return -1;
- } else if((uint32_t) size != ssh_buffer_get_len(payload)) {
+ } else if((uint32_t) size != buffer_get_rest_len(payload)) {
ssh_log(sftp->session, SSH_LOG_PACKET,
"Had to write %d bytes, wrote only %d",
- ssh_buffer_get_len(payload),
+ buffer_get_rest_len(payload),
size);
}
@@ -1998,8 +1998,8 @@ ssize_t sftp_write(sftp_file file, const void *buf, size_t count) {
return -1;
}
ssh_string_free(datastring);
+ packetlen=buffer_get_rest_len(buffer);
len = sftp_packet_write(file->sftp, SSH_FXP_WRITE, buffer);
- packetlen=ssh_buffer_get_len(buffer);
ssh_buffer_free(buffer);
if (len < 0) {
return -1;
diff --git a/src/sftpserver.c b/src/sftpserver.c
index 77f64198..ac52ebed 100644
--- a/src/sftpserver.c
+++ b/src/sftpserver.c
@@ -346,8 +346,8 @@ int sftp_reply_names(sftp_client_message msg) {
if (buffer_add_u32(out, msg->id) < 0 ||
buffer_add_u32(out, htonl(msg->attr_num)) < 0 ||
- buffer_add_data(out, ssh_buffer_get_begin(msg->attrbuf),
- ssh_buffer_get_len(msg->attrbuf)) < 0 ||
+ buffer_add_data(out, buffer_get_rest(msg->attrbuf),
+ buffer_get_rest_len(msg->attrbuf)) < 0 ||
sftp_packet_write(msg->sftp, SSH_FXP_NAME, out) < 0) {
ssh_buffer_free(out);
ssh_buffer_free(msg->attrbuf);