Skip to content
Snippets Groups Projects
Commit fd395a3c authored by Moe Jette's avatar Moe Jette
Browse files

Minor change to security_2_4.c

Added security_2_2.c
parent bab9505e
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ TESTS =
# job_mgr-test
check_PROGRAMS = \
security_2_2 \
security_2_4 \
$(TESTS)
#
......
#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>
typedef void * Buf;
/* Attempt to run a job without a credential */
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();
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 {
printf ("SUCCESS!\n");
printf ("The allocate request was rejected as expected.\n");
printf ("Check SlurmctldLog for an error message.\n");
exit(0);
}
}
/* This version supersedes that in libslurm, so a credential is not packed */
int g_slurm_auth_pack(void * auth_cred, Buf buffer)
{
return 0;
}
......@@ -26,10 +26,9 @@ main (int argc, char *argv[])
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);
"ERROR: Wrong error code received: %s instead of %s\n",
slurm_strerror(error_code), "ESLURM_USER_ID_MISSING");
exit(1);
} else {
printf ("SUCCESS!\n");
printf ("The allocate request was rejected as expected.\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment