]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix various bits of auth logic in rlm_rest
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 28 Mar 2019 07:50:56 +0000 (15:50 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 28 Mar 2019 07:50:56 +0000 (15:50 +0800)
src/modules/rlm_rest/rest.c
src/modules/rlm_rest/rlm_rest.c

index f7ed079049dc4bed4bf45616109b36dc44b5d087..1d0ce7b2d5597cca178f1460f88f63b66fca9572 100644 (file)
@@ -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)\
index 6ab36f7b45f339d51791d8931525b7288469b6f0..84dcd5d736c0c648b021415c6934c6713c5f40ff 100644 (file)
@@ -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;