MODES_NAMESPACE_USE;
ClientPrivilege::ClientPrivilege(GDBusMethodInvocation *invocation)
- : handle(NULL), conf(NULL), client(NULL), user(NULL), clientSession(NULL)
+ : handle(NULL), client(NULL), user(NULL), clientSession(NULL)
{
int pid;
GDBusConnection *conn = g_dbus_method_invocation_get_connection(invocation);
// Do not free this string, it is owned by connection
const char *senderUniqueName = g_dbus_method_invocation_get_sender(invocation);
-
int ret = cynara_creds_gdbus_get_user(conn, senderUniqueName, USER_METHOD_DEFAULT, &user);
- if (ret != CYNARA_API_SUCCESS)
+ if (CYNARA_API_SUCCESS != ret)
ERR("cynara_creds_gdbus_get_user() Fail(%d)", ret);
ret = cynara_creds_gdbus_get_client(conn, senderUniqueName, CLIENT_METHOD_DEFAULT, &client);
- if (ret != CYNARA_API_SUCCESS)
+ if (CYNARA_API_SUCCESS != ret)
ERR("cynara_creds_gdbus_get_client() Fail(%d)", ret);
ret = cynara_creds_gdbus_get_pid(conn, senderUniqueName, &pid);
- if (ret != CYNARA_API_SUCCESS)
+ if (CYNARA_API_SUCCESS != ret)
ERR("cynara_creds_gdbus_get_pid() Fail(%d)", ret);
clientSession = cynara_session_from_pid(pid);
if (NULL == clientSession)
ERR("cynara_session_from_pid() Fail()");
- ret = cynara_configuration_create(&conf);
- if (ret != CYNARA_API_SUCCESS)
- ERR("cynara_configuration_create() Fail(%d)", ret);
-
- ret = cynara_configuration_set_cache_size(conf, 100);
- if (ret != CYNARA_API_SUCCESS) {
- ERR("cynara_configuration_set_cache_size() Fail(%d)", ret);
- cynara_configuration_destroy(conf);
- }
-
- ret = cynara_initialize(&handle, conf);
- if (ret != CYNARA_API_SUCCESS) {
+ ret = cynara_initialize(&handle, NULL);
+ if (CYNARA_API_SUCCESS != ret)
ERR("cynara_initialize() Fail(%d)", ret);
- cynara_configuration_destroy(conf);
- }
}
ClientPrivilege::~ClientPrivilege()
{
- cynara_configuration_destroy(conf);
cynara_finish(handle);
free(client);
free(user);
free(clientSession);
}
-int ClientPrivilege::check(Mode &mode)
+int ClientPrivilege::check(const Mode &mode)
{
std::list<std::shared_ptr<Action>>::iterator it;
auto actionList = mode.getActionList();