int access_vis_list_by_name(struct query *q, char *argv[], client *cl)
{
EXEC SQL BEGIN DECLARE SECTION;
- int acl_id, memacl_id, flags, rowcount;
+ int acl_id, memacl_id, flags, rowcount, list_id;
char acl_type[LIST_ACL_TYPE_SIZE], memacl_type[LIST_ACL_TYPE_SIZE];
char *listname;
EXEC SQL END DECLARE SECTION;
int status;
listname = argv[0];
- EXEC SQL SELECT hidden, acl_id, acl_type, memacl_id, memacl_type
- INTO :flags, :acl_id, :acl_type, :memacl_id, :memacl_type
+ EXEC SQL SELECT hidden, acl_id, acl_type, memacl_id, memacl_type, list_id
+ INTO :flags, :acl_id, :acl_type, :memacl_id, :memacl_type, :list_id
FROM list
WHERE name = :listname;
if (!flags)
return MR_SUCCESS;
- /* check for client in access control list */
+ /* If the user is a member of the acl, memacl, or the list itself,
+ * accept them.
+ */
status = find_member(acl_type, acl_id, cl);
if (!status)
- {
- status = find_member(memacl_type, memacl_id, cl);
- if (!status)
- return MR_PERM;
- }
+ status = find_member(memacl_type, memacl_id, cl);
+ if (!status)
+ status = find_member("LIST", list_id, cl);
+ if (!status)
+ return MR_PERM;
+
return MR_SUCCESS;
}