[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 14/24] buffer: rename ssh_buffer_get_rest() to ssh_buffer_get()


Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 include/libssh/buffer.h          |  2 +-
 src/agent.c                      |  4 ++--
 src/buffer.c                     |  9 ++++-----
 src/channels.c                   |  8 ++++----
 src/dh.c                         |  8 ++++----
 src/gzip.c                       |  8 ++++----
 src/known_hosts.c                |  6 +++---
 src/messages.c                   |  2 +-
 src/packet.c                     |  8 ++++----
 src/packet1.c                    |  8 ++++----
 src/packet_crypt.c               |  2 +-
 src/pcap.c                       |  2 +-
 src/pki.c                        |  8 ++++----
 src/pki_crypto.c                 |  4 ++--
 src/pki_gcrypt.c                 |  2 +-
 src/sftp.c                       |  4 ++--
 src/sftpserver.c                 |  4 ++--
 src/socket.c                     |  4 ++--
 tests/unittests/torture_buffer.c | 12 ++++++------
 19 files changed, 52 insertions(+), 53 deletions(-)

diff --git a/include/libssh/buffer.h b/include/libssh/buffer.h
index 3ff794a..15294b2 100644
--- a/include/libssh/buffer.h
+++ b/include/libssh/buffer.h
@@ -79,7 +79,7 @@ int ssh_buffer_add_buffer(ssh_buffer buffer, ssh_buffer source);
 int ssh_buffer_reinit(ssh_buffer buffer);
 
 /* ssh_buffer_get_rest returns a pointer to the current position into the buffer */
-void *ssh_buffer_get_rest(ssh_buffer buffer);
+void *ssh_buffer_get(ssh_buffer buffer);
 /* ssh_buffer_get_rest_len returns the number of bytes which can be read */
 uint32_t ssh_buffer_get_rest_len(ssh_buffer buffer);
 
