aboutsummaryrefslogtreecommitdiff
path: root/libssh/options.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2005-08-07 10:48:08 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2005-08-07 10:48:08 +0000
commit5c26ae735483d140f802d58b1872b2fe9468d219 (patch)
treee8e8e8dea72c371e15f6e510ecc97948a4139383 /libssh/options.c
parent3113d8756628f463fda33b93801aee3c6ee9aa32 (diff)
downloadlibssh-5c26ae735483d140f802d58b1872b2fe9468d219.tar.gz
libssh-5c26ae735483d140f802d58b1872b2fe9468d219.tar.xz
libssh-5c26ae735483d140f802d58b1872b2fe9468d219.zip
server kex done :)
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@6 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/options.c')
-rw-r--r--libssh/options.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/libssh/options.c b/libssh/options.c
index bde7f5e4..e1c166d5 100644
--- a/libssh/options.c
+++ b/libssh/options.c
@@ -43,33 +43,37 @@ void ssh_options_set_port(SSH_OPTIONS *opt, unsigned int port){
opt->port=port&0xffff;
}
SSH_OPTIONS *ssh_options_copy(SSH_OPTIONS *opt){
- SSH_OPTIONS *ret=ssh_options_new();
+ SSH_OPTIONS *ret=ssh_options_new();
int i;
- ret->fd=opt->fd;
+ ret->fd=opt->fd;
ret->port=opt->port;
if(opt->username)
- ret->username=strdup(opt->username);
+ ret->username=strdup(opt->username);
if(opt->host)
- ret->host=strdup(opt->host);
+ ret->host=strdup(opt->host);
if(opt->bindaddr)
- ret->host=strdup(opt->bindaddr);
+ ret->host=strdup(opt->bindaddr);
if(opt->identity)
- ret->identity=strdup(opt->identity);
+ ret->identity=strdup(opt->identity);
if(opt->ssh_dir)
ret->ssh_dir=strdup(opt->ssh_dir);
- if(opt->known_hosts_file)
- ret->known_hosts_file=strdup(opt->known_hosts_file);
- for(i=0;i<10;++i)
- if(opt->wanted_methods[i])
- ret->wanted_methods[i]=strdup(opt->wanted_methods[i]);
- ret->passphrase_function=opt->passphrase_function;
- ret->connect_status_function=opt->connect_status_function;
- ret->connect_status_arg=opt->connect_status_arg;
- ret->timeout=opt->timeout;
- ret->timeout_usec=opt->timeout_usec;
+ if(opt->known_hosts_file)
+ ret->known_hosts_file=strdup(opt->known_hosts_file);
+ if(opt->dsakey)
+ ret->dsakey=strdup(opt->dsakey);
+ if(opt->rsakey)
+ ret->rsakey=strdup(opt->rsakey);
+ for(i=0;i<10;++i)
+ if(opt->wanted_methods[i])
+ ret->wanted_methods[i]=strdup(opt->wanted_methods[i]);
+ ret->passphrase_function=opt->passphrase_function;
+ ret->connect_status_function=opt->connect_status_function;
+ ret->connect_status_arg=opt->connect_status_arg;
+ ret->timeout=opt->timeout;
+ ret->timeout_usec=opt->timeout_usec;
ret->ssh2allowed=opt->ssh2allowed;
ret->ssh1allowed=opt->ssh1allowed;
- return ret;
+ return ret;
}
void ssh_options_free(SSH_OPTIONS *opt){
@@ -85,6 +89,10 @@ void ssh_options_free(SSH_OPTIONS *opt){
free(opt->bindaddr);
if(opt->ssh_dir)
free(opt->ssh_dir);
+ if(opt->dsakey)
+ free(opt->dsakey);
+ if(opt->rsakey)
+ free(opt->rsakey);
for(i=0;i<10;i++)
if(opt->wanted_methods[i])
free(opt->wanted_methods[i]);
@@ -142,6 +150,13 @@ void ssh_options_set_identity(SSH_OPTIONS *opt, char *identity){
opt->identity=strdup(buffer);
}
+void ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, char *dsakey){
+ opt->dsakey=strdup(dsakey);
+}
+void ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, char *rsakey){
+ opt->rsakey=strdup(rsakey);
+}
+
void ssh_options_set_banner(SSH_OPTIONS *opt, char *banner){
if(opt->banner)
free(opt->banner);