mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-31 00:03:07 +03:00
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:
@ -60,9 +60,11 @@ add_subdirectory(libssh)
|
|||||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||||
|
|
||||||
if (UNIX AND NOT WIN32)
|
if (UNIX AND NOT WIN32)
|
||||||
add_executable(samplessh sample.c)
|
if (WITH_SFTP AND WITH_SERVER)
|
||||||
add_executable(samplesshd samplesshd.c)
|
add_executable(samplessh sample.c)
|
||||||
|
add_executable(samplesshd samplesshd.c)
|
||||||
|
|
||||||
target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY})
|
||||||
target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
endif (WITH_SFTP AND WITH_SERVER)
|
||||||
endif (UNIX AND NOT WIN32)
|
endif (UNIX AND NOT WIN32)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
option(WITH_LIBZ "Build with ZLIB support" ON)
|
option(WITH_LIBZ "Build with ZLIB support" ON)
|
||||||
option(WITH_SSH1 "Build with SSH1 support" OFF)
|
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_SERVER "Build with SSH server support" ON)
|
||||||
option(WITH_STATIC_LIB "Build with a static library" OFF)
|
option(WITH_STATIC_LIB "Build with a static library" OFF)
|
||||||
option(WITH_DEBUG_CRYPTO "Build with cryto debut output" OFF)
|
option(WITH_DEBUG_CRYPTO "Build with cryto debut output" OFF)
|
||||||
|
@ -62,6 +62,9 @@
|
|||||||
/* Define to 1 if you want to enable ZLIB */
|
/* Define to 1 if you want to enable ZLIB */
|
||||||
#cmakedefine WITH_LIBZ 1
|
#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 */
|
/* Define to 1 if you want to enable SSH1 */
|
||||||
#cmakedefine WITH_SSH1 1
|
#cmakedefine WITH_SSH1 1
|
||||||
|
|
||||||
|
@ -3,11 +3,23 @@ project(libssh-headers C)
|
|||||||
set(libssh_HDRS
|
set(libssh_HDRS
|
||||||
libssh.h
|
libssh.h
|
||||||
crypto.h
|
crypto.h
|
||||||
sftp.h
|
|
||||||
ssh1.h
|
|
||||||
ssh2.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)
|
if (WITH_SERVER)
|
||||||
set(libssh_HDRS
|
set(libssh_HDRS
|
||||||
${libssh_HDRS}
|
${libssh_HDRS}
|
||||||
|
@ -85,13 +85,25 @@ set(libssh_SRCS
|
|||||||
options.c
|
options.c
|
||||||
packet.c
|
packet.c
|
||||||
session.c
|
session.c
|
||||||
sftp.c
|
|
||||||
sftpserver.c
|
|
||||||
socket.c
|
socket.c
|
||||||
string.c
|
string.c
|
||||||
wrapper.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)
|
if (WITH_SSH1)
|
||||||
set(libssh_SRCS
|
set(libssh_SRCS
|
||||||
${libssh_SRCS}
|
${libssh_SRCS}
|
||||||
|
@ -36,7 +36,8 @@
|
|||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
#include "libssh/ssh2.h"
|
#include "libssh/ssh2.h"
|
||||||
#include "libssh/sftp.h"
|
#include "libssh/sftp.h"
|
||||||
#ifndef NO_SFTP
|
|
||||||
|
#ifdef WITH_SFTP
|
||||||
|
|
||||||
#define sftp_enter_function() _enter_function(sftp->channel->session)
|
#define sftp_enter_function() _enter_function(sftp->channel->session)
|
||||||
#define sftp_leave_function() _leave_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;
|
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);
|
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 */
|
/* it's just a proof of concept code for sftp, till i write a real documentation about it */
|
||||||
void do_sftp(SSH_SESSION *session){
|
void do_sftp(SSH_SESSION *session){
|
||||||
SFTP_SESSION *sftp_session=sftp_new(session);
|
SFTP_SESSION *sftp_session=sftp_new(session);
|
||||||
@ -362,6 +363,7 @@ void do_sftp(SSH_SESSION *session){
|
|||||||
sftp_free(sftp_session);
|
sftp_free(sftp_session);
|
||||||
printf("session sftp termin<69>\n");
|
printf("session sftp termin<69>\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int auth_kbdint(SSH_SESSION *session){
|
static int auth_kbdint(SSH_SESSION *session){
|
||||||
int err=ssh_userauth_kbdint(session,NULL,NULL);
|
int err=ssh_userauth_kbdint(session,NULL,NULL);
|
||||||
|
Reference in New Issue
Block a user