aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-27 10:58:29 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-27 10:58:29 +0000
commitc1c4f299ff8881fe0c8d51790d49bfb5fcd632df (patch)
treeb6d448bb156f7d4025778e5f76740ab7edb30dac
parent99946c7bcc3be1a48e2546254e3c7e9ca8375412 (diff)
downloadlibssh-c1c4f299ff8881fe0c8d51790d49bfb5fcd632df.tar.gz
libssh-c1c4f299ff8881fe0c8d51790d49bfb5fcd632df.tar.xz
libssh-c1c4f299ff8881fe0c8d51790d49bfb5fcd632df.zip
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
-rw-r--r--CMakeLists.txt10
-rw-r--r--DefineOptions.cmake1
-rw-r--r--config.h.cmake3
-rw-r--r--include/libssh/CMakeLists.txt16
-rw-r--r--libssh/CMakeLists.txt16
-rw-r--r--libssh/sftp.c5
-rw-r--r--sample.c4
7 files changed, 44 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 36587c5..f31ddf0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/DefineOptions.cmake b/DefineOptions.cmake
index cec5d6b..d482e19 100644
--- a/DefineOptions.cmake
+++ b/DefineOptions.cmake
@@ -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)
diff --git a/config.h.cmake b/config.h.cmake
index 2ff415e..e941d10 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -63,6 +63,9 @@
#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
/* Define to 1 if you want to enable server support */
diff --git a/include/libssh/CMakeLists.txt b/include/libssh/CMakeLists.txt
index af7b2eb..2b9fac6 100644
--- a/include/libssh/CMakeLists.txt
+++ b/include/libssh/CMakeLists.txt
@@ -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}
diff --git a/libssh/CMakeLists.txt b/libssh/CMakeLists.txt
index e3ee26b..260d743 100644
--- a/libssh/CMakeLists.txt
+++ b/libssh/CMakeLists.txt
@@ -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}
diff --git a/libssh/sftp.c b/libssh/sftp.c
index a32b1cc..55dd93f 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -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 */
diff --git a/sample.c b/sample.c
index c5e1113..13f4e92 100644
--- a/sample.c
+++ b/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´┐Ż\n");
}
+#endif
static int auth_kbdint(SSH_SESSION *session){
int err=ssh_userauth_kbdint(session,NULL,NULL);