Skip to content

Commit

Permalink
modules/connector-local: add simulated auth failure
Browse files Browse the repository at this point in the history
If debug_flags bit 1 is set, simulate one auth failure.
A test can set this bit and then attempt to connect
to verify that EPERM is returned to flux_open().
  • Loading branch information
garlick committed Mar 2, 2017
1 parent 480e4cf commit 3bfc8f8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/modules/connector-local/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ static client_t * client_create (mod_local_ctx_t *ctx, int fd)
errno = EPERM;
goto error;
}
int *debug_flags = flux_aux_get (h, "flux::debug_flags");
if (debug_flags && (*debug_flags & 1)) {
flux_log (h, LOG_ERR, "connect by uid=%d pid=%d denied by debug flag",
c->ucred.uid, (int)c->ucred.pid);
*debug_flags &= ~1; // one shot
errno = EPERM;
goto error;
}
if (!(c->inw = flux_fd_watcher_create (ctx->reactor, fd, FLUX_POLLIN,
client_read_cb, c)) != 0)
goto error;
Expand Down

0 comments on commit 3bfc8f8

Please sign in to comment.