aboutsummaryrefslogtreecommitdiff
path: root/libssh/session.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-10-02 14:06:41 +0200
committerAndreas Schneider <mail@cynapses.org>2009-10-02 20:26:14 +0200
commitab5b4c7cfe668ee4103de146c2a739532abfc416 (patch)
treeec30d19a18400dbfa0f94bf90262d2c439c724aa /libssh/session.c
parente78334688fa510a5c859b0367d4d4779efae518a (diff)
downloadlibssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.tar.gz
libssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.tar.xz
libssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.zip
Get rid of the options structure.
Diffstat (limited to 'libssh/session.c')
-rw-r--r--libssh/session.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/libssh/session.c b/libssh/session.c
index 2524560..2ba628e 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -27,12 +27,10 @@
#include "libssh/libssh.h"
#include "libssh/priv.h"
#include "libssh/server.h"
-#include "libssh/callback.h"
#include "libssh/socket.h"
#include "libssh/agent.h"
#include "libssh/packet.h"
#include "libssh/session.h"
-#include "libssh/options.h"
#include "libssh/misc.h"
#define FIRST_CHANNEL 42 // why not ? it helps to find bugs.
@@ -60,17 +58,11 @@ ssh_session ssh_new(void) {
goto err;
}
- session->maxchannel = FIRST_CHANNEL;
session->socket = ssh_socket_new(session);
if (session->socket == NULL) {
goto err;
}
- session->alive = 0;
- session->auth_methods = 0;
- session->blocking = 1;
- session->log_indent = 0;
-
session->out_buffer = buffer_new();
if (session->out_buffer == NULL) {
goto err;
@@ -81,6 +73,22 @@ ssh_session ssh_new(void) {
goto err;
}
+ session->alive = 0;
+ session->auth_methods = 0;
+ session->blocking = 1;
+ session->log_indent = 0;
+ session->maxchannel = FIRST_CHANNEL;
+
+ /* options */
+ session->port = 22;
+ session->fd = -1;
+ session->ssh2 = 1;
+#ifdef WITH_SSH1
+ session->ssh1 = 1;
+#else
+ session->ssh1 = 0;
+#endif
+
#ifndef _WIN32
session->agent = agent_new(session);
if (session->agent == NULL) {
@@ -142,12 +150,23 @@ void ssh_cleanup(ssh_session session) {
}
ssh_list_free(session->ssh_message_list);
}
- ssh_options_free(session->options);
+
+ /* options */
+ SAFE_FREE(session->username);
+ SAFE_FREE(session->host);
+ SAFE_FREE(session->identity);
+ SAFE_FREE(session->sshdir);
+ SAFE_FREE(session->knownhosts);
+
+ for (i = 0; i < 10; i++) {
+ if (session->wanted_methods[i]) {
+ SAFE_FREE(session->wanted_methods[i]);
+ }
+ }
/* burn connection, it could hang sensitive datas */
ZERO_STRUCTP(session);
SAFE_FREE(session);
- /* FIXME: leave_function(); ??? */
}
/** \brief disconnect impolitely from remote host
@@ -177,8 +196,7 @@ void ssh_set_options(ssh_session session, ssh_options options) {
return;
}
- session->options = options;
- session->log_verbosity = options->log_verbosity;
+ return;
}
/** \brief set the session in blocking/nonblocking mode