]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check rad_debug_lvl correctly, so the messages are enabled/disabled based on request...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 4 Jan 2019 07:30:09 +0000 (15:30 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 4 Jan 2019 07:30:34 +0000 (15:30 +0800)
Reduce manual calls to hex printing functions

22 files changed:
src/lib/server/cf_parse.c
src/lib/server/cf_util.c
src/lib/server/exec.c
src/lib/server/main_config.c
src/lib/server/map.c
src/lib/server/process.c
src/lib/server/state.c
src/lib/sim/decode.c
src/lib/tls/session.c
src/lib/unlang/compile.c
src/modules/proto_dhcpv4/proto_dhcpv4_base.c
src/modules/proto_radius/proto_radius.c
src/modules/proto_radius/proto_radius_auth.c
src/modules/rlm_attr_filter/rlm_attr_filter.c
src/modules/rlm_chap/rlm_chap.c
src/modules/rlm_digest/rlm_digest.c
src/modules/rlm_ldap/user.c
src/modules/rlm_pap/rlm_pap.c
src/modules/rlm_perl/rlm_perl.c
src/modules/rlm_sigtran/rlm_sigtran.c
src/modules/rlm_wimax/rlm_wimax.c
src/modules/rlm_yubikey/decrypt.c

index e1ead64558d860128c0001c461a4eeec1bf8a344..35e808ef73f03a7c15c9ae4960dfc2ee3f8f076d 100644 (file)
@@ -1200,7 +1200,7 @@ int cf_section_parse(TALLOC_CTX *ctx, void *base, CONF_SECTION *cs)
         *      Warn about items in the configuration which weren't
         *      checked during parsing.
         */
-       if (rad_debug_lvl >= 3) cf_section_parse_warn(cs);
+       if (DEBUG_ENABLED4) cf_section_parse_warn(cs);
 
        cf_log_debug(cs, "%.*s}", SECTION_SPACE(cs), parse_spaces);
 
index 6a5445fe88ed718fc7599856d32b3ac110f87cdf..4ee1141a9805f8fc930f91e8a7ef2db9ed4f3f51 100644 (file)
@@ -1873,7 +1873,7 @@ void _cf_log_debug(CONF_ITEM const *ci, char const *fmt, ...)
        va_list ap;
        char    *msg;
 
-       if (rad_debug_lvl < 1) return;
+       if (!DEBUG_ENABLED) return;
 
        va_start(ap, fmt);
        msg = fr_vasprintf(NULL, fmt, ap);
@@ -1904,7 +1904,7 @@ void _cf_log_debug_prefix(CONF_ITEM const *ci, char const *fmt, ...)
        va_list ap;
        char    *msg;
 
-       if (rad_debug_lvl < 1) return;
+       if (!DEBUG_ENABLED) return;
 
        va_start(ap, fmt);
        msg = fr_vasprintf(NULL, fmt, ap);
index a52d8d9cbcefc30f4c43fea51ecdc7e462df9b6c..bbadfe6b176200a4e9cbb5585ca55b27316ea9a1 100644 (file)
@@ -308,9 +308,7 @@ pid_t radius_start_program(char const *cmd, REQUEST *request, bool exec_wait,
                 *      If we are debugging, then we want the error
                 *      messages to go to the STDERR of the server.
                 */
-               if (rad_debug_lvl == 0) {
-                       dup2(devnull, STDERR_FILENO);
-               }
+               if (!RDEBUG_ENABLED) dup2(devnull, STDERR_FILENO);
                close(devnull);
 
                /*
index 390cd9b02a2ecebf38f55fbe8ef62bafc56d3c84..d5240d2702749530aab17858b11c3540fc15f050 100644 (file)
@@ -606,8 +606,10 @@ static int switch_users(main_config_t *config, CONF_SECTION *cs)
         *      Don't do chroot/setuid/setgid if we're in debugging
         *      as non-root.
         */
-       if (rad_debug_lvl && (getuid() != 0)) return 0;
-
+       if (DEBUG_ENABLED && (getuid() != 0)) {
+               WARN("Ignoring configured UID / GID / chroot as we're running in debug mode");
+               return 0;
+       }
 #ifdef HAVE_GRP_H
        /*
         *      Get the correct GID for the server.
index 14520374d7f23dfd316bc9b62683b05cb22c33d9..56218bbccc0acc1decb198737e812a8ee4129c2e 100644 (file)
@@ -2452,14 +2452,14 @@ int map_to_request(REQUEST *request, vp_map_t const *map, radius_map_getvalue_t
                        goto finish;
                }
        } else {
-               if (rad_debug_lvl) map_debug_log(request, map, NULL);
+               if (RDEBUG_ENABLED) map_debug_log(request, map, NULL);
        }
 
        /*
         *      Print the VPs
         */
 #ifndef WITH_VERIFY_PTR
-       if (rad_debug_lvl)
+       if (RDEBUG_ENABLED)
 #endif
        {
                for (vp = fr_pair_cursor_init(&src_list, &head);
@@ -2467,7 +2467,7 @@ int map_to_request(REQUEST *request, vp_map_t const *map, radius_map_getvalue_t
                     vp = fr_pair_cursor_next(&src_list)) {
                        VP_VERIFY(vp);
 
-                       if (rad_debug_lvl) map_debug_log(request, map, vp);
+                       if (RDEBUG_ENABLED) map_debug_log(request, map, vp);
                }
        }
 
index ea6f91ac4d5da1ce271324790455f4f720c7715c..12bd5fc36b5996917905b4e0ee0c4ea1e3f9093d 100644 (file)
@@ -63,7 +63,7 @@ fr_event_list_t *fr_global_event_list(void) {
 
 static int event_status(UNUSED void *ctx, struct timeval *wake)
 {
-       if (rad_debug_lvl == 0) {
+       if (!DEBUG_ENABLED) {
                if (just_started) {
                        INFO("Ready to process requests");
                        just_started = false;
index ab76c6322830306856c29e3b2faef110e2097310..95f9f7f4c69eb70158ec27506a7e11a8d4617f36 100644 (file)
@@ -479,14 +479,8 @@ static fr_state_entry_t *state_entry_create(fr_state_tree_t *state, REQUEST *req
                fr_pair_add(&packet->vps, vp);
        }
 
-       if (DEBUG_ENABLED4) {
-               char hex[(sizeof(entry->state) * 2) + 1];
-
-               fr_bin2hex(hex, entry->state, sizeof(entry->state));
-
-               DEBUG4("State ID %" PRIu64 " created, value 0x%s, expires %" PRIu64 "s",
-                      entry->id, hex, (uint64_t)entry->cleanup - now);
-       }
+       DEBUG4("State ID %" PRIu64 " created, value 0x%pH, expires %" PRIu64 "s",
+              entry->id, fr_box_octets(entry->state, sizeof(entry->state)), (uint64_t)entry->cleanup - now);
 
        PTHREAD_MUTEX_LOCK(&state->mutex);
 
index 95130b48f2a6538729e2171ea0931723c2bd6a13..a238900d9efdb7eb47a53ac6018b23555d981d99 100644 (file)
@@ -463,7 +463,7 @@ static ssize_t sim_decode_tlv(TALLOC_CTX *ctx, fr_cursor_t *cursor,
                         */
                        for (i = 2; i < sim_at_len; i++) zero |= p[i];
                        if (zero) {
-                               fr_strerror_printf("%s: Padding attribute value not zeroed %pV", __FUNCTION__,
+                               fr_strerror_printf("%s: Padding attribute value not zeroed 0x%pH", __FUNCTION__,
                                                   fr_box_octets(p + 2, sim_at_len - 2));
                                goto error;
                        }
index e99aa047617b30992ba18680866eed6b71143f88..178da3680b9cd4f0a8cd60c891d6a9219d92c2d4 100644 (file)
@@ -410,7 +410,7 @@ static void session_msg_log(REQUEST *request, tls_session_t *tls_session)
         *      Don't print this out in the normal course of
         *      operations.
         */
-       if (rad_debug_lvl == 0) return;
+       if (!RDEBUG_ENABLED2) return;
 
        str_write_p = tls_session->info.origin ? ">>> send" : "<<< recv";
 
index 84ef93cc1f63cc074cb87453faf96b7391b82722..5b4b7eaf2f31bbc61057413d3ced94507b081c7a 100644 (file)
@@ -3379,9 +3379,7 @@ int unlang_compile(CONF_SECTION *cs, rlm_components_t component, vp_tmpl_rules_t
                c->debug_name = talloc_typed_asprintf(c, "%s %s", name1, name2);
        }
 
-       if (rad_debug_lvl > 3) {
-               unlang_dump(c, 2);
-       }
+       if (DEBUG_ENABLED4) unlang_dump(c, 2);
 
        /*
         *      Associate the unlang with the configuration section.
index b83f135e6f04188023c4603d2a46da363daa021e..7dbb6f7675eff363bd86f99b174d83a789fe51f2 100644 (file)
@@ -270,9 +270,7 @@ static fr_io_final_t mod_process(UNUSED void const *instance, REQUEST *request,
                        return FR_IO_DONE;
                }
 
-               if (RDEBUG_ENABLED) {
-                       dhcpv4_packet_debug(request, request->reply, false);
-               }
+               if (RDEBUG_ENABLED) dhcpv4_packet_debug(request, request->reply, false);
                break;
 
        default:
index be7f105bb14468dfebd18365f13fd1c1b2c0eacb..2ab1b30f534e866f0c831dcb16284beb00d82481 100644 (file)
@@ -517,9 +517,7 @@ static ssize_t mod_encode(void const *instance, REQUEST *request, uint8_t *buffe
 
                log_request_pair_list(L_DBG_LVL_1, request, request->reply->vps, "");
 
-               if (DEBUG_ENABLED3) {
-                       fr_radius_print_hex(fr_log_fp, buffer, data_len);
-               }
+               if (DEBUG_ENABLED3) fr_radius_print_hex(fr_log_fp, buffer, data_len);
        }
 
        return data_len;
index 171dadddb77885d78f667523735aa9ae899f8067..d7dd9fa02f716f22ad6c52c2729e157bfbcc8b22 100644 (file)
@@ -458,7 +458,7 @@ static fr_io_final_t mod_process(void const *instance, REQUEST *request, fr_io_a
                        if (request->password) {
                                VP_VERIFY(request->password);
 
-                               if ((rad_debug_lvl > 1) && (request->password->da == attr_user_password)) {
+                               if (RDEBUG_ENABLED2 && (request->password->da == attr_user_password)) {
                                        uint8_t const *p;
 
                                        p = (uint8_t const *) request->password->vp_strvalue;
index 5c84cded080c3e0aa24886351f6816513d088e22..0012757acdfe71de1441c6707b3e7c7fa4f66d9a 100644 (file)
@@ -89,9 +89,7 @@ static void check_pair(REQUEST *request, VALUE_PAIR *check_item, VALUE_PAIR *rep
        if (check_item->op == T_OP_SET) return;
 
        compare = fr_pair_cmp(check_item, reply_item);
-       if (compare < 0) {
-               RPEDEBUG("Comparison failed");
-       }
+       if (compare < 0) RPEDEBUG("Comparison failed");
 
        if (compare == 1) {
                ++*(pass);
@@ -99,13 +97,7 @@ static void check_pair(REQUEST *request, VALUE_PAIR *check_item, VALUE_PAIR *rep
                ++*(fail);
        }
 
-       if (RDEBUG_ENABLED3) {
-               char rule[1024], pair[1024];
-
-               fr_pair_snprint(rule, sizeof(rule), check_item);
-               fr_pair_snprint(pair, sizeof(pair), reply_item);
-               RDEBUG3("%s %s %s", pair, compare == 1 ? "allowed by" : "disallowed by", rule);
-       }
+       RDEBUG3("%pP %s %pP", reply_item, compare == 1 ? "allowed by" : "disallowed by", check_item);
 
        return;
 }
index 176e7dce328b6051992b32eb24c11a4867051ad1..59f1f4f2d69a7f975dcc7710803ab20252b492fd 100644 (file)
@@ -143,7 +143,6 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(UNUSED void *instance, UNUS
        if (RDEBUG_ENABLED3) {
                uint8_t const   *p;
                size_t          length;
-               char            *hex;
                VALUE_PAIR      *vp;
 
                RDEBUG3("Comparing with \"known good\" &control:Cleartext-Password value \"%s\"",
@@ -161,17 +160,9 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(UNUSED void *instance, UNUS
                }
 
                RINDENT();
-               hex = fr_abin2hex(request, p, length);
-               RDEBUG3("CHAP challenge : %s", hex);
-               talloc_free(hex);
-
-               hex = fr_abin2hex(request, chap->vp_octets + 1, CHAP_VALUE_LENGTH);
-               RDEBUG3("Client sent    : %s", hex);
-               talloc_free(hex);
-
-               hex = fr_abin2hex(request, pass_str + 1, CHAP_VALUE_LENGTH);
-               RDEBUG3("We calculated  : %s", hex);
-               talloc_free(hex);
+               RDEBUG3("CHAP challenge : %pH", fr_box_octets(p, length));
+               RDEBUG3("Client sent    : %pH", fr_box_octets(chap->vp_octets + 1, CHAP_VALUE_LENGTH));
+               RDEBUG3("We calculated  : %pH", fr_box_octets(pass_str + 1, CHAP_VALUE_LENGTH));
                REXDENT();
        } else {
                RDEBUG2("Comparing with \"known good\" Cleartext-Password");
index 6c5aca17c175759acbd2b8b302e1194f9f67056e..8fa69bb76de5c620e2c39b95523212bd2c0b36ee 100644 (file)
@@ -474,7 +474,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(UNUSED void *instance, UNUS
        fr_bin2hex((char *) kd, hash, sizeof(hash));
 
 #ifndef NRDEBUG
-       if (rad_debug_lvl > 1) {
+       if (RDEBUG_ENABLED2) {
                fr_printf_log("H(A1) = ");
                for (i = 0; i < 16; i++) {
                        fr_printf_log("%02x", hash[i]);
@@ -543,7 +543,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(UNUSED void *instance, UNUS
        fr_bin2hex((char *) kd + kd_len, hash, sizeof(hash));
 
 #ifndef NRDEBUG
-       if (rad_debug_lvl > 1) {
+       if (RDEBUG_ENABLED2) {
                fr_printf_log("H(A2) = ");
                for (i = 0; i < 16; i++) {
                        fr_printf_log("%02x", hash[i]);
@@ -577,13 +577,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(UNUSED void *instance, UNUS
                return RLM_MODULE_INVALID;
        }
 
-       if (RDEBUG_ENABLED3) {
-               char buffer[33];
-
-               fr_bin2hex(buffer, kd, 16);
-
-               RDEBUG3("Comparing hashes, received: %s, calculated: %s", vp->vp_strvalue, buffer);
-       }
+       RDEBUG3("Comparing hashes, received: %pV, calculated: %pH", &vp->data, fr_box_octets(kd, 16));
 
        /*
         *  And finally, compare the digest in the packet with KD.
index 2db5484dd37d736266ebdda0833de34d6d9b60c0..5ed2fcd6aa5da4c366e8368c5ba422f019970e43 100644 (file)
@@ -261,7 +261,7 @@ void rlm_ldap_check_reply(rlm_ldap_t const *inst, REQUEST *request, fr_ldap_conn
        *       Expect_password is set when we process the mapping, and is only true if there was a mapping between
        *       an LDAP attribute and a password reference attribute in the control list.
        */
-       if (!inst->expect_password || (rad_debug_lvl < L_DBG_LVL_2)) return;
+       if (!inst->expect_password || !RDEBUG_ENABLED2) return;
 
        if (!fr_pair_find_by_da(request->control, attr_cleartext_password, TAG_ANY) &&
            !fr_pair_find_by_da(request->control, attr_nt_password, TAG_ANY) &&
@@ -270,59 +270,59 @@ void rlm_ldap_check_reply(rlm_ldap_t const *inst, REQUEST *request, fr_ldap_conn
            !fr_pair_find_by_da(request->control, attr_crypt_password, TAG_ANY)) {
                switch (conn->directory->type) {
                case FR_LDAP_DIRECTORY_ACTIVE_DIRECTORY:
-                       RWDEBUG("!!! Found map between LDAP attribute and a FreeRADIUS password attribute");
-                       RWDEBUG("!!! Active Directory does not allow passwords to be read via LDAP");
-                       RWDEBUG("!!! Remove the password map and either:");
-                       RWDEBUG("!!!  - Configure authentication via ntlm_auth (mschapv2 only)");
-                       RWDEBUG("!!!  - Configure authentication via wbclient (mschapv2 only)");
-                       RWDEBUG("!!!    that password attribute");
-                       RWDEBUG("!!!  - Bind as the user by listing %s in the authenticate section, and",
-                               inst->name);
-                       RWDEBUG("!!!    setting attribute &control:Auth-Type := '%s' in the authorize section",
-                               inst->name);
-                       RWDEBUG("!!!    (pap only)");
+                       RWDEBUG2("!!! Found map between LDAP attribute and a FreeRADIUS password attribute");
+                       RWDEBUG2("!!! Active Directory does not allow passwords to be read via LDAP");
+                       RWDEBUG2("!!! Remove the password map and either:");
+                       RWDEBUG2("!!!  - Configure authentication via ntlm_auth (mschapv2 only)");
+                       RWDEBUG2("!!!  - Configure authentication via wbclient (mschapv2 only)");
+                       RWDEBUG2("!!!    that password attribute");
+                       RWDEBUG2("!!!  - Bind as the user by listing %s in the authenticate section, and",
+                                inst->name);
+                       RWDEBUG2("!!!   setting attribute &control:Auth-Type := '%s' in the authorize section",
+                                inst->name);
+                       RWDEBUG2("!!!    (pap only)");
 
                        break;
 
                case FR_LDAP_DIRECTORY_EDIRECTORY:
-                       RWDEBUG("!!! Found map between LDAP attribute and a FreeRADIUS password attribute");
-                       RWDEBUG("!!! eDirectory does not allow passwords to be retrieved via LDAP search");
-                       RWDEBUG("!!! Remove the password map and either:");
-                       RWDEBUG("!!!  - Set 'edir = yes' and enable the universal password feature on your ");
-                       RWDEBUG("!!!    eDir server (recommended)");
-                       RWDEBUG("!!!    that password attribute");
-                       RWDEBUG("!!!  - Bind as the user by listing %s in the authenticate section, and",
-                               inst->name);
-                       RWDEBUG("!!!    setting attribute &control:Auth-Type := '%s' in the authorize section",
-                               inst->name);
+                       RWDEBUG2("!!! Found map between LDAP attribute and a FreeRADIUS password attribute");
+                       RWDEBUG2("!!! eDirectory does not allow passwords to be retrieved via LDAP search");
+                       RWDEBUG2("!!! Remove the password map and either:");
+                       RWDEBUG2("!!!  - Set 'edir = yes' and enable the universal password feature on your ");
+                       RWDEBUG2("!!!    eDir server (recommended)");
+                       RWDEBUG2("!!!    that password attribute");
+                       RWDEBUG2("!!!  - Bind as the user by listing %s in the authenticate section, and",
+                                inst->name);
+                       RWDEBUG2("!!!   setting attribute &control:Auth-Type := '%s' in the authorize section",
+                                inst->name);
                        RWDEBUG("!!!    (pap only)");
                        break;
 
                default:
                        if (!conn->config->admin_identity) {
-                               RWDEBUG("!!! Found map between LDAP attribute and a FreeRADIUS password attribute");
-                               RWDEBUG("!!! but no password attribute found in search result");
-                               RWDEBUG("!!! Either:");
-                               RWDEBUG("!!!  - Ensure the user object contains a password attribute, and that ");
-                               RWDEBUG("!!!    \"%s\" has permission to read that password attribute (recommended)",
-                                       conn->config->admin_identity);
-                               RWDEBUG("!!!  - Bind as the user by listing %s in the authenticate section, and",
-                                       inst->name);
-                               RWDEBUG("!!!    setting attribute &control:Auth-Type := '%s' in the authorize section",
-                                       inst->name);
-                               RWDEBUG("!!!    (pap only)");
+                               RWDEBUG2("!!! Found map between LDAP attribute and a FreeRADIUS password attribute");
+                               RWDEBUG2("!!! but no password attribute found in search result");
+                               RWDEBUG2("!!! Either:");
+                               RWDEBUG2("!!!  - Ensure the user object contains a password attribute, and that ");
+                               RWDEBUG2("!!!    \"%s\" has permission to read that password attribute (recommended)",
+                                        conn->config->admin_identity);
+                               RWDEBUG2("!!!  - Bind as the user by listing %s in the authenticate section, and",
+                                        inst->name);
+                               RWDEBUG2("!!!   setting attribute &control:Auth-Type := '%s' in the authorize section",
+                                        inst->name);
+                               RWDEBUG2("!!!    (pap only)");
                        } else {
-                               RWDEBUG("!!! No \"known good\" password added");
-                               RWDEBUG("!!! but no password attribute found in search result");
-                               RWDEBUG("!!! Either:");
-                               RWDEBUG("!!!  - Ensure the user object contains a password attribute, and that ");
-                               RWDEBUG("!!!    'identity' is set to the DN of an account that has permission to read");
-                               RWDEBUG("!!!    that password attribute");
-                               RWDEBUG("!!!  - Bind as the user by listing %s in the authenticate section, and",
-                                       inst->name);
-                               RWDEBUG("!!!    setting attribute &control:Auth-Type := '%s' in the authorize section",
-                                       inst->name);
-                               RWDEBUG("!!!    (pap only)");
+                               RWDEBUG2("!!! No \"known good\" password added");
+                               RWDEBUG2("!!! but no password attribute found in search result");
+                               RWDEBUG2("!!! Either:");
+                               RWDEBUG2("!!!  - Ensure the user object contains a password attribute, and that ");
+                               RWDEBUG2("!!!    'identity' is set to the DN of an account that has permission to read");
+                               RWDEBUG2("!!!    that password attribute");
+                               RWDEBUG2("!!!  - Bind as the user by listing %s in the authenticate section, and",
+                                        inst->name);
+                               RWDEBUG2("!!!   setting attribute &control:Auth-Type := '%s' in the authorize section",
+                                        inst->name);
+                               RWDEBUG2("!!!    (pap only)");
                        }
                        break;
                }
index ce63ca65cd281ade7708399a39e79e53019bc147..c5c0b33f19acecbe3a08915ad482f68cb15ba05d 100644 (file)
@@ -671,8 +671,8 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_md5(rlm_pap_t const *inst, REQUEST
        if (fr_digest_cmp(digest, vp->vp_octets, vp->vp_length) != 0) {
                REDEBUG("MD5 digest does not match \"known good\" digest");
                REDEBUG3("Password   : %pV", &request->password->data);
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, MD5_DIGEST_LENGTH));
-               REDEBUG3("Expected   : %pV", fr_box_octets(vp->vp_octets, MD5_DIGEST_LENGTH));
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, MD5_DIGEST_LENGTH));
+               REDEBUG3("Expected   : %pH", fr_box_octets(vp->vp_octets, MD5_DIGEST_LENGTH));
                return RLM_MODULE_REJECT;
        }
 
@@ -704,8 +704,8 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_smd5(rlm_pap_t const *inst, REQUEST
        if (fr_digest_cmp(digest, vp->vp_octets, MD5_DIGEST_LENGTH) != 0) {
                REDEBUG("SMD5 digest does not match \"known good\" digest");
                REDEBUG3("Password   : %pV", &request->password->data);
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, MD5_DIGEST_LENGTH));
-               REDEBUG3("Expected   : %pV", fr_box_octets(vp->vp_octets, MD5_DIGEST_LENGTH));
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, MD5_DIGEST_LENGTH));
+               REDEBUG3("Expected   : %pH", fr_box_octets(vp->vp_octets, MD5_DIGEST_LENGTH));
                return RLM_MODULE_REJECT;
        }
 
@@ -733,8 +733,8 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_sha(rlm_pap_t const *inst, REQUEST
        if (fr_digest_cmp(digest, vp->vp_octets, vp->vp_length) != 0) {
                REDEBUG("SHA1 digest does not match \"known good\" digest");
                REDEBUG3("Password   : %pV", &request->password->data);
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, SHA1_DIGEST_LENGTH));
-               REDEBUG3("Expected   : %pV", fr_box_octets(vp->vp_octets, SHA1_DIGEST_LENGTH));
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, SHA1_DIGEST_LENGTH));
+               REDEBUG3("Expected   : %pH", fr_box_octets(vp->vp_octets, SHA1_DIGEST_LENGTH));
                return RLM_MODULE_REJECT;
        }
 
@@ -764,10 +764,10 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_ssha(rlm_pap_t const *inst, REQUEST
        if (fr_digest_cmp(digest, vp->vp_octets, SHA1_DIGEST_LENGTH) != 0) {
                REDEBUG("SSHA digest does not match \"known good\" digest");
                REDEBUG3("Password   : %pV", &request->password->data);
-               REDEBUG3("Salt       : %pV", fr_box_octets(vp->vp_octets + SHA1_DIGEST_LENGTH,
+               REDEBUG3("Salt       : %pH", fr_box_octets(vp->vp_octets + SHA1_DIGEST_LENGTH,
                                                           vp->vp_length - SHA1_DIGEST_LENGTH));
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, SHA1_DIGEST_LENGTH));
-               REDEBUG3("Expected   : %pV", fr_box_octets(vp->vp_octets, SHA1_DIGEST_LENGTH));
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, SHA1_DIGEST_LENGTH));
+               REDEBUG3("Expected   : %pH", fr_box_octets(vp->vp_octets, SHA1_DIGEST_LENGTH));
                return RLM_MODULE_REJECT;
        }
 
@@ -878,8 +878,8 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_sha_evp(rlm_pap_t const *inst, REQU
        if (fr_digest_cmp(digest, vp->vp_octets, vp->vp_length) != 0) {
                REDEBUG("%s digest does not match \"known good\" digest", name);
                REDEBUG3("Password   : %pV", &request->password->data);
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, digest_len));
-               REDEBUG3("Expected   : %pV", &vp->data);
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, digest_len));
+               REDEBUG3("Expected   : %pH", &vp->data);
                return RLM_MODULE_REJECT;
        }
 
