summaryrefslogtreecommitdiffstats
path: root/samplesshd.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2009-10-05 10:01:24 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2009-10-05 10:01:24 +0200
commit40778d4ba94ab5bfbe71bd3a304d6664c9a02560 (patch)
tree5864e2c4bda6c2d1782ef0ba765a40fcd8b8e8c5 /samplesshd.c
parenta3a7f17d0f971edce873970863cfe660b21d8f57 (diff)
parent60d6954b7560df62634b305fec65dffbc98ff0b8 (diff)
Merge branch 'master' of git://git.libssh.org/projects/libssh/libssh
Diffstat (limited to 'samplesshd.c')
-rw-r--r--samplesshd.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/samplesshd.c b/samplesshd.c
index 9d6e3bb0..9cd9449b 100644
--- a/samplesshd.c
+++ b/samplesshd.c
@@ -25,11 +25,13 @@ MA 02111-1307, USA. */
#include <unistd.h>
#include <string.h>
#include <stdio.h>
+#ifndef KEYS_FOLDER
#ifdef _WIN32
#define KEYS_FOLDER
#else
#define KEYS_FOLDER "/etc/ssh/"
#endif
+#endif
static int auth_password(char *user, char *password){
if(strcmp(user,"aris"))
@@ -40,29 +42,28 @@ static int auth_password(char *user, char *password){
}
int main(int argc, char **argv){
- ssh_options options=ssh_options_new();
ssh_session session;
- SSH_BIND *ssh_bind;
+ ssh_bind ssh_bind_o;
ssh_message message;
ssh_channel chan=0;
ssh_buffer buf;
int auth=0;
int sftp=0;
int i;
- ssh_options_getopt(options, &argc, argv);
- ssh_options_set(options, SSH_OPTIONS_SERVER_DSAKEY, KEYS_FOLDER "ssh_host_dsa_key");
- ssh_options_set(options, SSH_OPTIONS_SERVER_RSAKEY, KEYS_FOLDER "ssh_host_rsa_key");
+ ssh_bind_o=ssh_bind_new();
+// ssh_options_getopt(options, &argc, argv);
+ ssh_bind_options_set(ssh_bind_o, SSH_BIND_OPTIONS_DSAKEY, KEYS_FOLDER "ssh_host_dsa_key");
+ ssh_bind_options_set(ssh_bind_o, SSH_BIND_OPTIONS_RSAKEY, KEYS_FOLDER "ssh_host_rsa_key");
- ssh_bind=ssh_bind_new();
- ssh_bind_set_options(ssh_bind,options);
- if(ssh_bind_listen(ssh_bind)<0){
- printf("Error listening to socket: %s\n",ssh_get_error(ssh_bind));
+// ssh_bind_set_options(ssh_bind_o,options);
+ if(ssh_bind_listen(ssh_bind_o)<0){
+ printf("Error listening to socket: %s\n",ssh_get_error(ssh_bind_o));
return 1;
}
- session=ssh_bind_accept(ssh_bind);
+ session=ssh_bind_accept(ssh_bind_o);
if(!session){
- printf("error accepting a connection : %s\n",ssh_get_error(ssh_bind));
+ printf("error accepting a connection : %s\n",ssh_get_error(ssh_bind_o));
return 1;
}
printf("Socket connected: fd = %d\n", ssh_get_fd(session));
@@ -153,7 +154,7 @@ int main(int argc, char **argv){
} while (i>0);
buffer_free(buf);
ssh_disconnect(session);
- ssh_bind_free(ssh_bind);
+ ssh_bind_free(ssh_bind_o);
ssh_finalize();
return 0;
}