unlang_action_t od_mschap_auth(unlang_result_t *p_result, request_t *request, fr_pair_t *challenge, fr_pair_t *usernamepair,
mschap_auth_call_env_t *env_data)
{
- rlm_rcode_t rcode = RLM_MODULE_OK;
tDirStatus status = eDSNoErr;
tDirReference dsRef = 0;
tDirNodeReference userNodeRef = 0;
RETURN_UNLANG_FAIL;
}
- getUserNodeRef(p_result, request, username_string, &short_user_name, &userNodeRef, dsRef);
- if (rcode != RLM_MODULE_OK) {
- if (rcode != RLM_MODULE_NOOP) {
+ (void) getUserNodeRef(p_result, request, username_string, &short_user_name, &userNodeRef, dsRef);
+ if (p_result->rcode != RLM_MODULE_OK) {
+ if (p_result->rcode != RLM_MODULE_NOOP) {
RDEBUG2("od_mschap_auth: getUserNodeRef() failed");
}
if (username_string != NULL)
talloc_free(username_string);
if (dsRef != 0)
dsCloseDirService(dsRef);
- RETURN_UNLANG_RCODE(rcode);
+ return UNLANG_ACTION_CALCULATE_RESULT;
}
/* We got a node; fill the stepBuffer
/*
* Read from the child
*/
- len = radius_readfrom_program_legacy(from_child, pid, fr_time_delta_from_sec(10), buf, sizeof(buf));
+ len = radius_readfrom_program_legacy(from_child, pid, fr_time_delta_from_sec(10), buf, sizeof(buf) - 1);
if (len < 0) {
/* radius_readfrom_program_legacy will have closed from_child for us */
REDEBUG("Failure reading from child");
MEM(evp_ctx = EVP_CIPHER_CTX_new());
if (unlikely(EVP_EncryptInit_ex(evp_ctx, EVP_rc4(), NULL, auth_ctx->nt_password->vp_octets, NULL) != 1)) {
+ EVP_CIPHER_CTX_free(evp_ctx);
fr_tls_strerror_printf(NULL);
RPERROR("Failed initialising RC4 ctx");
return -1;
}
if (unlikely(EVP_CIPHER_CTX_set_key_length(evp_ctx, auth_ctx->nt_password->vp_length)) != 1) {
+ EVP_CIPHER_CTX_free(evp_ctx);
fr_tls_strerror_printf(NULL);
RPERROR("Failed setting key length");
return -1;
}
if (unlikely(EVP_EncryptUpdate(evp_ctx, nt_pass_decrypted, &ntlen, auth_ctx->cpw_ctx->new_nt_encrypted, ntlen) != 1)) {
+ EVP_CIPHER_CTX_free(evp_ctx);
fr_tls_strerror_printf(NULL);
RPERROR("Failed ingesting new password");
return -1;