Skip to content

Commit cbe957d

Browse files
committed
job-info: check for invalid flags
Problem: The job-info.lookup target does not check for invalid flags. Add check for invalid flags.
1 parent ed93f73 commit cbe957d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/modules/job-info/lookup.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ void lookup_cb (flux_t *h, flux_msg_handler_t *mh,
301301
flux_jobid_t id;
302302
uint32_t rolemask;
303303
int flags;
304+
int valid_flags = 0;
305+
const char *errmsg = NULL;
304306

305307
if (flux_request_unpack (msg, NULL, "{s:I s:o s:i}",
306308
"id", &id,
@@ -310,6 +312,12 @@ void lookup_cb (flux_t *h, flux_msg_handler_t *mh,
310312
goto error;
311313
}
312314

315+
if (flags & ~valid_flags) {
316+
errno = EPROTO;
317+
errmsg = "lookup request rejected with invalid flag";
318+
goto error;
319+
}
320+
313321
if (!(l = lookup_ctx_create (ctx, msg, id, keys, flags)))
314322
goto error;
315323

@@ -336,7 +344,7 @@ void lookup_cb (flux_t *h, flux_msg_handler_t *mh,
336344
return;
337345

338346
error:
339-
if (flux_respond_error (h, msg, errno, NULL) < 0)
347+
if (flux_respond_error (h, msg, errno, errmsg) < 0)
340348
flux_log_error (h, "%s: flux_respond_error", __FUNCTION__);
341349
lookup_ctx_destroy (l);
342350
}

0 commit comments

Comments
 (0)