Skip to content

Commit

Permalink
libflux/msg_handler: special case FLUX_ROLE_OWNER
Browse files Browse the repository at this point in the history
Problem: it is confusing to have FLUX_ROLE_OWNER implicitly
set in the message handler rolemask when the user can't
manipulate that bit.

Take FLUX_ROLE_OWNER out of the rolemask and special case it
in call_handler() so it's more clear what is going on.

The net result is the same as before - FLUX_ROLE_OWNER is
always "allowed".
  • Loading branch information
garlick committed Nov 11, 2017
1 parent 08cd966 commit 83fb802
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/common/libflux/msg_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static void call_handler (flux_msg_handler_t *mh, const flux_msg_t *msg)

if (flux_msg_get_rolemask (msg, &rolemask) < 0)
return;
if (!(rolemask & mh->rolemask)) {
if (!(rolemask & FLUX_ROLE_OWNER) && !(rolemask & mh->rolemask)) {
if (flux_msg_cmp (msg, FLUX_MATCH_REQUEST)
&& flux_msg_get_matchtag (msg, &matchtag) == 0
&& matchtag != FLUX_MATCHTAG_NONE) {
Expand Down Expand Up @@ -483,7 +483,6 @@ void flux_msg_handler_deny_rolemask (flux_msg_handler_t *mh, uint32_t rolemask)
{
if (mh) {
mh->rolemask &= ~rolemask;
mh->rolemask |= FLUX_ROLE_OWNER;
}
}

Expand Down Expand Up @@ -532,7 +531,7 @@ flux_msg_handler_t *flux_msg_handler_create (flux_t *h,
mh->magic = HANDLER_MAGIC;
if (copy_match (&mh->match, match) < 0)
goto nomem;
mh->rolemask = FLUX_ROLE_OWNER;
mh->rolemask = 0;
mh->fn = cb;
mh->arg = arg;
mh->d = d;
Expand Down

0 comments on commit 83fb802

Please sign in to comment.