From: Arran Cudbard-Bell Date: Thu, 28 Mar 2019 07:50:56 +0000 (+0800) Subject: Fix various bits of auth logic in rlm_rest X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1799aec4d75aeca99491fa873502a0e2fbef660f;p=thirdparty%2Ffreeradius-server.git Fix various bits of auth logic in rlm_rest --- diff --git a/src/modules/rlm_rest/rest.c b/src/modules/rlm_rest/rest.c index f7ed079049d..1d0ce7b2d55 100644 --- a/src/modules/rlm_rest/rest.c +++ b/src/modules/rlm_rest/rest.c @@ -1965,7 +1965,7 @@ int rest_request_config(rlm_rest_t const *inst, rlm_rest_thread_t *t, rlm_rest_s /* * Set user based authentication parameters */ - if (auth) { + if (auth > REST_HTTP_AUTH_NONE) { TALLOC_CTX *cred_ctx = NULL; #define SET_AUTH_OPTION(_x, _y)\ diff --git a/src/modules/rlm_rest/rlm_rest.c b/src/modules/rlm_rest/rlm_rest.c index 6ab36f7b45f..84dcd5d736c 100644 --- a/src/modules/rlm_rest/rlm_rest.c +++ b/src/modules/rlm_rest/rlm_rest.c @@ -86,7 +86,7 @@ static const CONF_PARSER section_config[] = { { FR_CONF_OFFSET_IS_SET("auth", FR_TYPE_VOID, rlm_rest_section_t, auth), .func = cf_table_parse_int, .uctx = http_auth_table, .dflt = "none" }, { FR_CONF_OFFSET("username", FR_TYPE_STRING | FR_TYPE_XLAT, rlm_rest_section_t, username) }, - { FR_CONF_OFFSET("password", FR_TYPE_STRING | FR_TYPE_XLAT, rlm_rest_section_t, password) }, + { FR_CONF_OFFSET("password", FR_TYPE_STRING | FR_TYPE_SECRET | FR_TYPE_XLAT, rlm_rest_section_t, password) }, { FR_CONF_OFFSET("require_auth", FR_TYPE_BOOL, rlm_rest_section_t, require_auth), .dflt = "no" }, /* Transfer configuration */ @@ -869,7 +869,7 @@ static int parse_sub_section(rlm_rest_t *inst, CONF_SECTION *parent, CONF_PARSER /* * Enable Basic-Auth automatically if username/password were passed */ - if (!config->auth_is_set && config->username && config->password && http_curl_auth[config->auth]) { + if (!config->auth_is_set && config->username && config->password && http_curl_auth[REST_HTTP_AUTH_BASIC]) { cf_log_debug(cs, "Setting auth = 'basic' as credentials were provided, but no auth method " "was set"); config->auth = REST_HTTP_AUTH_BASIC;