]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
totp: The fr_totp_cmp() expects token in call_env 'user_password'
authorJorge Pereira <jpereira@freeradius.org>
Wed, 4 Oct 2023 16:43:11 +0000 (13:43 -0300)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 6 Oct 2023 11:26:46 +0000 (07:26 -0400)
Which is taken from control.TOTP.From-User

src/modules/rlm_totp/rlm_totp.c

index 077a235a05a983fb4caa41dbf8dbc67e2289a0e5..cb5c229763b0e227b190e3e3492652b92f4f8095 100644 (file)
@@ -77,9 +77,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
        CONF_SECTION *conf = mctx->inst->conf;
 
        inst->name = cf_section_name2(conf);
-               if (!inst->name) {
-               inst->name = cf_section_name1(conf);
-       }
+       if (!inst->name) inst->name = cf_section_name1(conf);
 
        return 0;
 }
@@ -163,7 +161,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authenticate(rlm_rcode_t *p_result,
                our_keylen = len;
        }
 
-       if (fr_totp_cmp(&inst->totp, request, fr_time_to_sec(request->packet->timestamp), our_key, our_keylen, secret->vb_strvalue) != 0) RETURN_MODULE_FAIL;
+       if (fr_totp_cmp(&inst->totp, request, fr_time_to_sec(request->packet->timestamp), our_key, our_keylen, user_password->vb_strvalue) != 0) RETURN_MODULE_FAIL;
 
        RETURN_MODULE_OK;
 }