BuildRequires: pkgconfig(libsystemd)
%endif
BuildRequires: pkgconfig(cynara-plugin)
+BuildRequires: pkgconfig(cynara-creds-socket)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(security-privilege-manager)
BuildRequires: pkgconfig(security-manager)
BuildRequires: pkgconfig(capi-appfw-app-manager)
BuildRequires: pkgconfig(capi-appfw-component-manager)
BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(libsmack)
BuildRequires: pkgconfig(aul)
BuildRequires: boost-devel
%if "%{build_type}" == "COVERAGE"
char *appName = nullptr;
int ret = security_manager_identify_app_from_pid(getpid(), &pkgName, &appName);
+ throwOnSMError("security_manager_identify_app_from_pid", ret);
std::unique_ptr<char, decltype(free)*> pkg_name_p(pkgName, free);
std::unique_ptr<char, decltype(free)*> app_name_p(appName, free);
- throwOnSMError("security_manager_identify_app_from_pid", ret);
if (!appName)
return pkgInfo.mainAppId(pkgName, geteuid());
#include <memory>
#include <stdlib.h>
-#include <sys/smack.h>
#include <sys/socket.h>
+#include <cynara-creds-socket.h>
#include "credentials-exception.h"
#include "credentials.h"
return cr.pid;
}
-std::string getSmackLabelFromSocket(int sockFd)
+std::string getCynaraClientFromSocket(int sockFd)
{
- char *label;
- ssize_t labelLen = smack_new_label_from_socket(sockFd, &label);
- if (labelLen <= 0) {
- throw AskUser::Protocol::CredentialsException("Couldn't fetch a smack label from a socket");
+ char *label = nullptr;
+ int ret = cynara_creds_socket_get_client(sockFd, CLIENT_METHOD_DEFAULT, &label);
+ if (ret != CYNARA_API_SUCCESS || label == nullptr) {
+ throw AskUser::Protocol::CredentialsException(
+ "cynara_creds_socket_get_client() failed: " + std::to_string(ret));
}
- std::unique_ptr<char, decltype(free)*> labelPtr(label, free);
- return std::string(labelPtr.get(), labelLen);
+ std::unique_ptr<std::remove_pointer_t<decltype(label)>, decltype(&free)> labelPtr(label, free);
+ return std::string(label);
}
} // namespace
namespace Protocol {
Credentials::Credentials(int sockFd)
-: label(getSmackLabelFromSocket(sockFd))
+: label(getCynaraClientFromSocket(sockFd))
, uid(getUIDFromSocket(sockFd))
, pid(getPIDFromSocket(sockFd))
{