summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-08 07:13:18 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-08 07:13:18 +0000
commit38d86e7e17f10fe4d2ea1372714f1be5e98aa960 (patch)
tree545b7251ebce8a59785b338fa48f1e4d7e270fad
parentc4f65cb5dde1b9b90d52d1d444c519cc66a8b656 (diff)
downloadlibssh-38d86e7e17f10fe4d2ea1372714f1be5e98aa960.tar.gz
libssh-38d86e7e17f10fe4d2ea1372714f1be5e98aa960.tar.xz
libssh-38d86e7e17f10fe4d2ea1372714f1be5e98aa960.zip
Fix SSHv1 compile errors.
Thanks to Norbert Kiesel <nkiesel@tbdnetworks.com> for the patch. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@424 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r--libssh/auth.c4
-rw-r--r--libssh/auth1.c10
-rw-r--r--libssh/channels.c2
-rw-r--r--libssh/packet.c6
-rw-r--r--libssh/session.c2
5 files changed, 12 insertions, 12 deletions
diff --git a/libssh/auth.c b/libssh/auth.c
index 4ed5589..52fa9c2 100644
--- a/libssh/auth.c
+++ b/libssh/auth.c
@@ -176,7 +176,7 @@ int ssh_userauth_none(SSH_SESSION *session, const char *username){
enter_function();
#ifdef HAVE_SSH1
if(session->version==1){
- err = ssh_userauth1_none(session,username);
+ ssh_userauth1_none(session,username);
leave_function();
return rc;
}
@@ -266,7 +266,7 @@ int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username,int typ
enter_function();
#ifdef HAVE_SSH1
if(session->version==1){
- err= ssh_userauth1_offer_pubkey(session,username,type,publickey);
+ ssh_userauth1_offer_pubkey(session,username,type,publickey);
leave_function();
return rc;
}
diff --git a/libssh/auth1.c b/libssh/auth1.c
index ec73905..d4abc54 100644
--- a/libssh/auth1.c
+++ b/libssh/auth1.c
@@ -51,7 +51,7 @@ static int wait_auth1_status(SSH_SESSION *session){
"FAILURE, got %d",session->in_packet.type);
return SSH_AUTH_ERROR;
}
-static int send_username(SSH_SESSION *session, char *username){
+static int send_username(SSH_SESSION *session, const char *username){
STRING *user;
/* returns SSH_AUTH_SUCCESS or SSH_AUTH_DENIED */
if(session->auth_service_asked)
@@ -74,7 +74,7 @@ static int send_username(SSH_SESSION *session, char *username){
/* use the "none" authentication question */
-int ssh_userauth1_none(SSH_SESSION *session,char *username){
+int ssh_userauth1_none(SSH_SESSION *session,const char *username){
return send_username(session,username);
}
@@ -119,7 +119,7 @@ int ssh_userauth_offer_pubkey(SSH_SESSION *session, char *username,int type, STR
/** \internal
* \todo implement ssh1 public key
*/
-int ssh_userauth1_offer_pubkey(SSH_SESSION *session, char *username, int type,
+int ssh_userauth1_offer_pubkey(SSH_SESSION *session, const char *username, int type,
STRING *pubkey){
return SSH_AUTH_DENIED;
}
@@ -171,7 +171,7 @@ int ssh_userauth_pubkey(SSH_SESSION *session, char *username, STRING *publickey,
}
*/
-int ssh_userauth1_password(SSH_SESSION *session,char *username,char *password){
+int ssh_userauth1_password(SSH_SESSION *session,const char *username,const char *password){
STRING *password_s;
int err;
err=send_username(session,username);
@@ -183,7 +183,7 @@ int ssh_userauth1_password(SSH_SESSION *session,char *username,char *password){
*/
/* XXX fix me here ! */
/* cisco IOS doesn't like when a password is followed by zeroes and random pad. */
- if(strlen(password)>=0){
+ if(1 || strlen(password)>=128){
/* not risky to disclose the size of such a big password .. */
password_s=string_from_char(password);
} else {
diff --git a/libssh/channels.c b/libssh/channels.c
index ccfe719..5046517 100644
--- a/libssh/channels.c
+++ b/libssh/channels.c
@@ -927,7 +927,7 @@ int channel_request_pty_size(CHANNEL *channel, const char *terminal,
enter_function();
#ifdef HAVE_SSH1
if (channel->version==1) {
- err = channel_request_pty_size1(channel,terminal, col, row);
+ channel_request_pty_size1(channel,terminal, col, row);
leave_function();
return rc;
}
diff --git a/libssh/packet.c b/libssh/packet.c
index 6cb5f40..4802fe6 100644
--- a/libssh/packet.c
+++ b/libssh/packet.c
@@ -200,7 +200,7 @@ static int packet_read1(SSH_SESSION *session){
/* len is not encrypted */
len=ntohl(len);
if(len> MAX_PACKET_LEN){
- ssh_set_error(session,SSH_FATAL,"read_packet(): Packet len too high(%uld %.8lx)",len,len);
+ ssh_set_error(session,SSH_FATAL,"read_packet(): Packet len too high(%u %.8x)",len,len);
leave_function();
return SSH_ERROR;
}
@@ -265,8 +265,8 @@ static int packet_read1(SSH_SESSION *session){
len + padding - sizeof(u32));
#endif
ssh_log(session,SSH_LOG_RARE,"invalid crc32");
- ssh_set_error(session,SSH_FATAL,"invalid crc32 : expected %.8lx, "
- "got %.8lx",crc,
+ ssh_set_error(session,SSH_FATAL,"invalid crc32 : expected %.8x, "
+ "got %.8x",crc,
ssh_crc32(buffer_get_rest(session->in_buffer),len+padding-sizeof(u32)) );
leave_function();
return SSH_ERROR;
diff --git a/libssh/session.c b/libssh/session.c
index 7086b77..9dc43dd 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -104,7 +104,6 @@ void ssh_cleanup(SSH_SESSION *session) {
crypto_free(session->current_crypto);
crypto_free(session->next_crypto);
ssh_socket_free(session->socket);
- ssh_options_free(session->options);
/* delete all channels */
while (session->channels) {
channel_free(session->channels);
@@ -130,6 +129,7 @@ void ssh_cleanup(SSH_SESSION *session) {
private_key_free(session->rsa_key);
ssh_message_free(session->ssh_message);
SAFE_FREE(session->ssh_message);
+ ssh_options_free(session->options);
/* burn connection, it could hang sensitive datas */
memset(session,'X',sizeof(SSH_SESSION));