fix edge cases for previous commit master
authorArt Cancro <ajc@citadel.org>
Fri, 28 Jul 2023 04:01:06 +0000 (00:01 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 28 Jul 2023 04:01:06 +0000 (00:01 -0400)
infanticide.pm

index 56072fde628fc51af262e9d621a0bd1319ecf080..3c077f196a7fc4bd9225e72b979e2f9b7be0fb36 100755 (executable)
@@ -68,6 +68,23 @@ sub infanticide_get_creation_date {
 }
 
 
+sub infanticide_get_creation_date_recursive {
+       my $domain_to_test = $_[0];
+       my $cDate = infanticide_get_creation_date($domain_to_test);
+       if ($cDate ne "") {
+               return($cDate);
+       }
+
+       $dots = ($domain_to_test =~ tr/.//);
+       if ($dots < 2) {
+               return("");
+       }
+
+       return(infanticide_get_creation_date_recursive(substr $domain_to_test, index($domain_to_test, ".")+1));
+}
+
+
+
 sub check_for_disposable_domain() {
        $counter = $counter + 1;
 
@@ -75,7 +92,7 @@ sub check_for_disposable_domain() {
        my $fromaddr = $pms->get("From:addr", undef);
        my @fromarr = split('@', $fromaddr);
        my $domain = $fromarr[1];
-       my $creationDate = infanticide_get_creation_date($domain);
+       my $creationDate = infanticide_get_creation_date_recursive($domain);
        if ($creationDate eq "") {
                return(0);
        }