Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE YET] Remove feature "randomized capitalization" #207

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ Zonemaster::LDNS.
When disabled, libldns is dynamically linked just like other dependencies.
Enabled by default.

=item --[no-]randomize

Experimental.
Randomizes the capitalization of returned domain names.
Disabled by default.

=item --prefix-openssl=PATH

Search for OpenSSL headers and libraries in PATH.
Expand Down Expand Up @@ -85,7 +79,6 @@ Enable debug mode, more verbose output.
my $opt_ed25519 = 1;
my $opt_idn = 1;
my $opt_internal_ldns = 1;
my $opt_randomize = 0;
my $opt_debug = 0;
my $opt_assets = {
openssl => {
Expand All @@ -107,7 +100,6 @@ GetOptions(
'ed25519!' => \$opt_ed25519,
'idn!' => \$opt_idn,
'internal-ldns!' => \$opt_internal_ldns,
'randomize!' => \$opt_randomize,
'debug!' => \$opt_debug,
'prefix-openssl=s' => \$$opt_assets{openssl}{prefix},
'openssl-inc=s' => \$$opt_assets{openssl}{inc},
Expand Down Expand Up @@ -293,18 +285,6 @@ else {
print "Feature idn disabled\n";
}


# Internals

if ( $opt_randomize ) {
print "Feature randomized capitalization enabled\n";
cc_define '-DRANDOMIZE';
}
else {
print "Feature randomized capitalization disabled\n";
}


sub MY::postamble {

my $contributors_make = <<'END_CONTRIBUTORS';
Expand Down
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* [Ed25519]
* [IDN]
* [Internal ldns]
* [Randomized capitalization](#randomized-capitalization)
* [Custom OpenSSL]
* [Custom LDNS]
* [Custom Libidn]
Expand Down Expand Up @@ -166,16 +165,6 @@ When enabled, an included version of ldns is statically linked into
Zonemaster::LDNS.
When disabled, libldns is dynamically linked just like other dependencies.

### Randomized capitalization

Disabled by default.
Enable with `--randomize`.

> **Note:** This feature is experimental.

Randomizes the capitalization of returned domain names.


### Custom OpenSSL

Disabled by default.
Expand Down
1 change: 0 additions & 1 deletion include/LDNS.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ typedef ldns_rr *Zonemaster__LDNS__RR__X25;
#define D_U32(what,where) ldns_rdf2native_int32(ldns_rr_rdf(what,where))

SV *rr2sv(ldns_rr *rr);
char *randomize_capitalization(char *in);
void strip_newline(char* in);

#ifdef USE_ITHREADS
Expand Down
20 changes: 10 additions & 10 deletions src/LDNS.xs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ addr2name(obj,addr_in)
{
ldns_rr *rr = ldns_rr_list_rr(names,i);
ldns_rdf *name_rdf = ldns_rr_rdf(rr,0);
char *name_str = randomize_capitalization(ldns_rdf2str(name_rdf));
char *name_str = ldns_rdf2str(name_rdf);

SV* sv = newSVpv(name_str,0);
mXPUSHs(sv);
Expand Down Expand Up @@ -1644,7 +1644,7 @@ char *
rr_owner(obj)
Zonemaster::LDNS::RR obj;
CODE:
RETVAL = randomize_capitalization(ldns_rdf2str(ldns_rr_owner(obj)));
RETVAL = ldns_rdf2str(ldns_rr_owner(obj));
OUTPUT:
RETVAL
CLEANUP:
Expand Down Expand Up @@ -1794,7 +1794,7 @@ char *
rr_ns_nsdname(obj)
Zonemaster::LDNS::RR::NS obj;
CODE:
RETVAL = randomize_capitalization(ldns_rdf2str(ldns_rr_rdf(obj, 0)));
RETVAL = ldns_rdf2str(ldns_rr_rdf(obj, 0));
OUTPUT:
RETVAL
CLEANUP:
Expand All @@ -1815,7 +1815,7 @@ char *
rr_mx_exchange(obj)
Zonemaster::LDNS::RR::MX obj;
CODE:
RETVAL = randomize_capitalization(D_STRING(obj, 1));
RETVAL = D_STRING(obj, 1);
OUTPUT:
RETVAL
CLEANUP:
Expand Down Expand Up @@ -1854,7 +1854,7 @@ char *
rr_soa_mname(obj)
Zonemaster::LDNS::RR::SOA obj;
CODE:
RETVAL = randomize_capitalization(D_STRING(obj,0));
RETVAL = D_STRING(obj,0);
OUTPUT:
RETVAL
CLEANUP:
Expand All @@ -1864,7 +1864,7 @@ char *
rr_soa_rname(obj)
Zonemaster::LDNS::RR::SOA obj;
CODE:
RETVAL = randomize_capitalization(D_STRING(obj,1));
RETVAL = D_STRING(obj,1);
OUTPUT:
RETVAL
CLEANUP:
Expand Down Expand Up @@ -2220,7 +2220,7 @@ char *
rr_nsec_next(obj)
Zonemaster::LDNS::RR::NSEC obj;
CODE:
RETVAL = randomize_capitalization(D_STRING(obj,0));
RETVAL = D_STRING(obj,0);
OUTPUT:
RETVAL

Expand Down Expand Up @@ -2487,7 +2487,7 @@ char *
rr_ptr_ptrdname(obj)
Zonemaster::LDNS::RR::PTR obj;
CODE:
RETVAL = randomize_capitalization(D_STRING(obj,0));
RETVAL = D_STRING(obj,0);
OUTPUT:
RETVAL
CLEANUP:
Expand All @@ -2500,7 +2500,7 @@ char *
rr_cname_cname(obj)
Zonemaster::LDNS::RR::CNAME obj;
CODE:
RETVAL = randomize_capitalization(D_STRING(obj,0));
RETVAL = D_STRING(obj,0);
OUTPUT:
RETVAL
CLEANUP:
Expand All @@ -2512,7 +2512,7 @@ char *
rr_dname_dname(obj)
Zonemaster::LDNS::RR::DNAME obj;
CODE:
RETVAL = randomize_capitalization(D_STRING(obj,0));
RETVAL = D_STRING(obj,0);
OUTPUT:
RETVAL
CLEANUP:
Expand Down
21 changes: 0 additions & 21 deletions src/assist.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,27 +180,6 @@ net_ldns_clone_packets()

#endif

char *
randomize_capitalization(char *in)
{
#ifdef RANDOMIZE
char *str;
str = in;
while(*str) {
if(Drand01() < 0.5)
{
*str = tolower(*str);
}
else
{
*str = toupper(*str);
}
str++;
}
#endif
return in;
}

SV *
rr2sv(ldns_rr *rr)
{
Expand Down
6 changes: 4 additions & 2 deletions t/rr.t
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use v5.16;

use Test::More;
use Test::Fatal;
use Devel::Peek;
Expand Down Expand Up @@ -67,7 +69,7 @@ subtest 'AAAA' => sub {
SKIP: {
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

$p = $s->query( 'a.ns.se', 'AAAA' );
my $p = $s->query( 'a.ns.se', 'AAAA' );
plan skip_all => 'No response, cannot test' if not $p;

foreach my $rr ( $p->answer ) {
Expand Down Expand Up @@ -297,7 +299,7 @@ subtest 'croak when given malformed CAA records' => sub {
# This will always croak
$bad_caa->string();
};
like( exception { $will_croak->() }, qr/^Failed to convert RR to string/ );
like( exception(sub { $will_croak->() }), qr/^Failed to convert RR to string/ );
};

done_testing;