Index: trunk/mergerecs
===================================================================
--- trunk/mergerecs	(revision 836)
+++ trunk/mergerecs	(revision 837)
@@ -3,5 +3,5 @@
 ##
 # $Id$
-# Copyright 2014,2016,2018,2020 Kris Deugau <kdeugau@deepnet.cx>
+# Copyright 2014-2022 Kris Deugau <kdeugau@deepnet.cx>
 #
 #    This program is free software: you can redistribute it and/or modify
@@ -27,7 +27,16 @@
 use Data::Dumper;
 
-# push "the directory the script is in" into @INC
-use FindBin;
-use lib "$FindBin::RealBin/";
+# Taint-safe (ish) voodoo to push "the directory the script is in" into @INC.
+# See https://secure.deepnet.cx/trac/dnsadmin/ticket/80 for more gory details on how we got here.
+use File::Spec ();
+use File::Basename ();
+my $path;
+BEGIN {
+    $path = File::Basename::dirname(File::Spec->rel2abs($0));
+    if ($path =~ /(.*)/) {
+        $path = $1;
+    }
+}
+use lib $path;
 
 use DNSDB;
@@ -67,5 +76,5 @@
 $dnsdb->{loguserid} = 0;        # not worth setting up a pseudouser the way the RPC system does
 $dnsdb->{logusername} = $dnsdb->{logusername}."/mergerecs";
-$dnsdb->{logfullname} = $dnsdb->{logusername} if !$dnsdb->{logfullname};
+$dnsdb->{logfullname} = ($dnsdb->{logfullname} ? $dnsdb->{logfullname}."/mergerecs" : $dnsdb->{logusername});
 
 # and now the meat
@@ -86,8 +95,8 @@
   }
   die "$pzone is not a valid reverse zone specification\n" if !$npzone;
-  $zid = $dnsdb->revID($npzone, '');
+  $zid = $dnsdb->revID($npzone, ':ANY:');
 } else {
   $rev = 'n';
-  $zid = $dnsdb->domainID($pzone, '');
+  $zid = $dnsdb->domainID($pzone, ':ANY:');
 }
 die "$pzone is not a zone in the database (".$dnsdb->errstr.")\n" if !$zid;
