From 300b68fd78e84887bc81599c147f547e315e0feb Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Thu, 28 Nov 2002 00:53:14 +0000 Subject: [PATCH] Add some credential error log messages. Fix bug in credential signature logging. --- src/common/credential_utils.c | 12 ++++++------ src/common/signature_utils.c | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/common/credential_utils.c b/src/common/credential_utils.c index e9714fc9acb..cfe8d9092c7 100644 --- a/src/common/credential_utils.c +++ b/src/common/credential_utils.c @@ -134,18 +134,18 @@ verify_credential(slurm_ssl_key_ctx_t * ctx, slurm_job_credential_t * cred, void print_credential(slurm_job_credential_t * cred) { - int i; + int i, j = 0; long long_tmp; - char sig_str[SLURM_SSL_SIGNATURE_LENGTH*3]; + char sig_str[SLURM_SSL_SIGNATURE_LENGTH*4]; for (i=0; i<SLURM_SSL_SIGNATURE_LENGTH; i+=sizeof(long)) { memcpy(&long_tmp, &cred->signature[i], sizeof(long)); - sprintf(&sig_str[i*9], "%8lx ", long_tmp); + sprintf(&sig_str[(j++)*9], "%8lx ", long_tmp); } - info("cred uid:%u job_id:%u time:%lx signature:%s", - cred->user_id, cred->job_id, (long)cred->expiration_time, - 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 9c3ec483277..b9f6449f14d 100644 --- a/src/common/signature_utils.c +++ b/src/common/signature_utils.c @@ -65,7 +65,7 @@ int slurm_init_verifier(slurm_ssl_key_ctx_t * ctx, char *path) fclose(cert_file); if (x509 == NULL) { - /* ERR_print_errors_fp(log_fp()); */ + error("PEM_read_X509 error on %s",path); slurm_seterrno(ESLURMD_OPENSSL_ERROR); return SLURM_ERROR; } @@ -74,7 +74,7 @@ int slurm_init_verifier(slurm_ssl_key_ctx_t * ctx, char *path) X509_free(x509); if (ctx->key.public == NULL) { - /* ERR_print_errors_fp(log_fp()); */ + error("X509_get_pubkey no key in",path); slurm_seterrno(ESLURMD_OPENSSL_ERROR); return SLURM_ERROR; } @@ -124,7 +124,8 @@ slurm_ssl_verify(slurm_ssl_key_ctx_t * ctx, char *data_buffer, if ((rc = EVP_VerifyFinal(&md_ctx, signature_buffer, signature_length, ctx->key.public)) != SLURM_OPENSSL_VERIFIED) { - /* ERR_print_errors_fp(log_fp()); */ + error("EVP_VerifyFinal: %s", + ERR_error_string(ERR_get_error(), NULL)); slurm_seterrno_ret(ESLURMD_OPENSSL_ERROR); } return SLURM_SUCCESS; -- GitLab