Index: /trunk/DNSDB.pm
===================================================================
--- /trunk/DNSDB.pm	(revision 399)
+++ /trunk/DNSDB.pm	(revision 400)
@@ -1198,24 +1198,28 @@
 # Load the minimum required initial state (DB connect info) from a config file
 # Load misc other bits while we're at it.
-# Takes an optional basename and config path to look for
+# Takes an optional hash that may contain:
+#  - basename and config path to look for
+#  - RPC flag (saves parsing the more complex RPC bits if not needed)
 # Populates the %config and %def hashes
 sub loadConfig {
-  my $basename = shift || '';	# this will work OK
-##fixme  $basename isn't doing what I think I thought I was trying to do.
+  my %args = @_;
+  $args{basename} = '' if !$args{basename};
+  $args{rpcflag} = '' if !$args{rpcflag};
+##fixme  $args{basename} isn't doing what I think I thought I was trying to do.
 
   my $deferr = '';	# place to put error from default config file in case we can't find either one
 
   my $configroot = "/etc/dnsdb";	##CFG_LEAF##
-  $configroot = '' if $basename =~ m|^/|;
-  $basename .= ".conf" if $basename !~ /\.conf$/;
+  $configroot = '' if $args{basename} =~ m|^/|;
+  $args{basename} .= ".conf" if $args{basename} !~ /\.conf$/;
   my $defconfig = "$configroot/dnsdb.conf";
-  my $siteconfig = "$configroot/$basename";
+  my $siteconfig = "$configroot/$args{basename}";
 
   # System defaults
-  __cfgload("$defconfig") or $deferr = $errstr;
+  __cfgload("$defconfig", $args{rpcflag}) or $deferr = $errstr;
 
   # Per-site-ish settings.
-  if ($basename ne '.conf') {
-    unless (__cfgload("$siteconfig")) {
+  if ($args{basename} ne '.conf') {
+    unless (__cfgload("$siteconfig"), $args{rpcflag}) {
       $errstr = ($deferr ? "Error opening default config file $defconfig: $deferr\n" : '').
 	"Error opening site config file $siteconfig";
@@ -1253,4 +1257,5 @@
   $errstr = '';
   my $cfgfile = shift;
+  my $rpcflag = shift;
 
   if (open CFG, "<$cfgfile") {
@@ -1290,4 +1295,12 @@
       $config{perpage}		= $1 if /^perpage\s*=\s*(\d+)/i;
       $config{exportcache}	= $1 if m{^exportcache\s*=\s*([a-z0-9/_.-]+)}i;
+      # RPC options
+      if ($rpcflag && /^rpc/) {
+        if (my ($tmp) = /^rpc_iplist\s*=\s*(.+)/i) {
+          my @ips = split /[,\s]+/, $tmp;
+          my $rpcsys = shift @ips;
+          push @{$config{rpcacl}{$rpcsys}}, @ips;
+        }
+      }
     }
     close CFG;
