Skip to content

Commit 0b5c71f

Browse files
committed
Add error message to failure path.
1 parent bc2fb78 commit 0b5c71f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/scitokens.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,14 @@ int enforcer_generate_acls(const Enforcer enf, const SciToken scitoken, Acl **ac
259259
for (const auto &acl : acls_list) {
260260
acl_result[idx].authz = strdup(acl.first.c_str());
261261
acl_result[idx].resource = strdup(acl.second.c_str());
262-
if (acl_result[idx].authz == nullptr || acl_result[idx].resource == nullptr) {
262+
if (acl_result[idx].authz == nullptr) {
263263
enforcer_acl_free(acl_result);
264+
if (err_msg) {*err_msg = strdup("ACL was generated without an authorization set.");}
265+
return -1;
266+
}
267+
if (acl_result[idx].resource == nullptr) {
268+
enforcer_acl_free(acl_result);
269+
if (err_msg) {*err_msg = strdup("ACL was generated without a resource set.");}
264270
return -1;
265271
}
266272
idx++;

0 commit comments

Comments
 (0)