* 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);
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);
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);
* 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);
/*
* 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.
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);
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);
}
}
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;
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);
*/
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;
}
* 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";
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.
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:
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;
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;
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);
++*(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;
}
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\"",
}
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");
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]);
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]);
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.
* 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) &&
!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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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;
}
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;
}
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;
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;
/*
* 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;
}
(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
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);
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