Changeset 80 for trunk/uribl/delist-uri


Ignore:
Timestamp:
09/11/25 16:28:23 (4 days ago)
Author:
Kris Deugau
Message:

/trunk/uribl

Convert module to more proper object with embedded DB bits
Add module-finding blurb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/uribl/delist-uri

    r41 r80  
    33##
    44# $Id$
    5 # Copyright 2010 Kris Deugau <kdeugau@deepnet.cx>
     5# Copyright 2010,2025 Kris Deugau <kdeugau@deepnet.cx>
    66#
    77#    This program is free software: you can redistribute it and/or modify
     
    2323use DBI;
    2424
    25 use URIdb;
     25# push "the directory the script is in" into @INC
     26use FindBin;
     27use lib "$FindBin::RealBin/";
     28
     29use URIdb 2.0;
    2630
    2731my $uridb = new URIdb;
    2832
    29 # default DB info - all other settings should be loaded from the DB.
    30 my $dbhost = "localhost";
    31 my $dbname = "dnsbl";
    32 my $dbuser = "dnsbl";
    33 my $dbpass = "spambgone";
     33die "Usage: delist-uri <domain>\n"
     34        if !$ARGV[1];
    3435
    35 die "Usage: delist-uri <domain>\n"
    36         if !$ARGV[0];
     36my $cfgname = shift @ARGV;
    3737
    38 # Load a config ref containing DB host, name, user, and pass info based on
    39 # from the server name + full script web path.  This allows us to host
    40 # multiple instances without having to duplicate the code.
    41 # This file is a Perl fragment to be processed inline.
    42 if (-e "/etc/uridb/uridb.conf") {
    43   my $cfg = `cat /etc/uridb/uridb.conf`;
    44   ($cfg) = ($cfg =~ /^(.+)$/s);         # avoid warnings, failures, and general nastiness with taint mode
    45   eval $cfg;
    46 }
    47 
    48 my $dbh = $uridb->connect($dbhost, $dbname, $dbuser, $dbpass);
     38my $uridb = new URIdb (configfile => "/etc/uridb/$cfgname.conf");
     39$uridb->connect;
    4940
    5041my %config;
Note: See TracChangeset for help on using the changeset viewer.