mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-08-09 09:51:49 +08:00
Merge branch 'tmp-729' into 'master'
Handle RADIUS Access-Challenge State as bytes Closes #729 See merge request openconnect/ocserv!576
This commit is contained in:
+10
-6
@@ -411,7 +411,7 @@ static int radius_auth_pass(void *ctx, const char *pass, unsigned int pass_len)
|
|||||||
|
|
||||||
if (pctx->state != NULL) {
|
if (pctx->state != NULL) {
|
||||||
if (rc_avpair_add(pctx->vctx->rh, &send, PW_STATE, pctx->state,
|
if (rc_avpair_add(pctx->vctx->rh, &send, PW_STATE, pctx->state,
|
||||||
-1, 0) == NULL) {
|
pctx->state_len, 0) == NULL) {
|
||||||
oc_syslog(
|
oc_syslog(
|
||||||
LOG_ERR,
|
LOG_ERR,
|
||||||
"%s:%u: error in constructing radius message for user '%s'",
|
"%s:%u: error in constructing radius message for user '%s'",
|
||||||
@@ -421,6 +421,7 @@ static int radius_auth_pass(void *ctx, const char *pass, unsigned int pass_len)
|
|||||||
}
|
}
|
||||||
talloc_free(pctx->state);
|
talloc_free(pctx->state);
|
||||||
pctx->state = NULL;
|
pctx->state = NULL;
|
||||||
|
pctx->state_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pctx->pass_msg[0] = 0;
|
pctx->pass_msg[0] = 0;
|
||||||
@@ -593,15 +594,18 @@ static int radius_auth_pass(void *ctx, const char *pass, unsigned int pass_len)
|
|||||||
if (vp->attribute == PW_STATE &&
|
if (vp->attribute == PW_STATE &&
|
||||||
vp->type == PW_TYPE_STRING) {
|
vp->type == PW_TYPE_STRING) {
|
||||||
/* State */
|
/* State */
|
||||||
if (vp->lvalue > 0)
|
if (vp->lvalue > 0) {
|
||||||
pctx->state = talloc_strdup(
|
pctx->state = talloc_memdup(
|
||||||
pctx, vp->strvalue);
|
pctx, vp->strvalue, vp->lvalue);
|
||||||
|
pctx->state_len =
|
||||||
|
pctx->state ? vp->lvalue : 0;
|
||||||
|
}
|
||||||
|
|
||||||
pctx->id++;
|
pctx->id++;
|
||||||
oc_syslog(
|
oc_syslog(
|
||||||
LOG_DEBUG,
|
LOG_DEBUG,
|
||||||
"radius-auth: Access-Challenge response stage %u, State %s",
|
"radius-auth: Access-Challenge response stage %u, State length %u",
|
||||||
pctx->passwd_counter, vp->strvalue);
|
pctx->passwd_counter, vp->lvalue);
|
||||||
ret = ERR_AUTH_CONTINUE;
|
ret = ERR_AUTH_CONTINUE;
|
||||||
}
|
}
|
||||||
vp = vp->next;
|
vp = vp->next;
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ struct radius_ctx_st {
|
|||||||
|
|
||||||
struct radius_vhost_ctx *vctx;
|
struct radius_vhost_ctx *vctx;
|
||||||
char *state;
|
char *state;
|
||||||
|
unsigned int state_len;
|
||||||
unsigned int passwd_counter;
|
unsigned int passwd_counter;
|
||||||
size_t prev_prompt_hash;
|
size_t prev_prompt_hash;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user