diff options
author | José Bollo <jose.bollo@iot.bzh> | 2019-10-03 12:34:13 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2019-10-04 13:43:10 +0200 |
commit | d4a2c432763b033acf7c94ee7e121aca5a3a4f10 (patch) | |
tree | e972628992c5f8a49ba3704c10ab9b1058c4c1b9 | |
parent | bf0edaecd3cbf088992ba4bae20d761cceeb1742 (diff) |
Improve library split parts
In prevision of further developments (like plugins)
the server is splitted in two parts: the server program
itself and the core library.
The client library is also splitted in two parts:
the compatibility part and the real client part.
Change-Id: Iaee93298d52eb825ad9aed5d2b3e74c2975b5950
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | CMakeLists.txt | 29 | ||||
-rw-r--r-- | README.md | 75 | ||||
-rw-r--r-- | pkgconfig/CMakeLists.txt | 7 | ||||
-rw-r--r-- | pkgconfig/cynara-compat.pc.in | 5 | ||||
-rw-r--r-- | pkgconfig/cynara.pc.in | 2 | ||||
l--------- | pkgconfig/link-to-cynara-compat.pc | 1 | ||||
l--------- | pkgconfig/link.pc | 1 | ||||
-rw-r--r-- | src/CMakeLists.txt | 105 | ||||
-rw-r--r-- | src/SOURCES.md | 0 | ||||
-rw-r--r-- | src/export-cynara-client.map | 8 | ||||
-rw-r--r-- | src/export-cynara-compat.map (renamed from src/export.map) | 1 | ||||
-rw-r--r-- | src/export-cynara-core.map | 6 |
12 files changed, 191 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c96027b..5879513 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,24 +16,25 @@ # limitations under the License. ########################################################################### -CMAKE_MINIMUM_REQUIRED(VERSION 3.0) +cmake_minimum_required(VERSION 3.0) -PROJECT(cynara C) +project(cynara C) -SET(PROJECT_NAME "Cynara") -SET(PROJECT_PRETTY_NAME "Permission database") -SET(PROJECT_DESCRIPTION "Secured permission database for applications") -SET(PROJECT_VERSION "1.99.99") +set(PROJECT_NAME "Cynara") +set(PROJECT_PRETTY_NAME "Permission database") +set(PROJECT_DESCRIPTION "Secured permission database for applications") +set(PROJECT_VERSION "1.99.99") set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/cynara.git;a=summary") -INCLUDE(FindPkgConfig) -INCLUDE(CheckIncludeFiles) -INCLUDE(CheckLibraryExists) -INCLUDE(GNUInstallDirs) +include(FindPkgConfig) +include(CheckIncludeFiles) +include(CheckLibraryExists) +include(GNUInstallDirs) +include(CTest) + if(NOT CMAKE_INSTALL_FULL_RUNSTATEDIR) - set(CMAKE_INSTALL_FULL_RUNSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run") + set(CMAKE_INSTALL_FULL_RUNSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run") endif() -INCLUDE(CTest) ########################################################################### # possible settings @@ -76,8 +77,8 @@ set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage") ########################################################################### if(SYSTEMD) - PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222) - add_subdirectory(systemd) + PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222) + add_subdirectory(systemd) endif() add_subdirectory(include) diff --git a/README.md b/README.md new file mode 100644 index 0000000..d7fb662 --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +<pre> + -++- + yyyyyy/ + .syyyyyyyys. + .s/` yyyyyyyyyyyy `/s. + `yyyo-yyyyyyyyyyyyyy oyyy. + oyyy-syyyyyo++oyyyyys-yyyo + ` syyy oyys/+sddy+/syyo yyys ` + -hh//yyo s/ohddddddho s oyy//hh- + ydddh+/+./hddddddddddh+.+/+hdddh + .` `ddddddh sdddddddddddddds hdddddd. `. + hddy.dddddd/sdddddddddddddddds dddddd.sddd + yddd/sddddd.dddddddddddddddddd.dddddy dddh + +dddy-ddddd yddddddddddddddddy ddddd yddd+ + `yddd+oddddy ddddddhhhhdddddd yddddo/dddh` + .yddd/oddds-+++++oooooo+++++-sdddo/dddy. + --++./s/+dddddddddddddddddd+/s/.++-- + /ddhy++dddddddddddddddddd+/yhdd+ + `+ydd-hddddddddddddddddh-hdy+` + `--` +ossyyyyyysso+ `--` + + + + -/++++/:`///// `////:-////. -////- ://- :///++//:` `///. + -oso:--:ss .+ss: /ss:``:ssss. `:ss:` :ssss. `/ss/-:oss. /ssso` + `sso` -- +ss.-ss- .ssoss- .ss. .ss-oso :ss- :ss- -ss-ss+ + -ss+ /ssss. .ss-/ss/-ss. `os/ -ss/ :sso+oso: .ss: :ss: + `sso +ss- .ss- :ssoss. +ssssssss- :ss:.+ss. ossssssss. + :sso:--:++ `+ss-` `-ss:` -ssss.`:ss/` `-sss-``/ss:` +ss-`.+ss-` `:sso. + `:/+o+/:` +++++- -++++: .+++`/++++- .+++++-/++++: `/++:+++++. -+++++. +</pre> + +# Cynara + +[Cynara][1] is fast, simple and safe permission database +service. +Functions of Cynara are: +* checking access for certain permission +* holding permission database +* simple, single function API - for checking permissions +* thin client library - to make access control even more simple +* ability to use external agent +(in case of policies that can't be full processed in cynara and plugins) + +## API Overview + +Please refer to a wiki page on [Cynara's API][2]. + +## Documentation + +Documentation is kept on [wiki][1]. + +## Repositories + +Cynara repositories are available on: +* GitHub - [samsung/Cynara][3] repository +* tizen.org - [platform/core/security/cynara][4] repository - requires account on tizen.org + +## Contact information + +| Name | E-mail | Function | +|----------------------|----------------------------------|------------| +| Łukasz Wojciechowski | l.wojciechow@partner.samsung.com | Maintainer | +| Aleksander Zdyb | a.zdyb@samsung.com | Integrator | + +## License + +Cynara is licensed under a Apache License Version 2.0, January 2004. +Available on Apache [website][5] or in LICENSE file. + +[1]: https://wiki.tizen.org/wiki/Security:Cynara +[2]: https://wiki.tizen.org/wiki/Security:Cynara:API +[3]: https://github.com/Samsung/cynara +[4]: https://review.tizen.org/gerrit/#/admin/projects/platform/core/security/cynara +[5]: https://www.apache.org/licenses/ diff --git a/pkgconfig/CMakeLists.txt b/pkgconfig/CMakeLists.txt index f32ad70..6875ab6 100644 --- a/pkgconfig/CMakeLists.txt +++ b/pkgconfig/CMakeLists.txt @@ -21,6 +21,11 @@ configure_file(cynara.pc.in cynara.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cynara.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +configure_file(cynara-compat.pc.in cynara-compat.pc @ONLY) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cynara-compat.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + foreach(item cynara-admin.pc cynara-agent.pc cynara-client-async.pc @@ -34,7 +39,7 @@ foreach(item cynara-admin.pc cynara-monitor.pc cynara-plugin.pc cynara-session.pc) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/link.pc + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/link-to-cynara-compat.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig RENAME ${item}) endforeach(item) diff --git a/pkgconfig/cynara-compat.pc.in b/pkgconfig/cynara-compat.pc.in new file mode 100644 index 0000000..c698b3a --- /dev/null +++ b/pkgconfig/cynara-compat.pc.in @@ -0,0 +1,5 @@ +Name: cynara +Description: cynara package +Version: @CYNARA_VERSION@ +Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lcynara-compat +Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@ -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/cynara diff --git a/pkgconfig/cynara.pc.in b/pkgconfig/cynara.pc.in index 6a39979..a92cbf4 100644 --- a/pkgconfig/cynara.pc.in +++ b/pkgconfig/cynara.pc.in @@ -1,5 +1,5 @@ Name: cynara Description: cynara package Version: @CYNARA_VERSION@ -Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lcynara +Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lcynara-client Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@ -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/cynara diff --git a/pkgconfig/link-to-cynara-compat.pc b/pkgconfig/link-to-cynara-compat.pc new file mode 120000 index 0000000..e8bb0ec --- /dev/null +++ b/pkgconfig/link-to-cynara-compat.pc @@ -0,0 +1 @@ +cynara-compat.pc
\ No newline at end of file diff --git a/pkgconfig/link.pc b/pkgconfig/link.pc deleted file mode 120000 index 17d4d5d..0000000 --- a/pkgconfig/link.pc +++ /dev/null @@ -1 +0,0 @@ -cynara.pc
\ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4aa6853..8ef4b8a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,8 +16,7 @@ # limitations under the License. ########################################################################### -set(SERVER_SOURCES - agent-at.c +set(LIBCORE_SOURCES anydb.c cyn.c db.c @@ -25,17 +24,21 @@ set(SERVER_SOURCES expire.c fbuf.c filedb.c - main-cynarad.c memdb.c pollitem.c - prot.c queue.c +) + +set(SERVER_SOURCES + agent-at.c + main-cynarad.c + prot.c rcyn-protocol.c rcyn-server.c socket.c ) -set(LIB_SOURCES +set(LIBCLI_SOURCES cache.c lib-compat.c prot.c @@ -44,25 +47,70 @@ set(LIB_SOURCES socket.c ) +set(LIBCLI_SOURCES + cache.c + prot.c + rcyn-client.c + rcyn-protocol.c + socket.c +) + +set(LIBCOMPAT_SOURCES + lib-compat.c +) + add_compile_definitions(_GNU_SOURCE) ########################################### -# build and install libcynara +# build and install libcynara-core ########################################### -ADD_LIBRARY(cynara SHARED ${LIB_SOURCES}) -target_compile_definitions(cynara PRIVATE +add_library(cynara-core SHARED ${LIBCORE_SOURCES}) +set_target_properties(cynara-core PROPERTIES + VERSION ${CYNARA_VERSION} + SOVERSION ${CYNARA_SOVERSION}) +target_link_libraries(cynara-core + -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-core.map + -Wl,--as-needed + -Wl,--gc-sections +) +install(TARGETS cynara-core LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) + +########################################### +# build and install libcynara-client +########################################### +add_library(cynara-client SHARED ${LIBCLI_SOURCES}) +target_compile_definitions(cynara-client PRIVATE RCYN_DEFAULT_SOCKET_DIR="${DEFAULT_SOCKET_DIR}" ) -SET_TARGET_PROPERTIES(cynara PROPERTIES +set_target_properties(cynara-client PROPERTIES + VERSION ${CYNARA_VERSION} + SOVERSION ${CYNARA_SOVERSION}) +target_link_options(cynara-client + PRIVATE + -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-client.map + -Wl,--as-needed + -Wl,--gc-sections +) +install(TARGETS cynara-client LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) +install(FILES rcyn-client.h DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/cynara) + +########################################### +# build and install libcynara-compat +########################################### +add_library(cynara-compat SHARED ${LIBCOMPAT_SOURCES}) +set_target_properties(cynara-compat PROPERTIES VERSION ${CYNARA_VERSION} SOVERSION ${CYNARA_SOVERSION}) -TARGET_LINK_LIBRARIES(cynara - -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map +target_link_libraries(cynara-compat + PRIVATE cynara-client +) +target_link_options(cynara-compat + PRIVATE + -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-compat.map -Wl,--as-needed -Wl,--gc-sections ) -INSTALL(TARGETS cynara LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) -INSTALL(FILES rcyn-client.h DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/cynara) +install(TARGETS cynara-compat LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) ########################################### # build and install cynarad @@ -74,34 +122,29 @@ target_compile_definitions(cynarad PRIVATE DEFAULT_INIT_FILE="${DEFAULT_INIT_FILE}" RCYN_DEFAULT_SOCKET_DIR="${DEFAULT_SOCKET_DIR}" ) -target_link_libraries(cynarad cap) +if(SYSTEMD) + target_compile_definitions(cynarad PRIVATE WITH_SYSTEMD_ACTIVATION) + target_link_libraries(cynarad ${libsystemd_LDFLAGS} ${libsystemd_LINK_LIBRARIES}) + target_include_directories(cynarad PRIVATE ${libsystemd_INCLUDE_DIRS}) + target_compile_options(cynarad PRIVATE ${libsystemd_CFLAGS}) +endif() +target_link_libraries(cynarad cynara-core cap) install(TARGETS cynarad RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) ########################################### # build and install cynadm ########################################### -ADD_EXECUTABLE(cynadm main-cynadm.c expire.c) -TARGET_LINK_LIBRARIES(cynadm cynara) -INSTALL(TARGETS cynadm +add_executable(cynadm main-cynadm.c expire.c) +target_link_libraries(cynadm cynara-client) +install(TARGETS cynadm RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) ########################################### # build and install test-old-cynara ########################################### -ADD_EXECUTABLE(test-old-cynara main-test-old-cynara.c) -TARGET_LINK_LIBRARIES(test-old-cynara cynara) -INSTALL(TARGETS test-old-cynara +add_executable(test-old-cynara main-test-old-cynara.c) +target_link_libraries(test-old-cynara cynara-compat) +install(TARGETS test-old-cynara RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) -########################################### -# alterations for SYSTEMD and socket specs -########################################### - -if(SYSTEMD) - target_compile_definitions(cynarad PRIVATE WITH_SYSTEMD_ACTIVATION) - target_link_libraries(cynarad ${libsystemd_LDFLAGS} ${libsystemd_LINK_LIBRARIES}) - target_include_directories(cynarad PRIVATE ${libsystemd_INCLUDE_DIRS}) - target_compile_options(cynarad PRIVATE ${libsystemd_CFLAGS}) -endif() - diff --git a/src/SOURCES.md b/src/SOURCES.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/SOURCES.md diff --git a/src/export-cynara-client.map b/src/export-cynara-client.map new file mode 100644 index 0000000..326de85 --- /dev/null +++ b/src/export-cynara-client.map @@ -0,0 +1,8 @@ +{ +global: + rcyn_*; +local: + *; +}; + + diff --git a/src/export.map b/src/export-cynara-compat.map index 84467af..7b482f3 100644 --- a/src/export.map +++ b/src/export-cynara-compat.map @@ -1,6 +1,5 @@ { global: - rcyn_*; cynara_*; local: *; diff --git a/src/export-cynara-core.map b/src/export-cynara-core.map new file mode 100644 index 0000000..8193f44 --- /dev/null +++ b/src/export-cynara-core.map @@ -0,0 +1,6 @@ +{ +global: + *; +}; + + |