Changeset 86


Ignore:
Timestamp:
09/11/25 17:57:24 (3 days ago)
Author:
Kris Deugau
Message:

/trunk/uribl

Move the %config blurb inside the module so it's not splattered across all
the scripts

Location:
trunk/uribl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/uribl/URIdb.pm

    r81 r86  
    128128        })
    129129        or die "database inaccessible: ".$DBI::errstr;
    130 #  my $sth = $dbh->prepare("SELECT masklen,ipcount FROM autolist");
    131 #  $sth->execute;
    132 #  while (my ($masklen,$ipcount) = $sth->fetchrow_array) {
    133 #    $autolist{$masklen} = $ipcount;
    134 #  }
     130  my $sth = $dbh->prepare("SELECT key,value FROM misc");
     131  $sth->execute;
     132  while (my ($key,$value) = $sth->fetchrow_array) {
     133    $self->{misc}{$key} = $value;
     134  }
     135  $self->{misc}{blzone} = 'uribl.company.com' if !$self->{misc}{blzone};
    135136  return $dbh;
    136137}
     
    186187  my $sth;
    187188
     189##fixme:  should probably rejig this key to point to a FQDN rather than a "something that will get published under .dnsbl"
     190  my $blzone = ($self->{misc}{blzone} ? $self->{misc}{blzone} : 'uri').".dnsbl";
     191  my $bladmin = ($self->{misc}{bladmin} ? $self->{misc}{bladmin} : 'systems.company.com');
     192  my $blttl = ($self->{misc}{ttl} ? $self->{misc}{ttl} : '900');
     193##fixme:  should probably add some configuration strings for the nameserver value
     194
    188195  if ($target eq 'rbldnsd') {
     196    print $blfh "\$SOA 900 $blzone.dnsbl $bladmin 0 1200 600 600 900\n".
     197        "\$NS 3600 127.0.0.1\n".
     198        "\$TTL $blttl\n";
    189199    print $blfh ":127.0.0.2:Domain found in reported missed-spam, no legitimate root or www content\n";
    190200    $sth = $dbh->prepare("SELECT uri FROM urilist WHERE list=2");
  • trunk/uribl/export-uridb

    r80 r86  
    2929use URIdb 2.0;
    3030
    31 my $uridb = new URIdb;
    32 
    3331die "Usage: export-uridb <list> [type]\n"
    3432        if !$ARGV[0];
     
    4240$uridb->connect;
    4341
    44 my %config;
    45 my $sth = $dbh->prepare("SELECT key,value FROM misc");
    46 $sth->execute;
    47 while (my ($key,$value) = $sth->fetchrow_array) {
    48   $config{$key} = $value;
    49 }
    50 
    51 print "\$SOA 900 ".($config{blzone} ? $config{blzone} : 'uri').".dnsbl systems.company.com 0 1200 600 600 900\n".
    52         "\$NS 3600 127.0.0.1\n".
    53         "\$TTL 900\n";
    54 
    5542$uridb->export($mode,*STDOUT);
  • trunk/uribl/import-cur.pl

    r84 r86  
    3737
    3838my $datesth = $dbh->prepare("UPDATE urilist SET added=? WHERE uri=?");
    39 
    40 my %config;
    41 my $sth = $dbh->prepare("SELECT key,value FROM misc");
    42 $sth->execute;
    43 while (my ($key,$value) = $sth->fetchrow_array) {
    44   $config{$key} = $value;
    45 }
    46 $config{blzone} = 'uribl.company.com' if !$config{blzone};
    4739
    4840my @months = ('null','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  • trunk/uribl/uridb.cgi

    r80 r86  
    7474$ENV{HTML_TEMPLATE_ROOT} = $templatedir;
    7575
    76 my %config;
    77 my $sth = $dbh->prepare("SELECT key,value FROM misc");
    78 $sth->execute;
    79 while (my ($key,$value) = $sth->fetchrow_array) {
    80   $config{$key} = $value;
    81 }
    82 
    8376# decide which page to spit out...
    8477if (!$webvar{page}) {
     
    8881}
    8982
    90 $page->param(pgtitle => $config{pgtitle}) if defined($config{pgtitle});
    91 $page->param(pgcomment => $config{pgcomment}) if defined($config{pgcomment});
     83$page->param(pgtitle => $uridb->{cfg}{pgtitle}) if defined($uridb->{cfg}{pgtitle});
     84$page->param(pgcomment => $uridb->{cfg}{pgcomment}) if defined($uridb->{cfg}{pgcomment});
    9285$page->param(cgiself => $cgiself);
    9386
Note: See TracChangeset for help on using the changeset viewer.