From b34f321cd1f427b99f03f29246321f0cf76c76f5 Mon Sep 17 00:00:00 2001 From: Kaian Date: Sun, 29 Jul 2018 10:57:34 +0200 Subject: [PATCH] ssl: rename compile flag to WITH_SSL --- CMakeLists.txt | 52 +++++++++++++++++++++++++++++-------------- src/capture/capture.c | 2 +- src/config.h.cmake.in | 4 +--- src/filter.c | 2 +- src/main.c | 20 +++++------------ src/setting.c | 2 +- src/setting.h | 2 +- 7 files changed, 46 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5281faa..08eec1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,9 @@ configure_file( ) include_directories(${CMAKE_SOURCE_DIR}/src) +include_directories(${CMAKE_SOURCE_DIR}/src/curses) +include_directories(${CMAKE_SOURCE_DIR}/src/curses/widgets) +include_directories(${CMAKE_SOURCE_DIR}/src/curses/screens) set(SOURCES src/packet/address.c @@ -30,21 +33,21 @@ set(SOURCES src/capture/capture.c src/capture/capture_pcap.c src/capture/capture_txt.c - src/curses/scrollbar.c - src/curses/ui_call_flow.c - src/curses/ui_call_list.c - src/curses/ui_call_raw.c - src/curses/ui_column_select.c - src/curses/ui_filter.c src/curses/ui_manager.c - src/curses/ui_msg_diff.c - src/curses/ui_panel.c - src/curses/ui_save.c - src/curses/ui_settings.c - src/curses/ui_stats.c + src/curses/screens/ui_call_flow.c + src/curses/screens/ui_call_list.c + src/curses/screens/ui_call_raw.c + src/curses/screens/ui_column_select.c + src/curses/screens/ui_filter.c + src/curses/screens/ui_msg_diff.c + src/curses/screens/ui_save.c + src/curses/screens/ui_settings.c + src/curses/screens/ui_stats.c + src/curses/screens/ui_panel.c + src/curses/keybinding.c + src/curses/scrollbar.c src/filter.c src/group.c - src/keybinding.c src/main.c src/option.c src/stream.c @@ -59,7 +62,7 @@ set(SOURCES ###################################################################### # HEP Support -option (USE_HEP "Enable EEP/HEP Support" ON) +option (USE_HEP "Enable EEP/HEP Support" OFF) if (USE_HEP) set(SOURCES ${SOURCES} src/capture/capture_hep.c) endif (USE_HEP) @@ -68,7 +71,7 @@ endif (USE_HEP) option (USE_IPV6 "Enable IPv6 Support" ON) # GnuTLS Support -option (WITH_SSL "Enable SSL Support (TLS SIP Transport)" ON) +option (WITH_SSL "Enable SSL Support (TLS SIP Transport)" OFF) if (WITH_SSL) set(SOURCES ${SOURCES} src/packet/dissectors/packet_tls.c) endif(WITH_SSL) @@ -78,15 +81,20 @@ add_executable(sngrep ${SOURCES}) target_link_libraries(sngrep pcap) find_package(PkgConfig REQUIRED) -pkg_check_modules(CURSES REQUIRED ncursesw) +pkg_check_modules(CURSES REQUIRED ncursesw menuw panelw formw) include_directories(${CURSES_INCLUDE_DIR}) -target_link_libraries(sngrep ${CURSES_LIBRARIES} menu panel form) +target_link_libraries(sngrep ${CURSES_LIBRARIES} ) find_package(PkgConfig REQUIRED) pkg_check_modules(GLIB REQUIRED glib-2.0) include_directories(${GLIB_INCLUDE_DIRS}) target_link_libraries(sngrep ${GLIB_LIBRARIES}) +find_package(PkgConfig REQUIRED) +pkg_check_modules(GOBJECT REQUIRED gobject-2.0) +include_directories(${GOBJECT_INCLUDE_DIRS}) +target_link_libraries(sngrep ${GOBJECT_LIBRARIES}) + find_package(PkgConfig REQUIRED) find_package (Threads) target_link_libraries (sngrep ${CMAKE_THREAD_LIBS_INIT}) @@ -101,6 +109,16 @@ endif(WITH_SSL) ###################################################################### add_definitions(-D_GNU_SOURCE) +add_definitions(-D_XOPEN_SOURCE_EXTENDED) + +###################################################################### +ADD_CUSTOM_COMMAND(OUTPUT src/curses/gnt/gntmarshal.h src/curses/gnt/gntmarshal.c + WORKING_DIRECTORY src/curses/gnt/ + COMMAND glib-genmarshal --body --prefix=gnt_closure_marshal genmarshal > gntmarshal.c + COMMAND glib-genmarshal --header --prefix=gnt_closure_marshal genmarshal > gntmarshal.h + DEPENDS "src/curses/widgets/genmarshal" + VERBATIM + COMMENT "Generating GObject Marshal code...") ###################################################################### # Print Logo @@ -121,7 +139,7 @@ message(" ") message(" sngrep configure finished ") message(" ====================================================== ") message(" SSL Support : ${WITH_SSL} ") +message(" HEP Support : ${USE_HEP} ") message(" IPv6 Support : ${USE_IPV6} ") -message(" EEP Support : ${USE_EEP} ") message(" ====================================================== ") message(" ") diff --git a/src/capture/capture.c b/src/capture/capture.c index 424e099..5a03a48 100644 --- a/src/capture/capture.c +++ b/src/capture/capture.c @@ -42,7 +42,7 @@ capture_manager_new() manager->queue = g_async_queue_new(); manager->paused = FALSE; -#if defined(WITH_GNUTLS) || defined(WITH_OPENSSL) +#ifdef WITH_SSL // Parse TLS Server setting manager->tlsserver = address_from_str(setting_get_value(SETTING_CAPTURE_TLSSERVER)); #endif diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in index 3087d24..db3bf05 100644 --- a/src/config.h.cmake.in +++ b/src/config.h.cmake.in @@ -35,9 +35,7 @@ #cmakedefine USE_IPV6 -#cmakedefine WITH_GNUTLS - -#cmakedefine WITH_OPENSSL +#cmakedefine WITH_SSL #endif //SNGREP_CONFIG_H diff --git a/src/filter.c b/src/filter.c index e5092b2..05e592c 100644 --- a/src/filter.c +++ b/src/filter.c @@ -32,7 +32,7 @@ #include #include "glib-utils.h" #include "storage.h" -#include "curses/ui_call_list.h" +#include "ui_call_list.h" #include "filter.h" //! Storage of filter information diff --git a/src/main.c b/src/main.c index 751e35e..3c8816e 100644 --- a/src/main.c +++ b/src/main.c @@ -34,7 +34,7 @@ #ifdef USE_HEP #include "capture/capture_hep.h" #endif -#ifdef WITH_GNUTLS +#ifdef WITH_SSL #include "packet/dissectors/packet_tls.h" #endif @@ -47,15 +47,9 @@ print_version_info() "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" -#ifdef WITH_GNUTLS +#ifdef WITH_SSL " * Compiled with GnuTLS support.\n" #endif -#ifdef WITH_OPENSSL - " * Compiled with OpenSSL support.\n" -#endif -#ifdef WITH_UNICODE - " * Compiled with Wide-character support.\n" -#endif #ifdef USE_IPV6 " * Compiled with IPv6 support.\n" #endif @@ -95,7 +89,7 @@ main(int argc, char* argv[]) CaptureOutput *output; GOptionEntry main_entries[] = { - { "version",'V', 0, G_OPTION_ARG_CALLBACK, &version, + { "version",'V', 0, G_OPTION_ARG_NONE, &version, "Version information", NULL }, { "device", 'd', 0, G_OPTION_ARG_STRING_ARRAY, &input_devices, "Use this capture device instead of default", "DEVICE" }, @@ -125,7 +119,7 @@ main(int argc, char* argv[]) "Read configuration from FILE", "FILE" }, { "no-config", 'F', 0, G_OPTION_ARG_NONE, &no_config, "Do not read configuration from default config file", NULL }, -#ifdef WITH_GNUTLS +#ifdef WITH_SSL { "keyfile", 'k', 0, G_OPTION_ARG_FILENAME, &keyfile, "RSA private keyfile to decrypt captured packets", "KEYFILE" }, #endif @@ -181,7 +175,7 @@ main(int argc, char* argv[]) if (!storage_copts.outfile) storage_copts.outfile = g_strdup(setting_get_value(SETTING_CAPTURE_OUTFILE)); -#ifdef WITH_GNUTLS +#ifdef WITH_SSL if (!keyfile) keyfile = g_strdup(setting_get_value(SETTING_CAPTURE_KEYFILE)); #endif @@ -226,7 +220,7 @@ main(int argc, char* argv[]) #endif -#ifdef WITH_GNUTLS +#ifdef WITH_SSL if (keyfile) { // Check if we have a keyfile and is valid if (!tls_check_keyfile(keyfile, &error)) { @@ -241,8 +235,6 @@ main(int argc, char* argv[]) // Old legacy option to open pcaps without other arguments if (argc == 2 && g_file_test(argv[1], G_FILE_TEST_EXISTS)) { - g_print("%s seems to be a file: Use -I flag or press any key to read its contents.\n", argv[1]); - getchar(); // Read as a PCAP file if ((input = capture_input_pcap_offline(argv[1], &error))) { capture_manager_add_input(manager, input); diff --git a/src/setting.c b/src/setting.c index fb26262..721de56 100644 --- a/src/setting.c +++ b/src/setting.c @@ -46,7 +46,7 @@ setting_t settings[SETTING_COUNT] = { { SETTING_CAPTURE_LIMIT, "capture.limit", SETTING_FMT_NUMBER, "20000", NULL }, { SETTING_CAPTURE_DEVICE, "capture.device", SETTING_FMT_STRING, "any", NULL }, { SETTING_CAPTURE_OUTFILE, "capture.outfile", SETTING_FMT_STRING, "", NULL }, -#if defined(WITH_GNUTLS) || defined(WITH_OPENSSL) +#ifdef WITH_SSL { SETTING_CAPTURE_KEYFILE, "capture.keyfile", SETTING_FMT_STRING, "", NULL }, { SETTING_CAPTURE_TLSSERVER, "capture.tlsserver", SETTING_FMT_STRING, "", NULL }, #endif diff --git a/src/setting.h b/src/setting.h index 3b6e1dd..9480062 100644 --- a/src/setting.h +++ b/src/setting.h @@ -82,7 +82,7 @@ enum setting_id { SETTING_CAPTURE_LIMIT, SETTING_CAPTURE_DEVICE, SETTING_CAPTURE_OUTFILE, -#if defined(WITH_GNUTLS) || defined(WITH_OPENSSL) +#ifdef WITH_SSL SETTING_CAPTURE_KEYFILE, SETTING_CAPTURE_TLSSERVER, #endif