radius (challenge-response): add MAX_CHALLENGES macro as a limit of password requests

max-challenge configuration option removed as redundant; replaced by static constraint
via MAX_CHALLENGES macro

radius (challenge-response): remove  max-challenge configuration parameter

Signed-off-by: Alexey Dotsenko <lex@rwx.su>
This commit is contained in:
Alexey Dotsenko
2019-05-29 16:01:58 +03:00
parent 0153172c03
commit 97592426ce

View File

@@ -59,6 +59,8 @@
# define CHALLENGE_RC 3
#endif
#define MAX_CHALLENGES 16
static void radius_vhost_init(void **_vctx, void *pool, void *additional)
{
radius_cfg_st *config = additional;
@@ -452,10 +454,10 @@ static int radius_auth_pass(void *ctx, const char *pass, unsigned pass_len)
vp = vp->next;
}
/* PW_STATE or PW_REPLY_MESSAGE is empty*/
if ((pctx->pass_msg[0] == 0) || (pctx->state == NULL)) {
/* PW_STATE or PW_REPLY_MESSAGE is empty or MAX_CHALLENGES limit exceeded*/
if ((pctx->pass_msg[0] == 0) || (pctx->state == NULL) || (pctx->passwd_counter >= MAX_CHALLENGES)) {
strlcpy(pctx->pass_msg, pass_msg_failed, sizeof(pctx->pass_msg));
syslog(LOG_ERR, "radius-auth: Access-Challenge with invalid State or Reply-Message");
syslog(LOG_ERR, "radius-auth: Access-Challenge with invalid State or Reply-Message, or max number of password requests exceeded");
ret = ERR_AUTH_FAIL;
}
goto cleanup;