mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-08-09 01:41:48 +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 (rc_avpair_add(pctx->vctx->rh, &send, PW_STATE, pctx->state,
|
||||
-1, 0) == NULL) {
|
||||
pctx->state_len, 0) == NULL) {
|
||||
oc_syslog(
|
||||
LOG_ERR,
|
||||
"%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);
|
||||
pctx->state = NULL;
|
||||
pctx->state_len = 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 &&
|
||||
vp->type == PW_TYPE_STRING) {
|
||||
/* State */
|
||||
if (vp->lvalue > 0)
|
||||
pctx->state = talloc_strdup(
|
||||
pctx, vp->strvalue);
|
||||
if (vp->lvalue > 0) {
|
||||
pctx->state = talloc_memdup(
|
||||
pctx, vp->strvalue, vp->lvalue);
|
||||
pctx->state_len =
|
||||
pctx->state ? vp->lvalue : 0;
|
||||
}
|
||||
|
||||
pctx->id++;
|
||||
oc_syslog(
|
||||
LOG_DEBUG,
|
||||
"radius-auth: Access-Challenge response stage %u, State %s",
|
||||
pctx->passwd_counter, vp->strvalue);
|
||||
"radius-auth: Access-Challenge response stage %u, State length %u",
|
||||
pctx->passwd_counter, vp->lvalue);
|
||||
ret = ERR_AUTH_CONTINUE;
|
||||
}
|
||||
vp = vp->next;
|
||||
|
||||
@@ -74,6 +74,7 @@ struct radius_ctx_st {
|
||||
|
||||
struct radius_vhost_ctx *vctx;
|
||||
char *state;
|
||||
unsigned int state_len;
|
||||
unsigned int passwd_counter;
|
||||
size_t prev_prompt_hash;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user