diff --git a/src/common/credential_utils.c b/src/common/credential_utils.c index cfe8d9092c7adadb496cf0110197e49dfdb96aa9..5eb041bdad14e202cc0f3703f95ab9f8a2f2ca81 100644 --- a/src/common/credential_utils.c +++ b/src/common/credential_utils.c @@ -92,7 +92,6 @@ verify_credential(slurm_ssl_key_ctx_t * ctx, slurm_job_credential_t * cred, { int rc; time_t now = time(NULL); - char this_node_name[MAX_NAME_LEN]; int length; Buf buffer; @@ -104,21 +103,28 @@ verify_credential(slurm_ssl_key_ctx_t * ctx, slurm_job_credential_t * cred, cred->signature, SLURM_SSL_SIGNATURE_LENGTH); free_buf(buffer); - if (rc) + if (rc) { + error("Invalid credential submitted"); slurm_seterrno_ret(ESLURMD_INVALID_JOB_CREDENTIAL); + } - if (cred->expiration_time < now) + if (cred->expiration_time < now) { + error("credential has expired expiration=%lx now=%lx", + (long)cred->expiration_time , (long)now); slurm_seterrno_ret(ESLURMD_CREDENTIAL_EXPIRED); + } +#if WE_WANT_TO_CONFIRM_NODELIST_IN_CREDENTIAL + /* FIXME:XXX: if so desired */ + char this_node_name[MAX_NAME_LEN]; if ((rc = getnodename(this_node_name, MAX_NAME_LEN))) fatal("slurmd: getnodename: %m"); - /* XXX: Fix this I suppose? if ( verify_node_name_list ( this_node_name , credential->node_list ) ) slurm_seterrno_ret( ESLURMD_NODE_NAME_NOT_PRESENT_IN_CREDENTIAL); - */ +#endif /* XXX: * need code to check to make sure that only the specified @@ -140,12 +146,12 @@ void print_credential(slurm_job_credential_t * cred) for (i=0; i<SLURM_SSL_SIGNATURE_LENGTH; i+=sizeof(long)) { memcpy(&long_tmp, &cred->signature[i], sizeof(long)); - sprintf(&sig_str[(j++)*9], "%8lx ", long_tmp); + sprintf(&sig_str[(j++)*9], "%8lx ", long_tmp); } - info("cred uid:%u job_id:%u time:%lx", - cred->user_id, cred->job_id, (long)cred->expiration_time); - info("cred signature:%s", sig_str); + info("cred uid:%u job_id:%u time:%lx", + cred->user_id, cred->job_id, (long)cred->expiration_time); + info("cred signature:%s", sig_str); } int revoke_credential(revoke_credential_msg_t * msg, List list) diff --git a/src/common/signature_utils.c b/src/common/signature_utils.c index b9f6449f14d6feea75dc84b426eef76f5948c130..61d7f5aeb77620ff8a73e7c2833c7250573f2cd3 100644 --- a/src/common/signature_utils.c +++ b/src/common/signature_utils.c @@ -35,7 +35,7 @@ int slurm_init_signer(slurm_ssl_key_ctx_t * ctx, char *path) FILE *key_file; if ((key_file = fopen(path, "r")) == NULL) { local_errno = errno; - error("can't open key file '%s' : %m", + fatal("can't open key file '%s' : %m", path); return SLURM_ERROR; }; @@ -57,7 +57,7 @@ int slurm_init_verifier(slurm_ssl_key_ctx_t * ctx, char *path) FILE *cert_file; if ((cert_file = fopen(path, "r")) == NULL) { local_errno = errno; - error("can't open certificate file '%s' : %m ", path); + fatal("can't open certificate file '%s' : %m ", path); return SLURM_ERROR; };