From a3f34674c6317930362c99f0fc40d835234843e5 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 14 Feb 2019 20:51:41 +0100 Subject: [PATCH] Moved code around --- CMakeLists.txt | 4 +++- {src => bastion}/CMakeLists.txt | 3 ++- {src => bastion}/client.c | 0 {src => bastion}/client.h | 0 {src => bastion}/main.c | 0 {src => bastion}/proxy.c | 0 {src => bastion}/proxy.h | 0 {src => bastion}/recording.c | 0 {src => bastion}/recording.h | 0 {src => bastion}/session.c | 0 {src => bastion}/session.h | 0 {src => bastion}/state.c | 0 {src => bastion}/state.h | 0 common/CMakeLists.txt | 3 +++ {src => common}/mysql.c | 0 {src => common}/mysql.h | 0 config.h | 3 --- 17 files changed, 8 insertions(+), 5 deletions(-) rename {src => bastion}/CMakeLists.txt (76%) rename {src => bastion}/client.c (100%) rename {src => bastion}/client.h (100%) rename {src => bastion}/main.c (100%) rename {src => bastion}/proxy.c (100%) rename {src => bastion}/proxy.h (100%) rename {src => bastion}/recording.c (100%) rename {src => bastion}/recording.h (100%) rename {src => bastion}/session.c (100%) rename {src => bastion}/session.h (100%) rename {src => bastion}/state.c (100%) rename {src => bastion}/state.h (100%) create mode 100644 common/CMakeLists.txt rename {src => common}/mysql.c (100%) rename {src => common}/mysql.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3234c1..d542ec0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,5 +10,7 @@ set(CMAKE_C_FLAGS_RELEASE "-Os") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -g") option(LIBSSH_VERBOSE_OUTPOUT "whether or not verbose output for libssh mode is activated" OFF) +option(SESSION_RECORDING "whether or not recording feature based on lib termrec is activated" ON) -add_subdirectory(src) +add_subdirectory(bastion) +add_subdirectory(common) diff --git a/src/CMakeLists.txt b/bastion/CMakeLists.txt similarity index 76% rename from src/CMakeLists.txt rename to bastion/CMakeLists.txt index f885850..aab97e4 100644 --- a/src/CMakeLists.txt +++ b/bastion/CMakeLists.txt @@ -1,9 +1,10 @@ include_directories("${bastion_SOURCE_DIR}/termrec/libtty/") +include_directories("${bastion_SOURCE_DIR}/common") file(GLOB_RECURSE SOURCES *.c) add_executable(bastion ${SOURCES}) add_library(libtty.a STATIC IMPORTED) set_property(TARGET libtty.a PROPERTY IMPORTED_LOCATION "${bastion_SOURCE_DIR}/libtty.a") -target_link_libraries(bastion libtty.a) +target_link_libraries(bastion libtty.a common) target_link_libraries(bastion bz2 curl lzma mysqlclient pthread ssh z) diff --git a/src/client.c b/bastion/client.c similarity index 100% rename from src/client.c rename to bastion/client.c diff --git a/src/client.h b/bastion/client.h similarity index 100% rename from src/client.h rename to bastion/client.h diff --git a/src/main.c b/bastion/main.c similarity index 100% rename from src/main.c rename to bastion/main.c diff --git a/src/proxy.c b/bastion/proxy.c similarity index 100% rename from src/proxy.c rename to bastion/proxy.c diff --git a/src/proxy.h b/bastion/proxy.h similarity index 100% rename from src/proxy.h rename to bastion/proxy.h diff --git a/src/recording.c b/bastion/recording.c similarity index 100% rename from src/recording.c rename to bastion/recording.c diff --git a/src/recording.h b/bastion/recording.h similarity index 100% rename from src/recording.h rename to bastion/recording.h diff --git a/src/session.c b/bastion/session.c similarity index 100% rename from src/session.c rename to bastion/session.c diff --git a/src/session.h b/bastion/session.h similarity index 100% rename from src/session.h rename to bastion/session.h diff --git a/src/state.c b/bastion/state.c similarity index 100% rename from src/state.c rename to bastion/state.c diff --git a/src/state.h b/bastion/state.h similarity index 100% rename from src/state.h rename to bastion/state.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt new file mode 100644 index 0000000..8636758 --- /dev/null +++ b/common/CMakeLists.txt @@ -0,0 +1,3 @@ +file(GLOB_RECURSE SOURCES *.c) + +ADD_LIBRARY(common STATIC ${SOURCES}) diff --git a/src/mysql.c b/common/mysql.c similarity index 100% rename from src/mysql.c rename to common/mysql.c diff --git a/src/mysql.h b/common/mysql.h similarity index 100% rename from src/mysql.h rename to common/mysql.h diff --git a/config.h b/config.h index 2823095..6f773cb 100644 --- a/config.h +++ b/config.h @@ -14,11 +14,8 @@ #define MYSQL_PASS "graou" #define MYSQL_DB "sshportal" -#define SESSION_RECORDING // comment this to deactivate #define LOG_FILENAME_FORMAT "./log/$d/$h/$u/$i.gz" // $d : date in iso format, $h : hostname, $u : username : $i session id #define LOG_FILENAME_MAX_LEN 255 #define LOG_DIRECTORY_MODE S_IRUSR | S_IWUSR | S_IXUSR -#define LIBSSH_VERBOSE_OUTPOUT // comment this to deactivate - #endif