Restore client authentication 38/319338/14
authorKrzysztof Malysa <k.malysa@samsung.com>
Fri, 7 Feb 2025 14:46:03 +0000 (15:46 +0100)
committerKrzysztof Małysa <k.malysa@samsung.com>
Fri, 14 Feb 2025 16:06:26 +0000 (16:06 +0000)
Change-Id: I5b73fd3f5523ce8002fca6d912552c3527291f63

src/common/cynara.cpp
src/server/service/service.cpp

index 576a33829aade29cc83b9b513f9e0fe15c3abd54..758a9fcd0e6eadb893eb9147753d2662cb294a21 100644 (file)
@@ -557,6 +557,13 @@ void CynaraAdmin::userInit(uid_t uid, security_manager_user_type userType)
             ThrowMsg(CynaraException::InvalidParam, "User type incorrect");
     }
 
+    if (!smack_simple_check()) {
+        policies.emplace_back(CynaraAdminPolicy(
+            CYNARA_ADMIN_WILDCARD, userStr, CYNARA_ADMIN_WILDCARD,
+            static_cast<int>(CynaraAdminPolicy::Operation::Allow),
+            Buckets.at(Bucket::MANIFESTS_GLOBAL)));
+    }
+
     policies.push_back(CynaraAdminPolicy(CYNARA_ADMIN_WILDCARD,
                                          userStr,
                                          CYNARA_ADMIN_WILDCARD,
index 607dcf811b9219de659386b2155f801ac934f8d0..0bcc4d71ad41c4a7aa17a8165d81c3ed3f193697 100644 (file)
@@ -59,11 +59,8 @@ void Service::processEvent(Event &&msg)
         int call_type_int;
         Deserialization::Deserialize(msg.buffer, call_type_int);
         SecurityModuleCall call_type = static_cast<SecurityModuleCall>(call_type_int);
-        if (!smack_simple_check()) {
-            LogWarning("Running in no-smack mode, treating connection as authenticated - privileges will not be checked!");
-            msg.creds.authenticated = true;
-        }
-        LogWarning("Processing event from client - smack label: " << msg.creds.label << ", pid: " << msg.creds.pid);
+        LogWarning("Processing event from client - smack label: " << msg.creds.label << ", pid: "
+                   << msg.creds.pid << ", uid: " << msg.creds.uid);
         LOG_EXECUTION_TIME(SecurityModuleCallToString(call_type), msg.creds);
         switch (call_type) {
             case SecurityModuleCall::NOOP: