*/
int PolicyGetDesc(std::vector<std::string> &descriptions);
+/**
+ * Forwards Smack rules applying for private sharing to Master service.
+ *
+ * @param[in] ownerPkgId App id of path owner application
+ * @param[in] pkgContents Vector of applications belonging to the same package as path owner
+ * @param[in] targetAppId App id of sharing path target application
+ * @param[in] path Path being shared
+ * @param[in] ownerTargetCount Count of saved owner with target sharing
+ * @param[in] pathSharingCount Count of saved path sharing
+ *
+ * @return API return code, as defined in protocols.h
+ *
+ * @see ServiceImpl::applyPrivateSharing
+ */
+int SmackApplyPrivateSharingRules(const std::string &ownerPkgId,
+ const std::vector<std::string> &pkgContents,
+ const std::string &targetAppId,
+ const std::string &path,
+ int ownerTargetCount,
+ int pathSharingCount);
+
+/**
+ * Forwards Smack rules applying for private sharing to Master service.
+ *
+ * @param[in] ownerPkgId Package id of path owner application
+ * @param[in] pkgContents Vector of applications belonging to the same package as path owner
+ * @param[in] targetAppId App id of sharing path target application
+ * @param[in] path Path being shared
+ * @param[in] ownerTargetCount Count of saved owner with target sharing
+ * @param[in] pathSharingCount Count of saved path sharing
+ *
+ * @return API return code, as defined in protocols.h
+ *
+ * @see ServiceImpl::dropPrivateSharing
+ */
+int SmackDropPrivateSharingRules(const std::string &ownerPkgId,
+ const std::vector<std::string> &pkgContents,
+ const std::string &targetAppId,
+ const std::string &path,
+ int ownerTargetCount,
+ int pathSharingCount);
+
} // namespace MasterReq
} // namespace SecurityManager
POLICY_GET_DESC,
SMACK_INSTALL_RULES,
SMACK_UNINSTALL_RULES,
+ SMACK_APPLY_PRIVATE_SHARING_RULES,
+ SMACK_DROP_PRIVATE_SHARING_RULES
};
} // namespace SecurityManager
return ret;
}
+int SmackApplyPrivateSharingRules(const std::string &ownerPkgId,
+ const std::vector<std::string> &pkgContents,
+ const std::string &targetAppId,
+ const std::string &path,
+ int ownerTargetCount,
+ int pathCount)
+{
+ int ret;
+ MessageBuffer sendBuf, retBuf;
+
+ Serialization::Serialize(sendBuf,
+ static_cast<int>(MasterSecurityModuleCall::SMACK_APPLY_PRIVATE_SHARING_RULES));
+ Serialization::Serialize(sendBuf, ownerPkgId);
+ Serialization::Serialize(sendBuf, pkgContents);
+ Serialization::Serialize(sendBuf, targetAppId);
+ Serialization::Serialize(sendBuf, path);
+ Serialization::Serialize(sendBuf, ownerTargetCount);
+ Serialization::Serialize(sendBuf, pathCount);
+
+ ret = sendToServer(MASTER_SERVICE_SOCKET, sendBuf.Pop(), retBuf);
+ if (ret == SECURITY_MANAGER_API_SUCCESS) {
+ Deserialization::Deserialize(retBuf, ret);
+ }
+
+ return ret;
+}
+
+int SmackDropPrivateSharingRules(const std::string &ownerPkgId,
+ const std::vector<std::string> &pkgContents,
+ const std::string &targetAppId,
+ const std::string &path,
+ int ownerTargetCount,
+ int pathCount)
+{
+ int ret;
+ MessageBuffer sendBuf, retBuf;
+
+ Serialization::Serialize(sendBuf,
+ static_cast<int>(MasterSecurityModuleCall::SMACK_DROP_PRIVATE_SHARING_RULES));
+ Serialization::Serialize(sendBuf, ownerPkgId);
+ Serialization::Serialize(sendBuf, pkgContents);
+ Serialization::Serialize(sendBuf, targetAppId);
+ Serialization::Serialize(sendBuf, path);
+ Serialization::Serialize(sendBuf, ownerTargetCount);
+ Serialization::Serialize(sendBuf, pathCount);
+
+ ret = sendToServer(MASTER_SERVICE_SOCKET, sendBuf.Pop(), retBuf);
+ if (ret == SECURITY_MANAGER_API_SUCCESS) {
+ Deserialization::Deserialize(retBuf, ret);
+ }
+
+ return ret;
+}
+
} // namespace MasterReq
} // namespace SecurityManager
*/
void processSmackUninstallRules(MessageBuffer &buffer, MessageBuffer &send,
const std::string &zoneId);
+
+ /**
+ * Process SMACK rules apply private path sharing
+ *
+ * @param buffer Raw received data buffer
+ * @param send Raw data buffer to be sent
+ * @param zoneId ID of zone which requested the call
+ */
+ void processSmackApplySharingRules(MessageBuffer &buffer, MessageBuffer &send,
+ const std::string &zoneId);
+ /**
+ * Process SMACK rules drop private path sharing
+ *
+ * @param buffer Raw received data buffer
+ * @param send Raw data buffer to be sent
+ * @param zoneId ID of zone which requested the call
+ */
+ void processSmackDropSharingRules(MessageBuffer &buffer, MessageBuffer &send,
+ const std::string &zoneId);
};
} // namespace SecurityManager
LogDebug("call type MasterSecurityModuleCall::SMACK_UNINSTALL_RULES");
processSmackUninstallRules(buffer, send, vsmZoneId);
break;
+ case MasterSecurityModuleCall::SMACK_APPLY_PRIVATE_SHARING_RULES:
+ processSmackApplySharingRules(buffer, send, vsmZoneId);
+ break;
+ case MasterSecurityModuleCall::SMACK_DROP_PRIVATE_SHARING_RULES:
+ processSmackDropSharingRules(buffer, send, vsmZoneId);
+ break;
default:
LogError("Invalid call: " << call_type_int);
Throw(MasterServiceException::InvalidAction);
Serialization::Serialize(send, SECURITY_MANAGER_API_SUCCESS);
}
+void MasterService::processSmackApplySharingRules(MessageBuffer &buffer, MessageBuffer &send,
+ const std::string &zoneId)
+{
+ std::string ownerPkgId, targetAppId, path;
+ std::vector<std::string> pkgContents;
+ int ownerTargetCount, pathCount;
+
+ Deserialization::Deserialize(buffer, ownerPkgId);
+ Deserialization::Deserialize(buffer, pkgContents);
+ Deserialization::Deserialize(buffer, targetAppId);
+ Deserialization::Deserialize(buffer, path);
+ Deserialization::Deserialize(buffer, ownerTargetCount);
+ Deserialization::Deserialize(buffer, pathCount);
+
+ (void)zoneId;
+
+ Serialization::Serialize(send, SECURITY_MANAGER_API_SUCCESS);
+}
+
+void MasterService::processSmackDropSharingRules(MessageBuffer &buffer, MessageBuffer &send,
+ const std::string &zoneId)
+{
+ std::string ownerPkgId, targetAppId, path;
+ std::vector<std::string> pkgContents;
+ int ownerTargetCount, pathCount;
+
+ Deserialization::Deserialize(buffer, ownerPkgId);
+ Deserialization::Deserialize(buffer, pkgContents);
+ Deserialization::Deserialize(buffer, targetAppId);
+ Deserialization::Deserialize(buffer, path);
+ Deserialization::Deserialize(buffer, ownerTargetCount);
+ Deserialization::Deserialize(buffer, pathCount);
+
+ (void)zoneId;
+
+ Serialization::Serialize(send, SECURITY_MANAGER_API_SUCCESS);
+}
+
} // namespace SecurityManager