aboutsummaryrefslogtreecommitdiff
path: root/libssh/session.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2008-06-12 20:14:17 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2008-06-12 20:14:17 +0000
commitfe51f9c7662b7391f80953bedc4fe61b89013913 (patch)
tree66e1390ec6f593ba32b7a881040a303fd2669653 /libssh/session.c
parentb94422ef10bb083dde58e8c8349cc3e004888f9f (diff)
downloadlibssh-fe51f9c7662b7391f80953bedc4fe61b89013913.tar.gz
libssh-fe51f9c7662b7391f80953bedc4fe61b89013913.tar.xz
libssh-fe51f9c7662b7391f80953bedc4fe61b89013913.zip
big changes :
Some documentation, and a new logging system. some work must be done to get rid of the infamous ssh_say() git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@166 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/session.c')
-rw-r--r--libssh/session.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/libssh/session.c b/libssh/session.c
index 28d89de6..f8344fa8 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -44,10 +44,12 @@ SSH_SESSION *ssh_new() {
session->socket=ssh_socket_new();
session->alive=0;
session->blocking=1;
+ session->log_indent=0;
return session;
}
void ssh_cleanup(SSH_SESSION *session){
+ enter_function();
int i;
if(session->serverbanner)
free(session->serverbanner);
@@ -95,15 +97,19 @@ void ssh_cleanup(SSH_SESSION *session){
memset(session,'X',sizeof(SSH_SESSION)); /* burn connection, it could hangs
sensitive datas */
free(session);
+ //leave_function();
}
/** \brief disconnect impolitely from remote host
* \param session current ssh session
*/
void ssh_silent_disconnect(SSH_SESSION *session){
+ enter_function();
+ ssh_log(session,SSH_LOG_ENTRY,"ssh_silent_disconnect()");
ssh_socket_close(session->socket);
session->alive=0;
ssh_disconnect(session);
+ //leave_function();
}
/** \brief set the options for the current session
@@ -114,6 +120,7 @@ void ssh_silent_disconnect(SSH_SESSION *session){
*/
void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options){
session->options=options;
+ session->log_verbosity=options->log_verbosity;
}
/** \brief set the session in blocking/nonblocking mode
@@ -163,16 +170,22 @@ void ssh_set_fd_except(SSH_SESSION *session){
/* looks if there is data to read on the socket and parse it. */
int ssh_handle_packets(SSH_SESSION *session){
int w,err,r,i=0;
+ enter_function();
do {
r=ssh_fd_poll(session,&w,&err);
- if(r<=0)
+ if(r<=0){
+ leave_function();
return r; // error or no data available
+ }
/* if an exception happened, it will be trapped by packet_read() */
- if(packet_read(session)||packet_translate(session))
- return -1;
+ if(packet_read(session)||packet_translate(session)){
+ leave_function();
+ return -1;
+ }
packet_parse(session);
++i;
} while(r>0 && i<5);
+ leave_function();
return r;
}