Add dbus tests for send type check 03/35303/6
authorMarcin Niesluchowski <m.niesluchow@samsung.com>
Wed, 11 Feb 2015 16:29:03 +0000 (17:29 +0100)
committerZbigniew Jasinski <z.jasinski@samsung.com>
Wed, 22 Apr 2015 12:11:13 +0000 (05:11 -0700)
* tcc_2430_send_type_deny
    Check for send type created in conf file. Not granted for client
    sending message of type.
* tcc_2470_send_type_allow
    Check for send type created in conf file. Granted for client sending
    message of type.

Change-Id: I7c400c5f682173260a4e04f2420650f3f1b73e50

tests/dbus-tests/cynara_dbus_tests.cpp

index f43da0ef3ba5fbe4dd2cc7f10226b2223da047bd..338bf88240396b7ecf5fade2235b9f3bba191d1e 100644 (file)
@@ -311,3 +311,24 @@ RUNNER_MULTIPROCESS_TEST_SMACK(tcc_2370_send_interface_allow)
 {
     testSend("tcc2370", addBusconfigPolicySendInterface, true);
 }
+
+static void addBusconfigPolicySendType(const std::string &testId)
+{
+    const ServiceCreds serviceCreds(serviceIdFromStr(testId));
+    BusConfigWriter writer;
+    addBusconfigPolicySendAllows(writer);
+    writer.addPolicyCheck(privilegeFromStr(clientIdFromStr(testId)),
+                          {{Attr::SEND_DESTINATION, serviceCreds.connectionName()},
+                           {Attr::SEND_TYPE, MESSSAGE_TYPE_METHOD_CALL}});
+    writer.save();
+}
+
+RUNNER_MULTIPROCESS_TEST_SMACK(tcc_2430_send_type_deny)
+{
+    testSend("tcc2430", addBusconfigPolicySendType, false);
+}
+
+RUNNER_MULTIPROCESS_TEST_SMACK(tcc_2470_send_type_allow)
+{
+    testSend("tcc2470", addBusconfigPolicySendType, true);
+}