aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2014-01-19 20:43:29 +0100
committerAndreas Schneider <asn@cryptomilk.org>2014-01-19 20:43:29 +0100
commit9c4144689d7d062aa636a019b416d172a9e12c29 (patch)
tree6936e822e25fa69483cf8f5edb6abe267a418c9b
parente745236ae5b06c897f2a576a9d2bbd8ada121c1c (diff)
downloadlibssh-9c4144689d7d062aa636a019b416d172a9e12c29.tar.gz
libssh-9c4144689d7d062aa636a019b416d172a9e12c29.tar.xz
libssh-9c4144689d7d062aa636a019b416d172a9e12c29.zip
src: Rename buffer_init to ssh_buffer_init().
-rw-r--r--include/libssh/buffer.h2
-rw-r--r--src/agent.c2
-rw-r--r--src/auth.c14
-rw-r--r--src/buffer.c3
-rw-r--r--src/channels.c14
-rw-r--r--src/client.c20
-rw-r--r--src/curve25519.c2
-rw-r--r--src/dh.c10
-rw-r--r--src/gssapi.c2
-rw-r--r--src/gzip.c4
-rw-r--r--src/kex.c4
-rw-r--r--src/packet.c4
-rw-r--r--src/packet1.c4
-rw-r--r--src/pki_crypto.c2
-rw-r--r--src/server.c6
-rw-r--r--src/session.c4
-rw-r--r--src/socket.c4
17 files changed, 53 insertions, 48 deletions
diff --git a/include/libssh/buffer.h b/include/libssh/buffer.h
index d7cdfbf4..16f4d957 100644
--- a/include/libssh/buffer.h
+++ b/include/libssh/buffer.h
@@ -48,7 +48,7 @@ int buffer_add_u64(ssh_buffer buffer, uint64_t data);
int buffer_add_data(ssh_buffer buffer, const void *data, uint32_t len);
int buffer_prepend_data(ssh_buffer buffer, const void *data, uint32_t len);
int buffer_add_buffer(ssh_buffer buffer, ssh_buffer source);
-int buffer_reinit(ssh_buffer buffer);
+int ssh_buffer_reinit(ssh_buffer buffer);
/* buffer_get_rest returns a pointer to the current position into the buffer */
void *buffer_get_rest(ssh_buffer buffer);
diff --git a/src/agent.c b/src/agent.c
index 6fcef0ca..e764525c 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -393,7 +393,7 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) {
}
if (session->agent->ident) {
- buffer_reinit(session->agent->ident);
+ ssh_buffer_reinit(session->agent->ident);
}
session->agent->ident = reply;
diff --git a/src/auth.c b/src/auth.c
index 1d5647c3..db8576ff 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -448,7 +448,7 @@ pending:
return rc;
fail:
ssh_set_error_oom(session);
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_AUTH_ERROR;
}
@@ -614,7 +614,7 @@ pending:
return rc;
fail:
ssh_set_error_oom(session);
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_AUTH_ERROR;
}
@@ -788,7 +788,7 @@ pending:
return rc;
fail:
ssh_set_error_oom(session);
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_AUTH_ERROR;
}
@@ -924,7 +924,7 @@ pending:
return rc;
fail:
ssh_set_error_oom(session);
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_AUTH_ERROR;
}
@@ -1415,7 +1415,7 @@ pending:
return rc;
fail:
ssh_set_error_oom(session);
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_AUTH_ERROR;
}
@@ -1642,7 +1642,7 @@ pending:
return rc;
fail:
ssh_set_error_oom(session);
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_AUTH_ERROR;
}
@@ -1716,7 +1716,7 @@ pending:
return rc;
fail:
ssh_set_error_oom(session);
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_AUTH_ERROR;
}
diff --git a/src/buffer.c b/src/buffer.c
index ca120868..76507596 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -158,7 +158,8 @@ static void buffer_shift(ssh_buffer buffer){
*
* @return 0 on success, < 0 on error.
*/
-int buffer_reinit(struct ssh_buffer_struct *buffer) {
+int ssh_buffer_reinit(struct ssh_buffer_struct *buffer)
+{
buffer_verify(buffer);
memset(buffer->data, 0, buffer->used);
buffer->used = 0;
diff --git a/src/channels.c b/src/channels.c
index c11aa419..333d5fdf 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -393,7 +393,7 @@ static int grow_window(ssh_session session, ssh_channel channel, int minimumsize
return SSH_OK;
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_ERROR;
}
@@ -1171,7 +1171,7 @@ int ssh_channel_send_eof(ssh_channel channel){
return rc;
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return rc;
}
@@ -1229,7 +1229,7 @@ int ssh_channel_close(ssh_channel channel){
return rc;
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return rc;
}
@@ -1418,7 +1418,7 @@ out:
return (int)(origlen - len);
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_ERROR;
}
@@ -1673,7 +1673,7 @@ pending:
return rc;
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return rc;
}
@@ -2240,7 +2240,7 @@ pending:
return rc;
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return rc;
}
@@ -2652,7 +2652,7 @@ int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
return SSH_ERROR;
}
- buffer_reinit(buffer);
+ ssh_buffer_reinit(buffer);
if(count==0){
do {
r=ssh_channel_poll(channel, is_stderr);
diff --git a/src/client.c b/src/client.c
index 729c2129..bcb3be21 100644
--- a/src/client.c
+++ b/src/client.c
@@ -659,14 +659,18 @@ error:
crypto_free(session->current_crypto);
session->current_crypto=NULL;
}
- if(session->in_buffer)
- buffer_reinit(session->in_buffer);
- if(session->out_buffer)
- buffer_reinit(session->out_buffer);
- if(session->in_hashbuf)
- buffer_reinit(session->in_hashbuf);
- if(session->out_hashbuf)
- buffer_reinit(session->out_hashbuf);
+ if (session->in_buffer) {
+ ssh_buffer_reinit(session->in_buffer);
+ }
+ if (session->out_buffer) {
+ ssh_buffer_reinit(session->out_buffer);
+ }
+ if (session->in_hashbuf) {
+ ssh_buffer_reinit(session->in_hashbuf);
+ }
+ if (session->out_hashbuf) {
+ ssh_buffer_reinit(session->out_hashbuf);
+ }
session->auth_methods = 0;
SAFE_FREE(session->serverbanner);
SAFE_FREE(session->clientbanner);
diff --git a/src/curve25519.c b/src/curve25519.c
index 073bf1e9..784d4106 100644
--- a/src/curve25519.c
+++ b/src/curve25519.c
@@ -283,7 +283,7 @@ int ssh_server_curve25519_init(ssh_session session, ssh_buffer packet){
return rc;
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_ERROR;
}
diff --git a/src/dh.c b/src/dh.c
index 3f2d30a6..c69cb841 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -808,20 +808,20 @@ int hashbufout_add_cookie(ssh_session session) {
}
if (buffer_add_u8(session->out_hashbuf, 20) < 0) {
- buffer_reinit(session->out_hashbuf);
+ ssh_buffer_reinit(session->out_hashbuf);
return -1;
}
if (session->server) {
if (buffer_add_data(session->out_hashbuf,
session->next_crypto->server_kex.cookie, 16) < 0) {
- buffer_reinit(session->out_hashbuf);
+ ssh_buffer_reinit(session->out_hashbuf);
return -1;
}
} else {
if (buffer_add_data(session->out_hashbuf,
session->next_crypto->client_kex.cookie, 16) < 0) {
- buffer_reinit(session->out_hashbuf);
+ ssh_buffer_reinit(session->out_hashbuf);
return -1;
}
}
@@ -836,11 +836,11 @@ int hashbufin_add_cookie(ssh_session session, unsigned char *cookie) {
}
if (buffer_add_u8(session->in_hashbuf, 20) < 0) {
- buffer_reinit(session->in_hashbuf);
+ ssh_buffer_reinit(session->in_hashbuf);
return -1;
}
if (buffer_add_data(session->in_hashbuf,cookie, 16) < 0) {
- buffer_reinit(session->in_hashbuf);
+ ssh_buffer_reinit(session->in_hashbuf);
return -1;
}
diff --git a/src/gssapi.c b/src/gssapi.c
index d8b16d34..47394c35 100644
--- a/src/gssapi.c
+++ b/src/gssapi.c
@@ -615,7 +615,7 @@ static int ssh_gssapi_send_auth_mic(ssh_session session, ssh_string *oid_set, in
session->auth_state = SSH_AUTH_STATE_GSSAPI_REQUEST_SENT;
return packet_send(session);
fail:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_ERROR;
}
diff --git a/src/gzip.c b/src/gzip.c
index acf27bba..57a2644b 100644
--- a/src/gzip.c
+++ b/src/gzip.c
@@ -108,7 +108,7 @@ int compress_buffer(ssh_session session, ssh_buffer buf) {
return -1;
}
- if (buffer_reinit(buf) < 0) {
+ if (ssh_buffer_reinit(buf) < 0) {
ssh_buffer_free(dest);
return -1;
}
@@ -204,7 +204,7 @@ int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen){
return -1;
}
- if (buffer_reinit(buf) < 0) {
+ if (ssh_buffer_reinit(buf) < 0) {
ssh_buffer_free(dest);
return -1;
}
diff --git a/src/kex.c b/src/kex.c
index 7cd404f7..e0ac8dbf 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -477,8 +477,8 @@ int ssh_send_kex(ssh_session session, int server_kex) {
return 0;
error:
- buffer_reinit(session->out_buffer);
- buffer_reinit(session->out_hashbuf);
+ ssh_buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_hashbuf);
ssh_string_free(str);
return -1;
diff --git a/src/packet.c b/src/packet.c
index 75f6b58f..e3322872 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -177,7 +177,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
memset(&session->in_packet, 0, sizeof(PACKET));
if (session->in_buffer) {
- rc = buffer_reinit(session->in_buffer);
+ rc = ssh_buffer_reinit(session->in_buffer);
if (rc < 0) {
goto error;
}
@@ -558,7 +558,7 @@ static int packet_send2(ssh_session session) {
SSH_LOG(SSH_LOG_PACKET,
"packet: wrote [len=%d,padding=%hhd,comp=%d,payload=%d]",
ntohl(finallen), padding, compsize, payloadsize);
- if (buffer_reinit(session->out_buffer) < 0) {
+ if (ssh_buffer_reinit(session->out_buffer) < 0) {
rc = SSH_ERROR;
}
error:
diff --git a/src/packet1.c b/src/packet1.c
index 7ac8318d..5fe48398 100644
--- a/src/packet1.c
+++ b/src/packet1.c
@@ -114,7 +114,7 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
memset(&session->in_packet, 0, sizeof(PACKET));
if (session->in_buffer) {
- if (buffer_reinit(session->in_buffer) < 0) {
+ if (ssh_buffer_reinit(session->in_buffer) < 0) {
goto error;
}
} else {
@@ -315,7 +315,7 @@ int packet_send1(ssh_session session) {
session->send_seq++;
- if (buffer_reinit(session->out_buffer) < 0) {
+ if (ssh_buffer_reinit(session->out_buffer) < 0) {
rc = SSH_ERROR;
}
error:
diff --git a/src/pki_crypto.c b/src/pki_crypto.c
index 1080a809..19346a70 100644
--- a/src/pki_crypto.c
+++ b/src/pki_crypto.c
@@ -935,7 +935,7 @@ ssh_string pki_publickey_to_blob(const ssh_key key)
break;
case SSH_KEYTYPE_ECDSA:
#ifdef HAVE_OPENSSL_ECC
- rc = buffer_reinit(buffer);
+ rc = ssh_buffer_reinit(buffer);
if (rc < 0) {
ssh_buffer_free(buffer);
return NULL;
diff --git a/src/server.c b/src/server.c
index f910ebb0..67fad9d1 100644
--- a/src/server.c
+++ b/src/server.c
@@ -290,7 +290,7 @@ static int dh_handshake_server(ssh_session session) {
buffer_add_ssh_string(session->out_buffer, f) < 0 ||
buffer_add_ssh_string(session->out_buffer, sig_blob) < 0) {
ssh_set_error(session, SSH_FATAL, "Not enough space");
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
ssh_string_free(f);
ssh_string_free(sig_blob);
return -1;
@@ -302,7 +302,7 @@ static int dh_handshake_server(ssh_session session) {
}
if (buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS) < 0) {
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return -1;
}
@@ -1258,7 +1258,7 @@ int ssh_send_keepalive(ssh_session session)
err:
ssh_set_error_oom(session);
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_ERROR;
}
diff --git a/src/session.c b/src/session.c
index 71d4548e..1128791e 100644
--- a/src/session.c
+++ b/src/session.c
@@ -735,7 +735,7 @@ int ssh_send_ignore (ssh_session session, const char *data) {
return SSH_OK;
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_ERROR;
}
@@ -786,7 +786,7 @@ int ssh_send_debug (ssh_session session, const char *message, int always_display
return SSH_OK;
error:
- buffer_reinit(session->out_buffer);
+ ssh_buffer_reinit(session->out_buffer);
return SSH_ERROR;
}
diff --git a/src/socket.c b/src/socket.c
index 856f6d04..da996533 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -182,8 +182,8 @@ void ssh_socket_reset(ssh_socket s){
s->fd_out= SSH_INVALID_SOCKET;
s->last_errno = -1;
s->fd_is_socket = 1;
- buffer_reinit(s->in_buffer);
- buffer_reinit(s->out_buffer);
+ ssh_buffer_reinit(s->in_buffer);
+ ssh_buffer_reinit(s->out_buffer);
s->read_wontblock = 0;
s->write_wontblock = 0;
s->data_except = 0;