1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-05 20:55:46 +03:00

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
This commit is contained in:
Aris Adamantiadis
2008-12-14 21:46:31 +00:00
parent f7700f2bc2
commit 16a3379a61
4 changed files with 21 additions and 11 deletions

View File

@@ -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_async_read(SFTP_FILE *file, void *data, int len, u32 id);
int sftp_write(SFTP_FILE *file, const void *source, int len); int sftp_write(SFTP_FILE *file, const void *source, int len);
void sftp_seek(SFTP_FILE *file, int new_offset); 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); unsigned long sftp_tell(SFTP_FILE *file);
void sftp_rewind(SFTP_FILE *file); void sftp_rewind(SFTP_FILE *file);
int sftp_rm(SFTP_SESSION *sftp, char *file); int sftp_rm(SFTP_SESSION *sftp, char *file);

View File

@@ -109,7 +109,7 @@ static int wait_auth_status(SSH_SESSION *session,int kbdint){
cont=0; cont=0;
break; break;
} }
/* continue through success */ /* continue through success */
case SSH2_MSG_USERAUTH_SUCCESS: case SSH2_MSG_USERAUTH_SUCCESS:
err=SSH_AUTH_SUCCESS; err=SSH_AUTH_SUCCESS;
cont=0; cont=0;
@@ -143,6 +143,12 @@ int ssh_auth_list(SSH_SESSION *session) {
return session->auth_methods; 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 */ /* use the "none" authentication question */
/** \brief Try to authenticate through the "none" method /** \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"); service=string_from_char("ssh-connection");
method=string_from_char("publickey"); method=string_from_char("publickey");
algo=string_from_char(ssh_type_to_char(privatekey->type)); algo=string_from_char(ssh_type_to_char(privatekey->type));
/* we said previously the public key was accepted */ /* we said previously the public key was accepted */
buffer_add_u8(session->out_buffer,SSH2_MSG_USERAUTH_REQUEST); buffer_add_u8(session->out_buffer,SSH2_MSG_USERAUTH_REQUEST);
buffer_add_ssh_string(session->out_buffer,user); buffer_add_ssh_string(session->out_buffer,user);
@@ -542,7 +548,7 @@ static void kbdint_free(struct ssh_kbdint *kbd){
} }
free(kbd); free(kbd);
} }
static void kbdint_clean(struct ssh_kbdint *kbd){ static void kbdint_clean(struct ssh_kbdint *kbd){
int i,n=kbd->nprompts; int i,n=kbd->nprompts;
if(kbd->name){ if(kbd->name){
@@ -759,7 +765,7 @@ int ssh_userauth_kbdint(SSH_SESSION *session, const char *user, const char *subm
return err; 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 * function returns the questions from the server
* \brief get the number of prompts (questions) the server has given * \brief get the number of prompts (questions) the server has given
* \param session ssh session * \param session ssh session
@@ -770,7 +776,7 @@ int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session){
return session->kbdint->nprompts; 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 * function returns the questions from the server
* \brief get the "name" of the message block * \brief get the "name" of the message block
* \param session ssh session * \param session ssh session
@@ -781,7 +787,7 @@ char *ssh_userauth_kbdint_getname(SSH_SESSION *session){
return session->kbdint->name; 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 * function returns the questions from the server
* \brief get the "instruction" of the message block * \brief get the "instruction" of the message block
* \param session ssh session * \param session ssh session
@@ -792,7 +798,7 @@ char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session){
return session->kbdint->instruction; 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 * function returns the questions from the server
* \brief get a prompt from a message block * \brief get a prompt from a message block
* \param session ssh session * \param session ssh session
@@ -811,7 +817,7 @@ char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, int i,
return session->kbdint->prompts[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 * function returns the questions from the server
* \brief set the answer for a question from a message block. * \brief set the answer for a question from a message block.
* \param session ssh session * \param session ssh session

View File

@@ -29,7 +29,7 @@ MA 02111-1307, USA. */
#define _WIN32_WINNT 0x0501 //getaddrinfo, freeaddrinfo, getnameinfo #define _WIN32_WINNT 0x0501 //getaddrinfo, freeaddrinfo, getnameinfo
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
//#include "wspiapi.h" #include "wspiapi.h" //workaround for w2k systems
#else #else
#include <netdb.h> #include <netdb.h>
#include <sys/socket.h> #include <sys/socket.h>

View File

@@ -133,7 +133,6 @@ int sftp_server_init(SFTP_SESSION *sftp){
void sftp_free(SFTP_SESSION *sftp){ void sftp_free(SFTP_SESSION *sftp){
struct request_queue *ptr; struct request_queue *ptr;
channel_send_eof(sftp->channel); channel_send_eof(sftp->channel);
channel_free(sftp->channel);
ptr=sftp->queue; ptr=sftp->queue;
while(ptr){ while(ptr){
struct request_queue *old; struct request_queue *old;
@@ -142,6 +141,7 @@ void sftp_free(SFTP_SESSION *sftp){
free(ptr); free(ptr);
ptr=old; ptr=old;
} }
channel_free(sftp->channel);
memset(sftp,0,sizeof(*sftp)); memset(sftp,0,sizeof(*sftp));
free(sftp); free(sftp);
} }
@@ -1253,6 +1253,9 @@ void sftp_seek(SFTP_FILE *file, int new_offset){
file->offset=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){ unsigned long sftp_tell(SFTP_FILE *file){
return file->offset; return file->offset;
} }