Changeset 837 for trunk/mergerecs


Ignore:
Timestamp:
04/21/22 13:16:29 (3 years ago)
Author:
Kris Deugau
Message:

/trunk

Commit some lurking tweaks to mergerecs

  • user info for log
  • use location of ':ANY:' to find and match domains or reverse zones that may have default locations set

Update include path finder - see #80

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mergerecs

    r797 r837  
    33##
    44# $Id$
    5 # Copyright 2014,2016,2018,2020 Kris Deugau <kdeugau@deepnet.cx>
     5# Copyright 2014-2022 Kris Deugau <kdeugau@deepnet.cx>
    66#
    77#    This program is free software: you can redistribute it and/or modify
     
    2727use Data::Dumper;
    2828
    29 # push "the directory the script is in" into @INC
    30 use FindBin;
    31 use lib "$FindBin::RealBin/";
     29# Taint-safe (ish) voodoo to push "the directory the script is in" into @INC.
     30# See https://secure.deepnet.cx/trac/dnsadmin/ticket/80 for more gory details on how we got here.
     31use File::Spec ();
     32use File::Basename ();
     33my $path;
     34BEGIN {
     35    $path = File::Basename::dirname(File::Spec->rel2abs($0));
     36    if ($path =~ /(.*)/) {
     37        $path = $1;
     38    }
     39}
     40use lib $path;
    3241
    3342use DNSDB;
     
    6776$dnsdb->{loguserid} = 0;        # not worth setting up a pseudouser the way the RPC system does
    6877$dnsdb->{logusername} = $dnsdb->{logusername}."/mergerecs";
    69 $dnsdb->{logfullname} = $dnsdb->{logusername} if !$dnsdb->{logfullname};
     78$dnsdb->{logfullname} = ($dnsdb->{logfullname} ? $dnsdb->{logfullname}."/mergerecs" : $dnsdb->{logusername});
    7079
    7180# and now the meat
     
    8695  }
    8796  die "$pzone is not a valid reverse zone specification\n" if !$npzone;
    88   $zid = $dnsdb->revID($npzone, '');
     97  $zid = $dnsdb->revID($npzone, ':ANY:');
    8998} else {
    9099  $rev = 'n';
    91   $zid = $dnsdb->domainID($pzone, '');
     100  $zid = $dnsdb->domainID($pzone, ':ANY:');
    92101}
    93102die "$pzone is not a zone in the database (".$dnsdb->errstr.")\n" if !$zid;
Note: See TracChangeset for help on using the changeset viewer.