summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt46
-rw-r--r--include/ast_video_puller.hpp6
-rw-r--r--include/ssl_key_handler.hpp11
-rw-r--r--include/web_kvm.hpp5
-rw-r--r--src/getvideo_main.cpp2
-rw-r--r--src/msan_test.cpp7
-rw-r--r--src/ssl_key_handler_test.cpp1
-rw-r--r--src/webserver_main.cpp15
8 files changed, 49 insertions, 44 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 37aa601909..e80c6c1f6d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,9 +13,17 @@ SET(BUILD_SHARED_LIBRARIES OFF)
#SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
+#-fsanitize-memory-track-origins=2 -fno-omit-frame-pointer
+SET(MSAN_CXX_FLAGS "-fsanitize=memory -stdlib=libc++ -I/home/ed/libcxx_msan/include -I/home/ed/libcxx_msan/include/c++/v1")
+SET(MSAN_LINKER_EXE_FLAGS "${MSAN_CXX_FLAGS} -lc++abi -L/home/ed/libcxx_msan/lib -Wl,-rpath,I/home/ed/libcxx_msan/lib")
+
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MSAN_CXX_FLAGS}")
+#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSAN_LINKER_EXE_FLAGS}")
+
+
+message("CMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}")
+message("MSAN_CXX_FLAGS=${MSAN_CXX_FLAGS}")
-#SET(MSAN_CXX_FLAGS "-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -stdlib=libc++ -I/home/ed/libcxx_msan/include -I/home/ed/libcxx_msan/include/c++/v1")
-#SET(MSAN_LINKER_EXE_FLAGS "${MSAN_CXX_FLAGS} -lc++abi -L/home/ed/libcxx_msan/lib")
include("cmake/HunterGate.cmake")
#HunterGate(
# URL "https://github.com/ruslo/hunter/archive/v0.16.31.tar.gz"
@@ -31,8 +39,7 @@ option(BUILD_FOR_EMBEDDED "Build for device target" ON)
project(bmc-webserver CXX C)
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${MSAN_CXX_FLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS "${MSAN_LINKER_EXE_FLAGS}")
+
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -55,13 +62,13 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack -z relro -z now")
# Boost
-#add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
#add_definitions(-DBOOST_ASIO_ENABLE_HANDLER_TRACKING)
-#add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
+add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
+add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
add_definitions(-DBOOST_ALL_NO_LIB)
set(Boost_USE_STATIC_LIBS ON)
-hunter_add_package(Boost COMPONENTS system thread)
-find_package(Boost REQUIRED system thread REQUIRED)
+hunter_add_package(Boost)
+find_package(Boost)
#Openssl
hunter_add_package(OpenSSL)
@@ -171,6 +178,8 @@ set(UT_FILES
src/crow_getroutes_test.cpp
src/ast_jpeg_decoder_test.cpp
+ src/msan_test.cpp
+
${CMAKE_BINARY_DIR}/generated/blns.hpp
)
@@ -187,13 +196,13 @@ if(${BUILD_UT})
# googletest
enable_testing()
- find_package(GTest REQUIRED)
- find_package(GMock REQUIRED)
+ #hunter_add_package(GTest)
+ add_subdirectory(googletest)
+ #find_package(GMock CONFIG REQUIRED)
add_executable(unittest ${HDR_FILES} ${SRC_FILES} ${UT_FILES})
- target_link_libraries(unittest ${GMOCK_BOTH_LIBRARIES})
- target_link_libraries(unittest Boost::system Boost::thread)
- target_link_libraries(unittest ${CMAKE_THREAD_LIBS_INIT})
+ target_link_libraries(unittest gmock gtest)
+ target_link_libraries(unittest pthread)
target_link_libraries(unittest OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(unittest g3logger)
target_link_libraries(unittest ${ZLIB_LIBRARIES})
@@ -205,8 +214,7 @@ add_subdirectory(static)
# bmcweb
add_executable(bmcweb ${WEBSERVER_MAIN} ${HDR_FILES} ${SRC_FILES})
-target_link_libraries(bmcweb Boost::system Boost::thread)
-target_link_libraries(bmcweb ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(bmcweb pthread)
target_link_libraries(bmcweb OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(bmcweb g3logger)
target_link_libraries(bmcweb ${ZLIB_LIBRARIES})
@@ -214,16 +222,14 @@ add_dependencies(bmcweb packagestaticcpp)
# udpclient
add_executable(udpclient src/udpclient.cpp)
-
-target_link_libraries(udpclient Boost::system)
-target_link_libraries(udpclient ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(udpclient pthread)
add_executable(getvideo src/getvideo_main.cpp)
-target_link_libraries(getvideo ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(getvideo pthread)
target_link_libraries(getvideo g3logger)
# Visual Studio Code helper
# this needs to be at the end to make sure all includes are handled correctly
get_property(C_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
-execute_process(COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/prime_vscode_compile_db.py ${C_INCLUDE_DIRS} ${C_SYSTEM_INCLUDE_DIRS}) \ No newline at end of file
+execute_process(COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/prime_vscode_compile_db.py ${C_INCLUDE_DIRS}) \ No newline at end of file
diff --git a/include/ast_video_puller.hpp b/include/ast_video_puller.hpp
index de75fdf407..214e2df4be 100644
--- a/include/ast_video_puller.hpp
+++ b/include/ast_video_puller.hpp
@@ -1,7 +1,6 @@
#pragma once
#include <assert.h>
-//#include <video.h>
#include <ast_video_types.hpp>
#include <iostream>
#include <vector>
@@ -78,11 +77,6 @@ class VideoPuller {
image_info.do_image_refresh = 1; // full frame refresh
image_info.qc_valid = 0; // quick cursor disabled
- image_info.parameter.features.w = 0;
- image_info.parameter.features.h = 0;
- image_info.parameter.features.chrom_tbl = 0; // level
- image_info.parameter.features.lumin_tbl = 0;
- image_info.parameter.features.jpg_fmt = 1;
image_info.parameter.features.buf =
reinterpret_cast<unsigned char *>(raw.buffer.data());
image_info.crypttype = -1;
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index 1c3e8f4bad..eef4d55011 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -1,4 +1,5 @@
#pragma once
+#ifdef CROW_ENABLE_SSL
#include <openssl/bio.h>
#include <openssl/dh.h>
@@ -191,7 +192,7 @@ EVP_PKEY *create_ec_key(void) {
if (myecc) {
EC_KEY_set_asn1_flag(myecc, OPENSSL_EC_NAMED_CURVE);
EC_KEY_generate_key(myecc);
- EVP_PKEY *pKey = EVP_PKEY_new();
+ pKey = EVP_PKEY_new();
if (pKey) {
if (EVP_PKEY_assign_EC_KEY(pKey, myecc)) {
/* pKey owns pRSA from now */
@@ -199,11 +200,7 @@ EVP_PKEY *create_ec_key(void) {
fprintf(stderr, "EC_check_key failed.\n");
}
}
- EVP_PKEY_free(pKey);
- pKey = NULL;
}
- EC_KEY_free(myecc);
- myecc = NULL;
}
return pKey;
}
@@ -314,4 +311,6 @@ boost::asio::ssl::context get_ssl_context(std::string ssl_pem_file) {
}
return m_ssl_context;
}
-} \ No newline at end of file
+}
+
+#endif \ No newline at end of file
diff --git a/include/web_kvm.hpp b/include/web_kvm.hpp
index 251257015d..62be097e50 100644
--- a/include/web_kvm.hpp
+++ b/include/web_kvm.hpp
@@ -184,7 +184,7 @@ void request_routes(Crow<Middlewares...>& app) {
if (meta.vnc_state == VncState::UNSTARTED) {
meta.vnc_state = VncState::AWAITING_CLIENT_VERSION;
conn.send_binary(rfb_3_8_version_string);
- } else {
+ } else { // SHould never happen
conn.close();
}
@@ -271,7 +271,6 @@ void request_routes(Crow<Middlewares...>& app) {
auto msg = reinterpret_cast<const frame_buffer_update_req*>(
data.data() + sizeof(client_to_server_msg_type));
- if (!msg->incremental) {
// Todo(ed) lifecycle of the video puller and decoder
// should be
// with the websocket, not recreated every time
@@ -313,7 +312,7 @@ void request_routes(Crow<Middlewares...>& app) {
auto serialized = serialize(buffer_update_msg);
conn.send_binary(serialized);
- }
+
} // TODO(Ed) handle error
}
diff --git a/src/getvideo_main.cpp b/src/getvideo_main.cpp
index ad002c308d..cd7f09c4c2 100644
--- a/src/getvideo_main.cpp
+++ b/src/getvideo_main.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
-#define BUILD_CIMG
+//#define BUILD_CIMG
#ifdef BUILD_CIMG
#define cimg_display 0
#include <CImg.h>
diff --git a/src/msan_test.cpp b/src/msan_test.cpp
new file mode 100644
index 0000000000..047d3cfa4a
--- /dev/null
+++ b/src/msan_test.cpp
@@ -0,0 +1,7 @@
+#include "gtest/gtest.h"
+#include <string>
+
+TEST(MemorySanitizer, TestIsWorking) {
+ std::string foo("foo");
+ EXPECT_STREQ("foo", foo.c_str());
+}
diff --git a/src/ssl_key_handler_test.cpp b/src/ssl_key_handler_test.cpp
new file mode 100644
index 0000000000..818137c408
--- /dev/null
+++ b/src/ssl_key_handler_test.cpp
@@ -0,0 +1 @@
+// TODO(ed) WRITE TESTS FOR THIS \ No newline at end of file
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index 949bdc1294..d77d822041 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -1,7 +1,3 @@
-#include <web_kvm.hpp>
-#include <webassets.hpp>
-#include "ssl_key_handler.hpp"
-
#include "crow/app.h"
#include "crow/ci_map.h"
#include "crow/common.h"
@@ -38,6 +34,10 @@
#include <string>
#include <unordered_set>
+#include <web_kvm.hpp>
+#include <webassets.hpp>
+#include "ssl_key_handler.hpp"
+
int main(int argc, char** argv) {
auto worker(g3::LogWorker::createLogWorker());
std::string logger_name("bmcweb");
@@ -116,8 +116,7 @@ int main(int argc, char** argv) {
conn.send_binary(str);
});
-
- app.port(18080)
- //.ssl(std::move(ensuressl::get_ssl_context(ssl_pem_file)))
- .run();
+ auto ssl_context = ensuressl::get_ssl_context(ssl_pem_file);
+ app.port(18080).ssl(std::move(ssl_context)).run();
}
+