diff --git a/testsuite/slurm_unit/slurmctld/Makefile.am b/testsuite/slurm_unit/slurmctld/Makefile.am index a8fbe1361b1307ec1a8ac091c0707a900d4efb33..f66974279e62d9cd744349b759ea663ce6f80c5b 100644 --- a/testsuite/slurm_unit/slurmctld/Makefile.am +++ b/testsuite/slurm_unit/slurmctld/Makefile.am @@ -1,7 +1,12 @@ AUTOMAKE_OPTIONS = foreign noinst_HEADERS = get_resp.h + +TESTS = +# job_mgr-test + check_PROGRAMS = \ + security_2_4 \ $(TESTS) # # None of these tests can be compiled until functions called @@ -16,8 +21,6 @@ check_PROGRAMS = \ # step_create # -TESTS = -# job_mgr-test INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common @@ -39,19 +42,19 @@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common # $(top_builddir)/src/api/libslurm.la LDADD = $(top_builddir)/src/common/libcommon.la \ - $(top_builddir)/src/common/libhostlist.la \ - $(top_builddir)/src/slurmctld/agent.o \ - $(top_builddir)/src/slurmctld/job_scheduler.o \ - $(top_builddir)/src/slurmctld/node_scheduler.o \ - $(top_builddir)/src/slurmctld/partition_mgr.o \ - $(top_builddir)/src/slurmctld/step_mgr.o \ - $(top_builddir)/src/slurmctld/job_mgr.o \ - $(top_builddir)/src/slurmctld/node_mgr.o \ - $(top_builddir)/src/slurmctld/locks.o \ - $(top_builddir)/src/slurmctld/read_config.o \ - $(top_builddir)/src/common/parse_spec.o \ - $(top_builddir)/src/api/libslurm.la \ + $(top_builddir)/src/api/libslurm.la $(SSL_LIBS) +# $(top_builddir)/src/common/libhostlist.la \ +# $(top_builddir)/src/slurmctld/agent.o \ +# $(top_builddir)/src/slurmctld/job_scheduler.o \ +# $(top_builddir)/src/slurmctld/node_scheduler.o \ +# $(top_builddir)/src/slurmctld/partition_mgr.o \ +# $(top_builddir)/src/slurmctld/step_mgr.o \ +# $(top_builddir)/src/slurmctld/job_mgr.o \ +# $(top_builddir)/src/slurmctld/node_mgr.o \ +# $(top_builddir)/src/slurmctld/locks.o \ +# $(top_builddir)/src/slurmctld/read_config.o \ +# $(top_builddir)/src/common/parse_spec.o \ force : $(LDADD) : force diff --git a/testsuite/slurm_unit/slurmctld/security_2_4.c b/testsuite/slurm_unit/slurmctld/security_2_4.c new file mode 100644 index 0000000000000000000000000000000000000000..2217a2ffaeda12ea905106e77d3e4a32b520974a --- /dev/null +++ b/testsuite/slurm_unit/slurmctld/security_2_4.c @@ -0,0 +1,40 @@ +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <unistd.h> + +#include <slurm/slurm.h> +#include <slurm/slurm_errno.h> + +/* Attempt to run a job with the incorrect user id and confirm an error */ +int +main (int argc, char *argv[]) +{ + int error_code; + job_desc_msg_t job_mesg; + resource_allocation_and_run_response_msg_t* run_resp_msg ; + + slurm_init_job_desc_msg( &job_mesg ); + job_mesg. user_id = getuid() + 1; + job_mesg. min_nodes = 1; + + error_code = slurm_allocate_resources_and_run ( &job_mesg , + &run_resp_msg ); + if (error_code == SLURM_SUCCESS) { + fprintf (stderr, "ERROR: The allocate succeeded\n"); + exit(1); + } else if ((error_code = slurm_get_errno()) != ESLURM_USER_ID_MISSING) { + fprintf (stderr, + "ERROR: Wrong error code received %d instead of %d\n", + error_code, ESLURM_USER_ID_MISSING); + exit(1); + + } else { + printf ("SUCCESS!\n"); + printf ("The allocate request was rejected as expected.\n"); + printf ("Check SlurmctldLog for an error message.\n"); + exit(0); + } +} +