+ Cynara::PolicyResult policyResult;
+
+ try {
+ int ret = p_cynara_admin->impl->adminCheck(start_bucket, recursive != 0,
+ Cynara::PolicyKey(client, user, privilege),
+ policyResult);
+ if (ret != CYNARA_ADMIN_API_SUCCESS)
+ return ret;
+ } catch (const std::bad_alloc &ex) {
+ return CYNARA_ADMIN_API_OUT_OF_MEMORY;
+ } catch (const std::length_error &ex) {
+ return CYNARA_ADMIN_API_INVALID_PARAM;
+ }
+
+ char *str = nullptr;
+ if (!policyResult.metadata().empty()) {
+ str = strdup(policyResult.metadata().c_str());
+ if (!str)
+ return CYNARA_ADMIN_API_OUT_OF_MEMORY;
+ }
+ *result = static_cast<int>(policyResult.policyType());
+ *result_extra = str;
+