diff --git a/src/agent.c b/src/agent.c
index b63cdfb..edd4cd3 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -279,7 +279,7 @@ static int agent_talk(struct ssh_session_struct *session,
 
   /* send length and then the request packet */
   if (atomicio(session->agent, payload, 4, 0) == 4) {
-    if (atomicio(session->agent, ssh_buffer_get_rest(request), len, 0)
+    if (atomicio(session->agent, ssh_buffer_get(request), len, 0)
         != len) {
       SSH_LOG(SSH_LOG_WARN, "atomicio sending request failed: %s",
           strerror(errno));
@@ -546,7 +546,7 @@ ssh_string ssh_agent_sign_data(ssh_session session,
         ssh_buffer_free(request);
         return NULL;
     }
-    if (ssh_buffer_add_data(request, ssh_buffer_get_rest(data), dlen) < 0) {
+    if (ssh_buffer_add_data(request, ssh_buffer_get(data), dlen) < 0) {
         ssh_buffer_free(request);
         return NULL;
     }
diff --git a/src/buffer.c b/src/buffer.c
index a281024..8765989 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -425,7 +425,7 @@ int ssh_buffer_add_buffer(struct ssh_buffer_struct *buffer,
     int rc;
 
     rc = ssh_buffer_add_data(buffer,
-                             ssh_buffer_get_rest(source),
+                             ssh_buffer_get(source),
                              ssh_buffer_get_rest_len(source));
     if (rc < 0) {
         return -1;
@@ -444,7 +444,7 @@ int ssh_buffer_add_buffer(struct ssh_buffer_struct *buffer,
  *
  * @warning Don't expect data to be nul-terminated.
  *
- * @see ssh_buffer_get_rest()
+ * @see ssh_buffer_get()
  * @see ssh_buffer_get_len()
  */
 void *ssh_buffer_get_begin(struct ssh_buffer_struct *buffer){
@@ -461,9 +461,8 @@ void *ssh_buffer_get_begin(struct ssh_buffer_struct *buffer){
  * @return              A pointer to the data from current position.
  *
  * @see ssh_buffer_get_rest_len()
- * @see ssh_buffer_get()
  */
-void *ssh_buffer_get_rest(struct ssh_buffer_struct *buffer){
+void *ssh_buffer_get(struct ssh_buffer_struct *buffer){
     return buffer->data + buffer->pos;
 }
 
@@ -489,7 +488,7 @@ uint32_t ssh_buffer_get_len(struct ssh_buffer_struct *buffer){
  *
  * @return              The length of the buffer.
  *
- * @see ssh_buffer_get_rest()
+ * @see ssh_buffer_get()
  */
 uint32_t ssh_buffer_get_rest_len(struct ssh_buffer_struct *buffer){
   buffer_verify(buffer);
diff --git a/src/channels.c b/src/channels.c
index c04f1fd..5cfc6ed 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -546,7 +546,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){
       }
       rest = channel->callbacks->channel_data_function(channel->session,
                                                 channel,
-                                                ssh_buffer_get_rest(buf),
+                                                ssh_buffer_get(buf),
                                                 ssh_buffer_get_rest_len(buf),
                                                 is_stderr,
                                                 channel->callbacks->userdata);
@@ -1540,7 +1540,7 @@ static int channel_request(ssh_channel channel, const char *request,
   }
 
   if (buffer != NULL) {
-    if (ssh_buffer_add_data(session->out_buffer, ssh_buffer_get_rest(buffer),
+    if (ssh_buffer_add_data(session->out_buffer, ssh_buffer_get(buffer),
         ssh_buffer_get_rest_len(buffer)) < 0) {
       ssh_set_error_oom(session);
       goto error;
@@ -2099,7 +2099,7 @@ static int global_request(ssh_session session, const char *request,
 
   if (buffer != NULL) {
       rc = ssh_buffer_add_data(session->out_buffer,
-                           ssh_buffer_get_rest(buffer),
+                           ssh_buffer_get(buffer),
                            ssh_buffer_get_rest_len(buffer));
       if (rc < 0) {
           ssh_set_error_oom(session);
@@ -2717,7 +2717,7 @@ int ssh_channel_read_timeout(ssh_channel channel,
   len = ssh_buffer_get_rest_len(stdbuf);
   /* Read count bytes if len is greater, everything otherwise */
   len = (len > count ? count : len);
-  memcpy(dest, ssh_buffer_get_rest(stdbuf), len);
+  memcpy(dest, ssh_buffer_get(stdbuf), len);
   ssh_buffer_pass_bytes(stdbuf,len);
   if (channel->counter != NULL) {
       channel->counter->in_bytes += len;
diff --git a/src/dh.c b/src/dh.c
index 549f7df..d47c3dc 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -575,10 +575,10 @@ int ssh_make_sessionid(ssh_session session) {
                          "dPdPS",
                          ssh_buffer_get_rest_len(client_hash),
                          ssh_buffer_get_rest_len(client_hash),
-                         ssh_buffer_get_rest(client_hash),
+                         ssh_buffer_get(client_hash),
                          ssh_buffer_get_rest_len(server_hash),
                          ssh_buffer_get_rest_len(server_hash),
-                         ssh_buffer_get_rest(server_hash),
+                         ssh_buffer_get(server_hash),
                          session->next_crypto->server_pubkey);
 
     if(rc != SSH_OK){
@@ -643,7 +643,7 @@ int ssh_make_sessionid(ssh_session session) {
             ssh_set_error_oom(session);
             goto error;
         }
-        sha1(ssh_buffer_get_rest(buf), ssh_buffer_get_rest_len(buf),
+        sha1(ssh_buffer_get(buf), ssh_buffer_get_rest_len(buf),
                                    session->next_crypto->secret_hash);
         break;
     case SSH_KEX_ECDH_SHA2_NISTP256:
@@ -655,7 +655,7 @@ int ssh_make_sessionid(ssh_session session) {
             ssh_set_error_oom(session);
             goto error;
         }
-        sha256(ssh_buffer_get_rest(buf), ssh_buffer_get_rest_len(buf),
+        sha256(ssh_buffer_get(buf), ssh_buffer_get_rest_len(buf),
                                      session->next_crypto->secret_hash);
         break;
     }
diff --git a/src/gzip.c b/src/gzip.c
index 0a14084..c1b54db 100644
--- a/src/gzip.c
+++ b/src/gzip.c
@@ -58,7 +58,7 @@ 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_rest(source);
+  void *in_ptr = ssh_buffer_get(source);
   unsigned long in_size = ssh_buffer_get_rest_len(source);
   ssh_buffer dest = NULL;
   unsigned char out_buf[BLOCKSIZE] = {0};
@@ -113,7 +113,7 @@ int compress_buffer(ssh_session session, ssh_buffer buf) {
     return -1;
   }
 
-  if (ssh_buffer_add_data(buf, ssh_buffer_get_rest(dest), ssh_buffer_get_rest_len(dest)) < 0) {
+  if (ssh_buffer_add_data(buf, ssh_buffer_get(dest), ssh_buffer_get_rest_len(dest)) < 0) {
     ssh_buffer_free(dest);
     return -1;
   }
@@ -147,7 +147,7 @@ static z_stream *initdecompress(ssh_session session) {
 
 static ssh_buffer gzip_decompress(ssh_session session, ssh_buffer source, size_t maxlen) {
   z_stream *zin = session->current_crypto->compress_in_ctx;
-  void *in_ptr = ssh_buffer_get_rest(source);
+  void *in_ptr = ssh_buffer_get(source);
   unsigned long in_size = ssh_buffer_get_rest_len(source);
   unsigned char out_buf[BLOCKSIZE] = {0};
   ssh_buffer dest = NULL;
@@ -209,7 +209,7 @@ int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen){
     return -1;
   }
 
-  if (ssh_buffer_add_data(buf, ssh_buffer_get_rest(dest), ssh_buffer_get_rest_len(dest)) < 0) {
+  if (ssh_buffer_add_data(buf, ssh_buffer_get(dest), ssh_buffer_get_rest_len(dest)) < 0) {
     ssh_buffer_free(dest);
     return -1;
   }
diff --git a/src/known_hosts.c b/src/known_hosts.c
index 32f795a..b4ad8e4 100644
--- a/src/known_hosts.c
+++ b/src/known_hosts.c
@@ -270,7 +270,7 @@ static int check_public_key(ssh_session session, char **tokens) {
   }
 
   /* now test that they are identical */
-  if (memcmp(ssh_buffer_get_rest(pubkey_buffer), ssh_string_data(pubkey),
+  if (memcmp(ssh_buffer_get(pubkey_buffer), ssh_string_data(pubkey),
         ssh_buffer_get_rest_len(pubkey_buffer)) != 0) {
     ssh_buffer_free(pubkey_buffer);
     return 0;
@@ -340,7 +340,7 @@ static int match_hashed_host(const char *host, const char *sourcehash)
     return 0;
   }
 
-  mac = hmac_init(ssh_buffer_get_rest(salt), ssh_buffer_get_rest_len(salt), SSH_HMAC_SHA1);
+  mac = hmac_init(ssh_buffer_get(salt), ssh_buffer_get_rest_len(salt), SSH_HMAC_SHA1);
   if (mac == NULL) {
     ssh_buffer_free(salt);
     ssh_buffer_free(hash);
@@ -352,7 +352,7 @@ static int match_hashed_host(const char *host, const char *sourcehash)
   hmac_final(mac, buffer, &size);
 
   if (size == ssh_buffer_get_rest_len(hash) &&
-      memcmp(buffer, ssh_buffer_get_rest(hash), size) == 0) {
+      memcmp(buffer, ssh_buffer_get(hash), size) == 0) {
     match = 1;
   } else {
     match = 0;
diff --git a/src/messages.c b/src/messages.c
index 4149e28..eada232 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -786,7 +786,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
         rc = ssh_pki_signature_verify_blob(session,
                                            sig_blob,
                                            msg->auth_request.pubkey,
-                                           ssh_buffer_get_rest(digest),
+                                           ssh_buffer_get(digest),
                                            ssh_buffer_get_rest_len(digest));
         ssh_string_free(sig_blob);
         ssh_buffer_free(digest);
diff --git a/src/packet.c b/src/packet.c
index f10467b..17f5068 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -257,7 +257,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
 
                 /* The following check avoids decrypting zero bytes */
                 if (buffer_len > blocksize) {
-                    uint8_t *payload = ((uint8_t*)ssh_buffer_get_rest(session->in_buffer) + blocksize);
+                    uint8_t *payload = ((uint8_t*)ssh_buffer_get(session->in_buffer) + blocksize);
                     uint32_t plen = buffer_len - blocksize;
 
                     rc = ssh_packet_decrypt(session, payload, plen);
@@ -507,7 +507,7 @@ static int ssh_packet_write(ssh_session session) {
   int rc = SSH_ERROR;
 
   rc=ssh_socket_write(session->socket,
-      ssh_buffer_get_rest(session->out_buffer),
+      ssh_buffer_get(session->out_buffer),
       ssh_buffer_get_rest_len(session->out_buffer));
 
   return rc;
@@ -563,11 +563,11 @@ 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_rest(session->out_buffer),ssh_buffer_get_rest_len(session->out_buffer)
+  			ssh_buffer_get(session->out_buffer),ssh_buffer_get_rest_len(session->out_buffer)
   			,ssh_buffer_get_rest_len(session->out_buffer));
   }
 #endif
-  hmac = ssh_packet_encrypt(session, ssh_buffer_get_rest(session->out_buffer),
+  hmac = ssh_packet_encrypt(session, ssh_buffer_get(session->out_buffer),
       ssh_buffer_get_rest_len(session->out_buffer));
   if (hmac) {
     rc = ssh_buffer_add_data(session->out_buffer, hmac, hmac_digest_len(hmac_type));
diff --git a/src/packet1.c b/src/packet1.c
index 36e14bb..9465204 100644
--- a/src/packet1.c
+++ b/src/packet1.c
@@ -193,21 +193,21 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
       }
 
       memcpy(&crc,
-          (unsigned char *)ssh_buffer_get_rest(session->in_buffer) + (len+padding) - sizeof(uint32_t),
+          (unsigned char *)ssh_buffer_get(session->in_buffer) + (len+padding) - sizeof(uint32_t),
           sizeof(uint32_t));
       ssh_buffer_pass_bytes_end(session->in_buffer, sizeof(uint32_t));
       crc = ntohl(crc);
-      if (ssh_crc32(ssh_buffer_get_rest(session->in_buffer),
+      if (ssh_crc32(ssh_buffer_get(session->in_buffer),
             (len + padding) - sizeof(uint32_t)) != crc) {
 #ifdef DEBUG_CRYPTO
-        ssh_print_hexa("crc32 on",ssh_buffer_get_rest(session->in_buffer),
+        ssh_print_hexa("crc32 on",ssh_buffer_get(session->in_buffer),
             len + padding - sizeof(uint32_t));
 #endif
         SSH_LOG(SSH_LOG_RARE, "Invalid crc32");
         ssh_set_error(session, SSH_FATAL,
             "Invalid crc32: expected %.8x, got %.8x",
             crc,
-            ssh_crc32(ssh_buffer_get_rest(session->in_buffer),
+            ssh_crc32(ssh_buffer_get(session->in_buffer),
               len + padding - sizeof(uint32_t)));
         goto error;
       }
diff --git a/src/packet_crypt.c b/src/packet_crypt.c
index 57e3a44..1db3358 100644
--- a/src/packet_crypt.c
+++ b/src/packet_crypt.c
@@ -164,7 +164,7 @@ int ssh_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_rest(buffer), ssh_buffer_get_rest_len(buffer));
+  hmac_update(ctx, ssh_buffer_get(buffer), ssh_buffer_get_rest_len(buffer));
   hmac_final(ctx, hmacbuf, &len);
 
 #ifdef DEBUG_CRYPTO
diff --git a/src/pcap.c b/src/pcap.c
index 4efb052..2055132 100644
--- a/src/pcap.c
+++ b/src/pcap.c
@@ -145,7 +145,7 @@ static int ssh_pcap_file_write(ssh_pcap_file pcap, ssh_buffer packet){
 	if(pcap == NULL || pcap->output==NULL)
 		return SSH_ERROR;
 	len=ssh_buffer_get_rest_len(packet);
-	err=fwrite(ssh_buffer_get_rest(packet),len,1,pcap->output);
+	err=fwrite(ssh_buffer_get(packet),len,1,pcap->output);
 	if(err<0)
 		return SSH_ERROR;
 	else
diff --git a/src/pki.c b/src/pki.c
index acb98be..c993622 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -1473,7 +1473,7 @@ int ssh_pki_export_signature_blob(const ssh_signature sig,
         return SSH_ERROR;
     }
 
-    ssh_string_fill(str, ssh_buffer_get_rest(buf), ssh_buffer_get_rest_len(buf));
+    ssh_string_fill(str, ssh_buffer_get(buf), ssh_buffer_get_rest_len(buf));
     ssh_buffer_free(buf);
 
     *sig_blob = str;
@@ -1629,7 +1629,7 @@ ssh_string ssh_pki_do_sign(ssh_session session,
         }
 
         evp_update(ctx, session_id, ssh_string_len(session_id) + 4);
-        evp_update(ctx, ssh_buffer_get_rest(sigbuf), ssh_buffer_get_rest_len(sigbuf));
+        evp_update(ctx, ssh_buffer_get(sigbuf), ssh_buffer_get_rest_len(sigbuf));
         evp_final(ctx, ehash, &elen);
 
 #ifdef DEBUG_CRYPTO
@@ -1651,7 +1651,7 @@ ssh_string ssh_pki_do_sign(ssh_session session,
         rc = ssh_buffer_pack(buf,
                              "SP",
                              session_id,
-                             ssh_buffer_get_rest_len(sigbuf), ssh_buffer_get_rest(sigbuf));
+                             ssh_buffer_get_rest_len(sigbuf), ssh_buffer_get(sigbuf));
         if (rc != SSH_OK) {
             ssh_string_free(session_id);
             ssh_buffer_free(buf);
@@ -1673,7 +1673,7 @@ ssh_string ssh_pki_do_sign(ssh_session session,
         }
 
         sha1_update(ctx, session_id, ssh_string_len(session_id) + 4);
-        sha1_update(ctx, ssh_buffer_get_rest(sigbuf), ssh_buffer_get_rest_len(sigbuf));
+        sha1_update(ctx, ssh_buffer_get(sigbuf), ssh_buffer_get_rest_len(sigbuf));
         sha1_final(hash, ctx);
 
 #ifdef DEBUG_CRYPTO
diff --git a/src/pki_crypto.c b/src/pki_crypto.c
index 811bb47..0984f8f 100644
--- a/src/pki_crypto.c
+++ b/src/pki_crypto.c
@@ -1039,7 +1039,7 @@ ssh_string pki_publickey_to_blob(const ssh_key key)
         goto fail;
     }
 
-    rc = ssh_string_fill(str, ssh_buffer_get_rest(buffer), ssh_buffer_get_rest_len(buffer));
+    rc = ssh_string_fill(str, ssh_buffer_get(buffer), ssh_buffer_get_rest_len(buffer));
     if (rc < 0) {
         goto fail;
     }
@@ -1244,7 +1244,7 @@ ssh_string pki_signature_to_blob(const ssh_signature sig)
                 return NULL;
             }
 
-            ssh_string_fill(sig_blob, ssh_buffer_get_rest(b), ssh_buffer_get_rest_len(b));
+            ssh_string_fill(sig_blob, ssh_buffer_get(b), ssh_buffer_get_rest_len(b));
             ssh_buffer_free(b);
             break;
         }
diff --git a/src/pki_gcrypt.c b/src/pki_gcrypt.c
index cff4023..885cc5b 100644
--- a/src/pki_gcrypt.c
+++ b/src/pki_gcrypt.c
@@ -1305,7 +1305,7 @@ ssh_string pki_publickey_to_blob(const ssh_key key)
         goto fail;
     }
 
-    rc = ssh_string_fill(str, ssh_buffer_get_rest(buffer), ssh_buffer_get_rest_len(buffer));
+    rc = ssh_string_fill(str, ssh_buffer_get(buffer), ssh_buffer_get_rest_len(buffer));
     if (rc < 0) {
         goto fail;
     }
diff --git a/src/sftp.c b/src/sftp.c
index c1dbda1..6f7e726 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -288,7 +288,7 @@ int sftp_packet_write(sftp_session sftp, uint8_t type, ssh_buffer payload){
     return -1;
   }
 
-  size = ssh_channel_write(sftp->channel, ssh_buffer_get_rest(payload),
+  size = ssh_channel_write(sftp->channel, ssh_buffer_get(payload),
       ssh_buffer_get_rest_len(payload));
   if (size < 0) {
     return -1;
@@ -460,7 +460,7 @@ static sftp_message sftp_get_message(sftp_packet packet) {
       msg->id,
       msg->packet_type);
 
-  if (ssh_buffer_add_data(msg->payload, ssh_buffer_get_rest(packet->payload),
+  if (ssh_buffer_add_data(msg->payload, ssh_buffer_get(packet->payload),
         ssh_buffer_get_rest_len(packet->payload)) < 0) {
     ssh_set_error_oom(sftp->session);
     sftp_message_free(msg);
diff --git a/src/sftpserver.c b/src/sftpserver.c
index 5939309..51a4ba7 100644
--- a/src/sftpserver.c
+++ b/src/sftpserver.c
@@ -65,7 +65,7 @@ sftp_client_message sftp_get_client_message(sftp_session sftp) {
   /* take a copy of the whole packet */
   msg->complete_message = ssh_buffer_new();
   ssh_buffer_add_data(msg->complete_message,
-                      ssh_buffer_get_rest(payload),
+                      ssh_buffer_get(payload),
                       ssh_buffer_get_rest_len(payload));
 
   ssh_buffer_get_u32(payload, &msg->id);
@@ -377,7 +377,7 @@ int sftp_reply_names(sftp_client_message msg) {
 
   if (ssh_buffer_add_u32(out, msg->id) < 0 ||
       ssh_buffer_add_u32(out, htonl(msg->attr_num)) < 0 ||
-      ssh_buffer_add_data(out, ssh_buffer_get_rest(msg->attrbuf),
+      ssh_buffer_add_data(out, ssh_buffer_get(msg->attrbuf),
         ssh_buffer_get_rest_len(msg->attrbuf)) < 0 ||
       sftp_packet_write(msg->sftp, SSH_FXP_NAME, out) < 0) {
     ssh_buffer_free(out);
diff --git a/src/socket.c b/src/socket.c
index ba5128a..06ea9e6 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -290,7 +290,7 @@ int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd,
             }
             if (s->callbacks && s->callbacks->data) {
                 do {
-                    r = s->callbacks->data(ssh_buffer_get_rest(s->in_buffer),
+                    r = s->callbacks->data(ssh_buffer_get(s->in_buffer),
                                            ssh_buffer_get_rest_len(s->in_buffer),
                                            s->callbacks->userdata);
                     ssh_buffer_pass_bytes(s->in_buffer, r);
@@ -658,7 +658,7 @@ int ssh_socket_nonblocking_flush(ssh_socket s) {
       return SSH_AGAIN;
   }
   if (s->write_wontblock && len > 0) {
-    w = ssh_socket_unbuffered_write(s, ssh_buffer_get_rest(s->out_buffer), len);
+    w = ssh_socket_unbuffered_write(s, ssh_buffer_get(s->out_buffer), len);
     if (w < 0) {
       session->alive = 0;
       ssh_socket_close(s);
diff --git a/tests/unittests/torture_buffer.c b/tests/unittests/torture_buffer.c
index 03dfcf9..d4cef64 100644
--- a/tests/unittests/torture_buffer.c
+++ b/tests/unittests/torture_buffer.c
@@ -75,25 +75,25 @@ static void torture_buffer_prepend(void **state) {
   ssh_buffer_add_data(buffer,"abcdef",6);
   ssh_buffer_prepend_data(buffer,"xyz",3);
   assert_int_equal(ssh_buffer_get_rest_len(buffer),9);
-  assert_memory_equal(ssh_buffer_get_rest(buffer),  "xyzabcdef", 9);
+  assert_memory_equal(ssh_buffer_get(buffer),  "xyzabcdef", 9);
 
   /* Now remove 4 bytes and see if we can replace them */
   ssh_buffer_get_u32(buffer,&v);
   assert_int_equal(ssh_buffer_get_rest_len(buffer),5);
-  assert_memory_equal(ssh_buffer_get_rest(buffer), "bcdef", 5);
+  assert_memory_equal(ssh_buffer_get(buffer), "bcdef", 5);
 
   ssh_buffer_prepend_data(buffer,"aris",4);
   assert_int_equal(ssh_buffer_get_rest_len(buffer),9);
-  assert_memory_equal(ssh_buffer_get_rest(buffer), "arisbcdef", 9);
+  assert_memory_equal(ssh_buffer_get(buffer), "arisbcdef", 9);
 
   /* same thing but we add 5 bytes now */
   ssh_buffer_get_u32(buffer,&v);
   assert_int_equal(ssh_buffer_get_rest_len(buffer),5);
-  assert_memory_equal(ssh_buffer_get_rest(buffer), "bcdef", 5);
+  assert_memory_equal(ssh_buffer_get(buffer), "bcdef", 5);
 
   ssh_buffer_prepend_data(buffer,"12345",5);
   assert_int_equal(ssh_buffer_get_rest_len(buffer),10);
-  assert_memory_equal(ssh_buffer_get_rest(buffer), "12345bcdef", 10);
+  assert_memory_equal(ssh_buffer_get(buffer), "12345bcdef", 10);
 }
 
 /*
@@ -157,7 +157,7 @@ static void torture_ssh_buffer_add_format(void **state) {
 
     len = ssh_buffer_get_rest_len(buffer);
     assert_int_equal(len, sizeof(verif) - 1);
-    assert_memory_equal(ssh_buffer_get_rest(buffer), verif, sizeof(verif) -1);
+    assert_memory_equal(ssh_buffer_get(buffer), verif, sizeof(verif) -1);
 
     ssh_string_free(s);
 }
-- 
2.5.0


Archive administrator: postmaster@lists.cynapses.org