# HG changeset patch # User Andre Heinecke # Date 1394460915 0 # Node ID 92108a2120f1cfd50621f2c0c93d68f6dfc11c0f # Parent de67047ca2298c3ea895a411fa3ca5b6abab45c1 Move certificatelist to common. Add cinst directory diff -r de67047ca229 -r 92108a2120f1 CMakeLists.txt --- a/CMakeLists.txt Fri Feb 21 15:12:24 2014 +0000 +++ b/CMakeLists.txt Mon Mar 10 14:15:15 2014 +0000 @@ -37,8 +37,6 @@ ) # Seperated to make it easier to include the sources in tests -set(M13UI_MAIN ) - set(M13UI_RESOURCES ${CMAKE_SOURCE_DIR}/ui/icons.qrc ${CMAKE_SOURCE_DIR}/ui/certs.qrc @@ -61,7 +59,7 @@ # The following list is taken from the .pri file get_target_property(_loc Qt5::Widgets LOCATION) get_filename_component(_qtpath ${_loc} PATH) - set(XCB_EXTRA_LIBS + set(XCB_EXTRA_LIBS -static -static-libgcc -L${_qtpath} -lX11 -lX11-xcb -lXi -lxcb-render-util -lXrender -lSM -lICE -lxcb-render -ldbus-1 -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr @@ -89,13 +87,15 @@ set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat") endif() -qt5_add_resources(M13UI_SOURCES ${M13UI_RESOURCES}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_HARDENING_FLAGS} ${HARDENING_FLAGS}") -add_executable(m13ui ${M13UI_SOURCES} ${M13UI_MAIN}) +# Adding resources here in an extra variable to enable reuse of +# M13UI_SOURCES in the test subdirectory. +set(M13UI_SOURCES_WITH_RESOURCES ${M13UI_SOURCES}) +qt5_add_resources(M13UI_SOURCES_WITH_RESOURCES ${M13UI_RESOURCES}) +add_executable(m13ui ${M13UI_SOURCES_WITH_RESOURCES}) target_link_libraries(m13ui Qt5::Widgets ${EXTRA_STATIC_LIBS} gcov) @@ -103,7 +103,7 @@ # CPPCheck include(GenerateCppcheck) -generate_cppcheck(SOURCES ${M13UI_SOURCES} "" "" m13ui) +generate_cppcheck(SOURCES ${CINST_SOURCES} ${M13UI_SOURCES} TARGET_NAME m13) add_dependencies(static_check cppcheck) # FlawFinder @@ -112,12 +112,14 @@ add_custom_target(flawfinder COMMENT "FlawFinder" VERBATIM COMMAND ${FLAWFINDER_PATH} ${CMAKE_SOURCE_DIR}/ui ${CMAKE_SOURCE_DIR}/cinst + ${CMAKE_SOURCE_DIR}/common ) add_dependencies(static_check flawfinder) endif (FLAWFINDER_PATH) # Tests add_subdirectory(tests) +add_subdirectory(cinst) # Documentation configure_file (doc/Doxyfile.in doc/Doxyfile) diff -r de67047ca229 -r 92108a2120f1 cinst/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cinst/CMakeLists.txt Mon Mar 10 14:15:15 2014 +0000 @@ -0,0 +1,8 @@ +set(CMAKE_AUTOMOC OFF) + +set(CINST_SOURCES + ${CMAKE_SOURCE_DIR}/cinst/main.c + ${CMAKE_SOURCE_DIR}/common/listutil.c +) + +add_executable(cinst ${CINST_SOURCES}) diff -r de67047ca229 -r 92108a2120f1 cinst/main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cinst/main.c Mon Mar 10 14:15:15 2014 +0000 @@ -0,0 +1,16 @@ +/** @brief Main entry point for the cinst process. + * + * The cinst process may or may not be run with elevated + * privileges. When run with elevated privileges this + * process will modify system wide certificate stores. + * Otherwise only the users certificate stores are modified. + * + * TODO + * + **/ + +#include + +int main(int argc, char* argv[]) { + return 0; +} diff -r de67047ca229 -r 92108a2120f1 tests/CMakeLists.txt --- a/tests/CMakeLists.txt Fri Feb 21 15:12:24 2014 +0000 +++ b/tests/CMakeLists.txt Mon Mar 10 14:15:15 2014 +0000 @@ -16,4 +16,5 @@ # so that it can be used in file names in the tests. add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") add_m13_test(certlistparsertest.cpp "${CERTIFICATELIST_SOURCES}") +add_m13_test(${CMAKE_SOURCE_DIR}/ui/main.cpp "${M13UI_SOURCES}") diff -r de67047ca229 -r 92108a2120f1 ui/certificatelist.h --- a/ui/certificatelist.h Fri Feb 21 15:12:24 2014 +0000 +++ b/ui/certificatelist.h Mon Mar 10 14:15:15 2014 +0000 @@ -18,7 +18,7 @@ #include #include -#include "../cinst/listutil.h" +#include "../common/listutil.h" #include "certificate.h" class CertificateList : public QObject @@ -29,7 +29,15 @@ CertificateList(const char *fileName); list_status_t getStatus() {return mStatus;} - bool isValid() {return mStatus == Valid;} + + /** @brief Returns true if the list is Valid + * + * A list is valid only if the signature matched and the + * list could be parsed. + */ + bool isValid() {return mStatus == Valid;} const + + const QList& getCertificates() const; private: QString mFileName;