mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-05 20:55:46 +03:00
More work on the server side and sftp.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@9 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
|
||||||
subdirs = libssh/
|
subdirs = libssh/ sftp_server/
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
|
21
configure
vendored
21
configure
vendored
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.59 for libssh 0.11-dev .
|
# Generated by GNU Autoconf 2.59 for libssh 0.2-dev .
|
||||||
#
|
#
|
||||||
# Report bugs to <aris@0xbadc0de.be>.
|
# Report bugs to <aris@0xbadc0de.be>.
|
||||||
#
|
#
|
||||||
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='libssh'
|
PACKAGE_NAME='libssh'
|
||||||
PACKAGE_TARNAME='libssh'
|
PACKAGE_TARNAME='libssh'
|
||||||
PACKAGE_VERSION='0.11-dev '
|
PACKAGE_VERSION='0.2-dev '
|
||||||
PACKAGE_STRING='libssh 0.11-dev '
|
PACKAGE_STRING='libssh 0.2-dev '
|
||||||
PACKAGE_BUGREPORT='aris@0xbadc0de.be'
|
PACKAGE_BUGREPORT='aris@0xbadc0de.be'
|
||||||
|
|
||||||
ac_unique_file="sample.c"
|
ac_unique_file="sample.c"
|
||||||
@@ -780,7 +780,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures libssh 0.11-dev to adapt to many kinds of systems.
|
\`configure' configures libssh 0.2-dev to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -841,7 +841,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of libssh 0.11-dev :";;
|
short | recursive ) echo "Configuration of libssh 0.2-dev :";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -953,7 +953,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit 0
|
test -n "$ac_init_help" && exit 0
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
libssh configure 0.11-dev
|
libssh configure 0.2-dev
|
||||||
generated by GNU Autoconf 2.59
|
generated by GNU Autoconf 2.59
|
||||||
|
|
||||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||||
@@ -967,7 +967,7 @@ cat >&5 <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by libssh $as_me 0.11-dev , which was
|
It was created by libssh $as_me 0.2-dev , which was
|
||||||
generated by GNU Autoconf 2.59. Invocation command line was
|
generated by GNU Autoconf 2.59. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@@ -5060,7 +5060,7 @@ fi
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile libssh/Makefile"
|
ac_config_files="$ac_config_files Makefile libssh/Makefile sftp_server/Makefile"
|
||||||
|
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
# This file is a shell script that caches the results of configure
|
# This file is a shell script that caches the results of configure
|
||||||
@@ -5424,7 +5424,7 @@ _ASBOX
|
|||||||
} >&5
|
} >&5
|
||||||
cat >&5 <<_CSEOF
|
cat >&5 <<_CSEOF
|
||||||
|
|
||||||
This file was extended by libssh $as_me 0.11-dev , which was
|
This file was extended by libssh $as_me 0.2-dev , which was
|
||||||
generated by GNU Autoconf 2.59. Invocation command line was
|
generated by GNU Autoconf 2.59. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -5484,7 +5484,7 @@ _ACEOF
|
|||||||
|
|
||||||
cat >>$CONFIG_STATUS <<_ACEOF
|
cat >>$CONFIG_STATUS <<_ACEOF
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
libssh config.status 0.11-dev
|
libssh config.status 0.2-dev
|
||||||
configured by $0, generated by GNU Autoconf 2.59,
|
configured by $0, generated by GNU Autoconf 2.59,
|
||||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||||
|
|
||||||
@@ -5589,6 +5589,7 @@ do
|
|||||||
# Handling of arguments.
|
# Handling of arguments.
|
||||||
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||||
"libssh/Makefile" ) CONFIG_FILES="$CONFIG_FILES libssh/Makefile" ;;
|
"libssh/Makefile" ) CONFIG_FILES="$CONFIG_FILES libssh/Makefile" ;;
|
||||||
|
"sftp_server/Makefile" ) CONFIG_FILES="$CONFIG_FILES sftp_server/Makefile" ;;
|
||||||
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
||||||
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
|
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
|
||||||
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
|
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
|
||||||
|
@@ -56,5 +56,6 @@ AC_CHECK_FUNCS([endpwent gethostbyaddr gethostbyname getpass memmove memset \
|
|||||||
select socket strchr strdup strerror strstr poll])
|
select socket strchr strdup strerror strstr poll])
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
libssh/Makefile])
|
libssh/Makefile
|
||||||
|
sftp_server/Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
@@ -294,6 +294,7 @@ struct ssh_session {
|
|||||||
/* auths accepted by server */
|
/* auths accepted by server */
|
||||||
int auth_methods;
|
int auth_methods;
|
||||||
int hostkeys; /* contains type of host key wanted by client, in server impl */
|
int hostkeys; /* contains type of host key wanted by client, in server impl */
|
||||||
|
struct ssh_message *ssh_message; /* ssh message */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ssh_kbdint {
|
struct ssh_kbdint {
|
||||||
@@ -465,7 +466,7 @@ u64 ntohll(u64);
|
|||||||
#define htonll(x) ntohll(x)
|
#define htonll(x) ntohll(x)
|
||||||
|
|
||||||
/* channels1.c */
|
/* channels1.c */
|
||||||
CHANNEL *channel_open_session1(SSH_SESSION *session);
|
int channel_open_session1(CHANNEL *channel);
|
||||||
int channel_request_pty_size1(CHANNEL *channel, char *terminal,int cols,
|
int channel_request_pty_size1(CHANNEL *channel, char *terminal,int cols,
|
||||||
int rows);
|
int rows);
|
||||||
int channel_change_pty_size1(CHANNEL *channel, int cols, int rows);
|
int channel_change_pty_size1(CHANNEL *channel, int cols, int rows);
|
||||||
|
@@ -213,14 +213,14 @@ void dh_build_k(SSH_SESSION *session){
|
|||||||
#endif
|
#endif
|
||||||
bignum_ctx_free(ctx);
|
bignum_ctx_free(ctx);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
static void sha_add(STRING *str,SHACTX *ctx){
|
static void sha_add(STRING *str,SHACTX *ctx){
|
||||||
sha1_update(ctx,str,string_len(str)+4);
|
sha1_update(ctx,str,string_len(str)+4);
|
||||||
#ifdef DEBUG_CRYPTO
|
#ifdef DEBUG_CRYPTO
|
||||||
ssh_print_hexa("partial hashed sessionid",str,string_len(str)+4);
|
ssh_print_hexa("partial hashed sessionid",str,string_len(str)+4);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
void make_sessionid(SSH_SESSION *session){
|
void make_sessionid(SSH_SESSION *session){
|
||||||
SHACTX *ctx;
|
SHACTX *ctx;
|
||||||
STRING *num,*str;
|
STRING *num,*str;
|
||||||
|
@@ -34,7 +34,11 @@ MA 02111-1307, USA. */
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static SSH_MESSAGE *message_new(SSH_SESSION *session){
|
static SSH_MESSAGE *message_new(SSH_SESSION *session){
|
||||||
SSH_MESSAGE *msg=malloc(sizeof(SSH_MESSAGE));
|
SSH_MESSAGE *msg=session->ssh_message;
|
||||||
|
if(!msg){
|
||||||
|
msg=malloc(sizeof(SSH_MESSAGE));
|
||||||
|
session->ssh_message=msg;
|
||||||
|
}
|
||||||
memset(msg,0,sizeof (*msg));
|
memset(msg,0,sizeof (*msg));
|
||||||
msg->session=session;
|
msg->session=session;
|
||||||
return msg;
|
return msg;
|
||||||
@@ -402,5 +406,4 @@ void ssh_message_free(SSH_MESSAGE *msg){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memset(msg,0,sizeof(*msg));
|
memset(msg,0,sizeof(*msg));
|
||||||
free(msg);
|
|
||||||
}
|
}
|
||||||
|
@@ -375,7 +375,7 @@ static int packet_send1(SSH_SESSION *session){
|
|||||||
*/
|
*/
|
||||||
padding=blocksize-(currentlen % blocksize);
|
padding=blocksize-(currentlen % blocksize);
|
||||||
if(session->current_crypto)
|
if(session->current_crypto)
|
||||||
ssh_get_random(padstring,padding);
|
ssh_get_random(padstring,padding,0);
|
||||||
else
|
else
|
||||||
memset(padstring,0,padding);
|
memset(padstring,0,padding);
|
||||||
finallen=htonl(currentlen);
|
finallen=htonl(currentlen);
|
||||||
|
@@ -211,6 +211,8 @@ static int dh_handshake_server(SSH_SESSION *session){
|
|||||||
case TYPE_RSA:
|
case TYPE_RSA:
|
||||||
prv=session->rsa_key;
|
prv=session->rsa_key;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
prv=NULL;
|
||||||
}
|
}
|
||||||
pub=publickey_from_privatekey(prv);
|
pub=publickey_from_privatekey(prv);
|
||||||
pubkey=publickey_to_string(pub);
|
pubkey=publickey_to_string(pub);
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "libssh/libssh.h"
|
#include "libssh/libssh.h"
|
||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
|
#include "libssh/server.h"
|
||||||
#define FIRST_CHANNEL 42 // why not ? it helps to find bugs.
|
#define FIRST_CHANNEL 42 // why not ? it helps to find bugs.
|
||||||
|
|
||||||
SSH_SESSION *ssh_new() {
|
SSH_SESSION *ssh_new() {
|
||||||
@@ -72,6 +72,10 @@ void ssh_cleanup(SSH_SESSION *session){
|
|||||||
private_key_free(session->dsa_key);
|
private_key_free(session->dsa_key);
|
||||||
if(session->rsa_key)
|
if(session->rsa_key)
|
||||||
private_key_free(session->rsa_key);
|
private_key_free(session->rsa_key);
|
||||||
|
if(session->ssh_message){
|
||||||
|
ssh_message_free(session->ssh_message);
|
||||||
|
free(session->ssh_message);
|
||||||
|
}
|
||||||
memset(session,'X',sizeof(SSH_SESSION)); /* burn connection, it could hangs
|
memset(session,'X',sizeof(SSH_SESSION)); /* burn connection, it could hangs
|
||||||
sensitive datas */
|
sensitive datas */
|
||||||
free(session);
|
free(session);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/* don't look further if you believe this is just FTP over some tunnel. It IS different */
|
/* don't look further if you believe this is just FTP over some tunnel. It IS different */
|
||||||
/* This file contains code written by Nick Zitzmann */
|
/* This file contains code written by Nick Zitzmann */
|
||||||
/*
|
/*
|
||||||
Copyright 2003 Aris Adamantiadis
|
Copyright 2003-2005 Aris Adamantiadis
|
||||||
|
|
||||||
This file is part of the SSH Library
|
This file is part of the SSH Library
|
||||||
|
|
||||||
@@ -60,6 +60,16 @@ SFTP_SESSION *sftp_new(SSH_SESSION *session){
|
|||||||
return sftp;
|
return sftp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_SERVER
|
||||||
|
SFTP_SESSION *sftp_server_new(SSH_SESSION *session, CHANNEL *chan){
|
||||||
|
SFTP_SESSION *sftp=malloc(sizeof(SFTP_SESSION));
|
||||||
|
memset(sftp,0,sizeof(SFTP_SESSION));
|
||||||
|
sftp->session=session;
|
||||||
|
sftp->channel=chan;
|
||||||
|
return sftp;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
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);
|
||||||
|
@@ -140,6 +140,7 @@ int main(int argc, char **argv){
|
|||||||
if(i>0)
|
if(i>0)
|
||||||
write(1,buffer_get(buf),buffer_get_len(buf));
|
write(1,buffer_get(buf),buffer_get_len(buf));
|
||||||
} while (i>0);
|
} while (i>0);
|
||||||
|
ssh_disconnect(session);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user