@@ -965,9 +965,9 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_ssha_evp(rlm_pap_t const *inst, REQ
        if (fr_digest_cmp(digest, vp->vp_octets, (size_t)digest_len) != 0) {
                REDEBUG("%s digest does not match \"known good\" digest", name);
                REDEBUG3("Password   : %pV", &request->password->data);
-               REDEBUG3("Salt       : %pV", fr_box_octets(vp->vp_octets + min_len, vp->vp_length - min_len));
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, digest_len));
-               REDEBUG3("Expected   : %pV", &vp->data);
+               REDEBUG3("Salt       : %pH", fr_box_octets(vp->vp_octets + min_len, vp->vp_length - min_len));
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, digest_len));
+               REDEBUG3("Expected   : %pH", &vp->data);
                return RLM_MODULE_REJECT;
        }
 
@@ -1183,9 +1183,9 @@ static inline rlm_rcode_t CC_HINT(nonnull) pap_auth_pbkdf2_parse(REQUEST *reques
 
        if (fr_digest_cmp(digest, hash, (size_t)digest_len) != 0) {
                REDEBUG("PBKDF2 digest does not match \"known good\" digest");
-               REDEBUG3("Salt       : %pV", fr_box_octets(salt, salt_len));
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, digest_len));
-               REDEBUG3("Expected   : %pV", fr_box_octets(hash, slen));
+               REDEBUG3("Salt       : %pH", fr_box_octets(salt, salt_len));
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, digest_len));
+               REDEBUG3("Expected   : %pH", fr_box_octets(hash, slen));
                rcode = RLM_MODULE_REJECT;
        } else {
                rcode = RLM_MODULE_OK;
@@ -1284,8 +1284,8 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_nt(rlm_pap_t const *inst, REQUEST *
 
        if (fr_digest_cmp(digest, vp->vp_octets, vp->vp_length) != 0) {
                REDEBUG("NT digest does not match \"known good\" digest");
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, sizeof(digest)));
-               REDEBUG3("Expected   : %pV", &vp->data);
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, sizeof(digest)));
+               REDEBUG3("Expected   : %pH", &vp->data);
                return RLM_MODULE_REJECT;
        }
 
