diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2008-12-14 21:46:31 +0000 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2008-12-14 21:46:31 +0000 |
commit | 16a3379a610ec41a5bed1755fc9eeabf9c8b37b4 (patch) | |
tree | a4d2a3fd4841321ef5cc50bfe0f4a2364a3532bf | |
parent | f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1 (diff) | |
download | libssh-16a3379a610ec41a5bed1755fc9eeabf9c8b37b4.tar.gz libssh-16a3379a610ec41a5bed1755fc9eeabf9c8b37b4.tar.xz libssh-16a3379a610ec41a5bed1755fc9eeabf9c8b37b4.zip |
some changes to resolve bugs reported by webyog
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@192 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r-- | include/libssh/sftp.h | 1 | ||||
-rw-r--r-- | libssh/auth.c | 24 | ||||
-rw-r--r-- | libssh/connect.c | 2 | ||||
-rw-r--r-- | libssh/sftp.c | 5 |
4 files changed, 21 insertions, 11 deletions
diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h index 5286697d..a697baa7 100644 --- a/include/libssh/sftp.h +++ b/include/libssh/sftp.h @@ -152,6 +152,7 @@ u32 sftp_async_read_begin(SFTP_FILE *file, int len); int sftp_async_read(SFTP_FILE *file, void *data, int len, u32 id); int sftp_write(SFTP_FILE *file, const void *source, int len); void sftp_seek(SFTP_FILE *file, int new_offset); +void sftp_seek64(SFTP_FILE *file, u64 new_offset); unsigned long sftp_tell(SFTP_FILE *file); void sftp_rewind(SFTP_FILE *file); int sftp_rm(SFTP_SESSION *sftp, char *file); diff --git a/libssh/auth.c b/libssh/auth.c index 29054884..a0707500 100644 --- a/libssh/auth.c +++ b/libssh/auth.c @@ -109,7 +109,7 @@ static int wait_auth_status(SSH_SESSION *session,int kbdint){ cont=0; break; } - /* continue through success */ + /* continue through success */ case SSH2_MSG_USERAUTH_SUCCESS: err=SSH_AUTH_SUCCESS; cont=0; @@ -143,6 +143,12 @@ int ssh_auth_list(SSH_SESSION *session) { return session->auth_methods; } +int ssh_userauth_list(SSH_SESSION *session, const char *username){ + if(session->auth_methods==0) + ssh_userauth_none(session,username); + return ssh_auth_list(session); +} + /* use the "none" authentication question */ /** \brief Try to authenticate through the "none" method @@ -302,8 +308,8 @@ int ssh_userauth_pubkey(SSH_SESSION *session, const char *username, STRING *publ service=string_from_char("ssh-connection"); method=string_from_char("publickey"); algo=string_from_char(ssh_type_to_char(privatekey->type)); - - + + /* we said previously the public key was accepted */ buffer_add_u8(session->out_buffer,SSH2_MSG_USERAUTH_REQUEST); buffer_add_ssh_string(session->out_buffer,user); @@ -542,7 +548,7 @@ static void kbdint_free(struct ssh_kbdint *kbd){ } free(kbd); } - + static void kbdint_clean(struct ssh_kbdint *kbd){ int i,n=kbd->nprompts; if(kbd->name){ @@ -759,7 +765,7 @@ int ssh_userauth_kbdint(SSH_SESSION *session, const char *user, const char *subm return err; } -/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this +/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this * function returns the questions from the server * \brief get the number of prompts (questions) the server has given * \param session ssh session @@ -770,7 +776,7 @@ int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session){ return session->kbdint->nprompts; } -/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this +/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this * function returns the questions from the server * \brief get the "name" of the message block * \param session ssh session @@ -781,7 +787,7 @@ char *ssh_userauth_kbdint_getname(SSH_SESSION *session){ return session->kbdint->name; } -/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this +/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this * function returns the questions from the server * \brief get the "instruction" of the message block * \param session ssh session @@ -792,7 +798,7 @@ char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session){ return session->kbdint->instruction; } -/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this +/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this * function returns the questions from the server * \brief get a prompt from a message block * \param session ssh session @@ -811,7 +817,7 @@ char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, int i, return session->kbdint->prompts[i]; } -/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this +/** You have called ssh_userauth_kbdint() and got SSH_AUTH_INFO. this * function returns the questions from the server * \brief set the answer for a question from a message block. * \param session ssh session diff --git a/libssh/connect.c b/libssh/connect.c index 1a9a9d8a..d8a7f920 100644 --- a/libssh/connect.c +++ b/libssh/connect.c @@ -29,7 +29,7 @@ MA 02111-1307, USA. */ #define _WIN32_WINNT 0x0501 //getaddrinfo, freeaddrinfo, getnameinfo #include <winsock2.h> #include <ws2tcpip.h> -//#include "wspiapi.h" +#include "wspiapi.h" //workaround for w2k systems #else #include <netdb.h> #include <sys/socket.h> diff --git a/libssh/sftp.c b/libssh/sftp.c index 14988d34..ff2f7d9c 100644 --- a/libssh/sftp.c +++ b/libssh/sftp.c @@ -133,7 +133,6 @@ int sftp_server_init(SFTP_SESSION *sftp){ void sftp_free(SFTP_SESSION *sftp){ struct request_queue *ptr; channel_send_eof(sftp->channel); - channel_free(sftp->channel); ptr=sftp->queue; while(ptr){ struct request_queue *old; @@ -142,6 +141,7 @@ void sftp_free(SFTP_SESSION *sftp){ free(ptr); ptr=old; } + channel_free(sftp->channel); memset(sftp,0,sizeof(*sftp)); free(sftp); } @@ -1253,6 +1253,9 @@ void sftp_seek(SFTP_FILE *file, int new_offset){ file->offset=new_offset; } +void sftp_seek64(SFTP_FILE *file, u64 new_offset){ + file->offset=new_offset; +} unsigned long sftp_tell(SFTP_FILE *file){ return file->offset; } |