Skip to content

Commit

Permalink
acl: Add and use ACL_USER_CONTEXT_REQUIRE
Browse files Browse the repository at this point in the history
Satisfies static analyzers
  • Loading branch information
cmouse authored and mrannanj committed Feb 20, 2018
1 parent 86f3bd9 commit 7536e28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/plugins/acl/acl-mailbox-list.c
Expand Up @@ -551,14 +551,14 @@ static void acl_mailbox_list_init_default(struct mailbox_list *list)

void acl_mail_namespace_storage_added(struct mail_namespace *ns)
{
struct acl_user *auser = ACL_USER_CONTEXT(ns->user);
struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(ns->list);
struct acl_backend *backend;
const char *current_username, *owner_username;
bool owner = TRUE;

if (alist == NULL)
return;
struct acl_user *auser = ACL_USER_CONTEXT_REQUIRE(ns->user);

owner_username = ns->user->username;
current_username = auser->acl_user;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/acl/acl-plugin.h
Expand Up @@ -16,6 +16,8 @@
MODULE_CONTEXT_REQUIRE(obj, acl_mailbox_list_module)
#define ACL_USER_CONTEXT(obj) \
MODULE_CONTEXT(obj, acl_user_module)
#define ACL_USER_CONTEXT_REQUIRE(obj) \
MODULE_CONTEXT_REQUIRE(obj, acl_user_module)

struct acl_user {
union mail_user_module_context module_ctx;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/acl/doveadm-acl.c
Expand Up @@ -353,7 +353,7 @@ cmd_acl_debug_mailbox_open(struct doveadm_mail_cmd_context *ctx,
struct mail_user *user, const char *mailbox,
struct mailbox **box_r)
{
struct acl_user *auser = ACL_USER_CONTEXT(user);
struct acl_user *auser = ACL_USER_CONTEXT_REQUIRE(user);
struct mail_namespace *ns;
struct mailbox *box;
const char *path, *errstr;
Expand Down Expand Up @@ -394,7 +394,7 @@ cmd_acl_debug_mailbox_open(struct doveadm_mail_cmd_context *ctx,
static bool cmd_acl_debug_mailbox(struct mailbox *box, bool *retry_r)
{
struct mail_namespace *ns = mailbox_get_namespace(box);
struct acl_user *auser = ACL_USER_CONTEXT(ns->user);
struct acl_user *auser = ACL_USER_CONTEXT_REQUIRE(ns->user);
struct acl_object *aclobj = acl_mailbox_get_aclobj(box);
struct acl_backend *backend = acl_mailbox_list_get_backend(box->list);
struct acl_mailbox_list_context *iter;
Expand Down

0 comments on commit 7536e28

Please sign in to comment.