@@ -1313,8 +1313,8 @@ static rlm_rcode_t CC_HINT(nonnull) pap_auth_lm(rlm_pap_t const *inst, REQUEST *
        if ((fr_hex2bin(digest, sizeof(digest), charbuf, len) != vp->vp_length) ||
            (fr_digest_cmp(digest, vp->vp_octets, vp->vp_length) != 0)) {
                REDEBUG("LM digest does not match \"known good\" digest");
-               REDEBUG3("Calculated : %pV", fr_box_octets(digest, sizeof(digest)));
-               REDEBUG3("Expected   : %pV", &vp->data);
+               REDEBUG3("Calculated : %pH", fr_box_octets(digest, sizeof(digest)));
+               REDEBUG3("Expected   : %pH", &vp->data);
                return RLM_MODULE_REJECT;
        }
 
index 326b873984ac8ad6f549a8892775bbb94b0cf132..449e0e4f08f40261f7212251222a44fe7993da8b 100644 (file)
@@ -652,14 +652,8 @@ static void perl_vp_to_svpvn_element(REQUEST *request, AV *av, VALUE_PAIR const
                break;
 
        case FR_TYPE_OCTETS:
-               if (RDEBUG_ENABLED) {
-                       char *hex;
-
-                       hex = fr_abin2hex(request, vp->vp_octets, vp->vp_length);
-                       RDEBUG("$%s{'%s'}[%i] = &%s:%s -> 0x%s", hash_name, vp->da->name, *i,
-                              list_name, vp->da->name, hex);
-                       talloc_free(hex);
-               }
+               RDEBUG("$%s{'%s'}[%i] = &%s:%s -> 0x%pH", hash_name, vp->da->name, *i,
+                      list_name, vp->da->name, &vp->data);
                sv = newSVpvn((char const *)vp->vp_octets, vp->vp_length);
                break;
 
@@ -747,10 +741,8 @@ static void perl_store_vps(UNUSED TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR
                        break;
 
                case FR_TYPE_OCTETS:
-                       if (RDEBUG_ENABLED) {
-                               RDEBUG("$%s{'%s'} = &%s:%s -> %pV", hash_name, vp->da->name,
-                                      list_name, vp->da->name, &vp->data);
-                       }
+                       RDEBUG("$%s{'%s'} = &%s:%s -> %pV", hash_name, vp->da->name, list_name,
+                              vp->da->name, &vp->data);
                        (void)hv_store(rad_hv, name, strlen(name),
                                       newSVpvn((char const *)vp->vp_octets, vp->vp_length), 0);
                        break;
index 74b7b71e881ed210853203e9e89197cf54701d22..2c756fbda3010e8f16786aee2b821136e20ebc48 100644 (file)
@@ -294,14 +294,8 @@ static int sigtran_sccp_sockaddr_from_conf(TALLOC_CTX *ctx, rlm_sigtran_t *inst,
                /*
                 *      Print out the constructed global title blob.
                 */
-               if (DEBUG_ENABLED4) {
-                       char *hex;
-
-                       hex = fr_abin2hex(ctx, out->gti_data, out->gti_len);
-                       DEBUG4("gt_ind: 0x%x", out->gti_ind);
-                       DEBUG4("digits: 0x%s (%i)", hex, out->gti_len);
-                       talloc_free(hex);
-               }
+               DEBUG4("gt_ind: 0x%x", out->gti_ind);
+               DEBUG4("digits: 0x%pH (%i)", fr_box_octets(out->gti_data, out->gti_len), out->gti_len);
        }
        return 0;
 }
index e07a811c6d60b9e9c5907b4967435bcc9cdf556b..af7cc11fc3de37c255e20ddeadca35362ee420f2 100644 (file)
@@ -236,16 +236,8 @@ static rlm_rcode_t CC_HINT(nonnull) mod_post_auth(void *instance, UNUSED void *t
                   (mip_rk_1[2] << 8) | mip_rk_1[3]);
        if (mip_spi < 256) mip_spi += 256;
 
-       if (rad_debug_lvl) {
-               int len = rk_len;
-               char buffer[512];
-
-               if (len > 128) len = 128; /* buffer size */
-
-               fr_bin2hex(buffer, mip_rk, len);
-               RDEBUG("MIP-RK = 0x%s", buffer);
-               RDEBUG("MIP-SPI = %08x", ntohl(mip_spi));
-       }
+       RDEBUG("MIP-RK = 0x%pH", fr_box_octets(mip_rk, rk_len));
+       RDEBUG("MIP-SPI = %08x", ntohl(mip_spi));
 
        /*
         *      FIXME: Perform SPI collision prevention
index 7e30850f03dfa7deb85625b211b0246db60982ed..0a6957faeeeaac9a2967315ef1b8d62664ba8e49 100644 (file)
@@ -28,7 +28,6 @@ rlm_rcode_t rlm_yubikey_decrypt(rlm_yubikey_t const *inst, REQUEST *request, cha
        uint32_t counter, timestamp;
        yubikey_token_st token;
 
-       char private_id[(YUBIKEY_UID_SIZE * 2) + 1];
        VALUE_PAIR *key, *vp;
 
        key = fr_pair_find_by_da(request->control, attr_yubikey_key, TAG_ANY);
@@ -57,16 +56,13 @@ rlm_rcode_t rlm_yubikey_decrypt(rlm_yubikey_t const *inst, REQUEST *request, cha
        counter = (yubikey_counter(token.ctr) << 8) | token.use;
        timestamp = (token.tstph << 16) | token.tstpl;
 
-       if (RDEBUG_ENABLED2) {
-               (void) fr_bin2hex((char *) &private_id, (uint8_t*) &token.uid, YUBIKEY_UID_SIZE);
-               RDEBUG2("Private ID        : 0x%s", private_id);
-               RDEBUG2("Session counter   : %u", counter);
+       RDEBUG2("Private ID        : %pH", fr_box_octets(token.uid, YUBIKEY_UID_SIZE));
+       RDEBUG2("Session counter   : %u", counter);
 
-               RDEBUG2("Token timestamp   : %u", timestamp);
+       RDEBUG2("Token timestamp   : %u", timestamp);
 
-               RDEBUG2("Random data       : %u", token.rnd);
-               RDEBUG2("CRC data          : 0x%x", token.crc);
-       }
+       RDEBUG2("Random data       : %u", token.rnd);
+       RDEBUG2("CRC data          : 0x%x", token.crc);
 
        /*
         *      Private ID used for validation purposes