aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ConfigureChecks.cmake4
-rw-r--r--DefineOptions.cmake1
-rw-r--r--config.h.cmake3
-rw-r--r--include/libssh/CMakeLists.txt20
-rw-r--r--include/libssh/sftp.h4
-rw-r--r--libssh/sftp.c4
6 files changed, 29 insertions, 7 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index f82a1557..bbba27ce 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -58,3 +58,7 @@ if (WITH_SSH1)
set(WITH_SSH1 1)
endif (WITH_SSH1)
+if (WITH_SERVER)
+ set(WITH_SERVER 1)
+endif (WITH_SERVER)
+
diff --git a/DefineOptions.cmake b/DefineOptions.cmake
index 20301fc8..91ce25f7 100644
--- a/DefineOptions.cmake
+++ b/DefineOptions.cmake
@@ -1,3 +1,4 @@
option(WITH_LIBZ "Build with ZLIB support" ON)
option(WITH_SSH1 "Build with SSH1 support" OFF)
+option(WITH_SERVER "Build with SSH server support" ON)
option(WITH_STATIC_LIB "Build with a static library" OFF)
diff --git a/config.h.cmake b/config.h.cmake
index d08a583a..de60ccc1 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -65,6 +65,9 @@
/* Define to 1 if you want to enable SSH1 */
#cmakedefine WITH_SSH1 1
+/* Define to 1 if you want to enable server support */
+#cmakedefine WITH_SERVER 1
+
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
diff --git a/include/libssh/CMakeLists.txt b/include/libssh/CMakeLists.txt
index bfbebdd8..dc67ab96 100644
--- a/include/libssh/CMakeLists.txt
+++ b/include/libssh/CMakeLists.txt
@@ -3,18 +3,32 @@ project(libssh-headers C)
set(libssh_HDRS
libssh.h
crypto.h
- server.h
sftp.h
ssh1.h
ssh2.h
)
-INSTALL(
+install(
FILES
${libssh_HDRS}
DESTINATION
${INCLUDE_INSTALL_DIR}/${APPLICATION_NAME}
COMPONENT
- libraries
+ headers
)
+if (WITH_SERVER)
+ set(server_HDRS
+ server.h
+ )
+
+ install(
+ FILES
+ ${server_HDRS}
+ DESTINATION
+ ${INCLUDE_INSTALL_DIR}/${APPLICATION_NAME}
+ COMPONENT
+ libraries
+ )
+endif (WITH_SERVER)
+
diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index 729f0ec9..ca549e35 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -607,7 +607,7 @@ char *sftp_canonicalize_path(SFTP_SESSION *sftp, const char *path);
*/
int sftp_server_version(SFTP_SESSION *sftp);
-#ifndef NO_SERVER
+#ifdef WITH_SERVER
/**
* @brief Create a new sftp server session.
*
@@ -627,7 +627,7 @@ SFTP_SESSION *sftp_server_new(SSH_SESSION *session, CHANNEL *chan);
* @return 0 on success, < 0 on error.
*/
int sftp_server_init(SFTP_SESSION *sftp);
-#endif
+#endif /* WITH_SERVER */
/* this is not a public interface */
#define SFTP_HANDLES 256
diff --git a/libssh/sftp.c b/libssh/sftp.c
index a078d926..c6f7b5df 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -59,7 +59,7 @@ SFTP_SESSION *sftp_new(SSH_SESSION *session){
return sftp;
}
-#ifndef NO_SERVER
+#ifdef WITH_SERVER
SFTP_SESSION *sftp_server_new(SSH_SESSION *session, CHANNEL *chan){
SFTP_SESSION *sftp=malloc(sizeof(SFTP_SESSION));
memset(sftp,0,sizeof(SFTP_SESSION));
@@ -110,7 +110,7 @@ int sftp_server_init(SFTP_SESSION *sftp){
sftp_leave_function();
return 0;
}
-#endif
+#endif /* WITH_SERVER */
void sftp_free(SFTP_SESSION *sftp){
struct request_queue *ptr;