Add option to build with or without sftp support.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@618 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
parent
99946c7bcc
commit
c1c4f299ff
@ -60,9 +60,11 @@ add_subdirectory(libssh)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
if (UNIX AND NOT WIN32)
|
||||
add_executable(samplessh sample.c)
|
||||
add_executable(samplesshd samplesshd.c)
|
||||
if (WITH_SFTP AND WITH_SERVER)
|
||||
add_executable(samplessh sample.c)
|
||||
add_executable(samplesshd samplesshd.c)
|
||||
|
||||
target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY})
|
||||
target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY})
|
||||
target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY})
|
||||
target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY})
|
||||
endif (WITH_SFTP AND WITH_SERVER)
|
||||
endif (UNIX AND NOT WIN32)
|
||||
|
@ -1,5 +1,6 @@
|
||||
option(WITH_LIBZ "Build with ZLIB support" ON)
|
||||
option(WITH_SSH1 "Build with SSH1 support" OFF)
|
||||
option(WITH_SFTP "Build with SFTP support" ON)
|
||||
option(WITH_SERVER "Build with SSH server support" ON)
|
||||
option(WITH_STATIC_LIB "Build with a static library" OFF)
|
||||
option(WITH_DEBUG_CRYPTO "Build with cryto debut output" OFF)
|
||||
|
@ -62,6 +62,9 @@
|
||||
/* Define to 1 if you want to enable ZLIB */
|
||||
#cmakedefine WITH_LIBZ 1
|
||||
|
||||
/* Define to 1 if you want to enable SSH1 */
|
||||
#cmakedefine WITH_SFTP 1
|
||||
|
||||
/* Define to 1 if you want to enable SSH1 */
|
||||
#cmakedefine WITH_SSH1 1
|
||||
|
||||
|
@ -3,11 +3,23 @@ project(libssh-headers C)
|
||||
set(libssh_HDRS
|
||||
libssh.h
|
||||
crypto.h
|
||||
sftp.h
|
||||
ssh1.h
|
||||
ssh2.h
|
||||
)
|
||||
|
||||
if (WITH_SFTP)
|
||||
set(libssh_HDRS
|
||||
${libssh_HDRS}
|
||||
sftp.h
|
||||
)
|
||||
endif (WITH_SFTP)
|
||||
|
||||
if (WITH_SSH1)
|
||||
set(libssh_HDRS
|
||||
${libssh_HDRS}
|
||||
ssh1.h
|
||||
)
|
||||
endif (WITH_SSH1)
|
||||
|
||||
if (WITH_SERVER)
|
||||
set(libssh_HDRS
|
||||
${libssh_HDRS}
|
||||
|
@ -85,13 +85,25 @@ set(libssh_SRCS
|
||||
options.c
|
||||
packet.c
|
||||
session.c
|
||||
sftp.c
|
||||
sftpserver.c
|
||||
socket.c
|
||||
string.c
|
||||
wrapper.c
|
||||
)
|
||||
|
||||
if (WITH_SFTP)
|
||||
set(libssh_SRCS
|
||||
${libssh_SRCS}
|
||||
sftp.c
|
||||
)
|
||||
|
||||
if (WITH_SERVER)
|
||||
set(libssh_SRCS
|
||||
${libssh_SRCS}
|
||||
sftpserver.c
|
||||
)
|
||||
endif (WITH_SERVER)
|
||||
endif (WITH_SFTP)
|
||||
|
||||
if (WITH_SSH1)
|
||||
set(libssh_SRCS
|
||||
${libssh_SRCS}
|
||||
|
@ -36,7 +36,8 @@
|
||||
#include "libssh/priv.h"
|
||||
#include "libssh/ssh2.h"
|
||||
#include "libssh/sftp.h"
|
||||
#ifndef NO_SFTP
|
||||
|
||||
#ifdef WITH_SFTP
|
||||
|
||||
#define sftp_enter_function() _enter_function(sftp->channel->session)
|
||||
#define sftp_leave_function() _leave_function(sftp->channel->session)
|
||||
@ -2387,5 +2388,5 @@ SFTP_ATTRIBUTES *sftp_fstat(SFTP_FILE *file) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* NO_SFTP */
|
||||
#endif /* WITH_SFTP */
|
||||
|
||||
|
4
sample.c
4
sample.c
@ -273,7 +273,8 @@ static void batch_shell(SSH_SESSION *session){
|
||||
}
|
||||
select_loop(session,channel);
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_SFTP
|
||||
/* it's just a proof of concept code for sftp, till i write a real documentation about it */
|
||||
void do_sftp(SSH_SESSION *session){
|
||||
SFTP_SESSION *sftp_session=sftp_new(session);
|
||||
@ -362,6 +363,7 @@ void do_sftp(SSH_SESSION *session){
|
||||
sftp_free(sftp_session);
|
||||
printf("session sftp termin<69>\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
static int auth_kbdint(SSH_SESSION *session){
|
||||
int err=ssh_userauth_kbdint(session,NULL,NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user