Fix author_id mismatch after DB upgrade 17/239217/16
authorDariusz Michaluk <d.michaluk@samsung.com>
Mon, 20 Jul 2020 12:20:07 +0000 (14:20 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Mon, 21 Sep 2020 05:22:32 +0000 (07:22 +0200)
commit52cdda51ad125598c03698b36549588b9e2c987d
treed677a5840c9e20258af27317a0d19ac1a5787986
parentdb4763569eece03bb33123ce35f4ebafb67d66a0
Fix author_id mismatch after DB upgrade

author_id is a DB table primary key and depends on apps instalation
order. Instead of using author_id in SMACK label, use 64 bits (16 character string)
of SHA1(author_name) in hex format.

This commit includes:
- sqlite3-sha1 extension copied from:
  https://github.com/sqlite/sqlite/blob/master/ext/misc/sha1.c
- new DB schema and migration script,
- rules loader adjustment to new SMACK label,
- filesystem (SECURITY_MANAGER_PATH_TRUSTED_RW) relabeling,
- app instalation changes.

Change-Id: I4f478e0b9dfde06ef752d250d5bc7ef3183cde19
29 files changed:
CMakeLists.txt
db/db.sql
db/updates/update-db-to-v14.sql [new file with mode: 0644]
packaging/security-manager.spec
policy/updates/update-policy-to-v9.sh [new file with mode: 0755]
src/common/CMakeLists.txt
src/common/include/privilege_db.h
src/common/include/service_impl.h
src/common/include/smack-labels.h
src/common/include/smack-rules.h
src/common/privilege_db.cpp
src/common/service_impl.cpp
src/common/sha1.c [new file with mode: 0644]
src/common/smack-labels.cpp
src/common/smack-rules.cpp
src/server/rules-loader/security-manager-rules-loader.cpp
test/CMakeLists.txt
test/data/.security-manager-test-rules-default-exclude.txt
test/data/.security-manager-test-rules-default-packages.txt
test/data/.security-manager-test-rules-default.txt
test/data/.security-manager-test-rules-exclude.txt
test/data/.security-manager-test-rules-packages.txt
test/data/.security-manager-test-rules.db
test/data/.security-manager-test-rules.txt
test/privilege_db_fixture.cpp
test/test_privilege_db_add_app.cpp
test/test_privilege_db_app_pkg_getters.cpp
test/test_smack-labels.cpp
test/test_smack-rules.cpp