Index: /branches/stable/INSTALL
===================================================================
--- /branches/stable/INSTALL	(revision 506)
+++ /branches/stable/INSTALL	(revision 507)
@@ -61,20 +61,22 @@
   b) Edit CustIDCK.pm as needed to validate customer IDs.
 
-4) Create the database, and the inital tables using cgi-bin/ipdb.psql.
+4) As a Postgres superuser, create a database user and the database.
+Create the inital tables using cgi-bin/ipdb.psql.
 
 5) Configure your webserver to call the IPDB scripts at an appropriate 
 web path.  A webroot pointing to the HTML files (first level under 
-the ipdb-#VERSION#/ tarball directory, or /usr/local/lib/ipdb-#VERSION#) 
-with a symlink or alias for ip/ -> . should work fine;  a server alias 
-under an existing virtual host should work as well.
+the ipdb-#VERSION#/ tarball directory, or /usr/local/lib/ipdb-#VERSION#)
+should work fine;  a server alias under an existing virtual host should
+work as well.
 
-Note that all URLs referenced internally currently assume they will be 
-presented at http://host/ip/;  you cannot put the IPDB at 
-http://host/noc/misc/ipdb/.
+Set $IPDB::webpath (the web path to your IPDB install) in MyIPDB.pm.
+Straight out of the tarball it should work at the webroot, but if you
+want it in a subdirectory, you'll need to set this variable to get all
+of the internal links to behave properly.
 
 The directory containing the HTML and scripts must have at least the 
 following Apache directives (or other server equivalent) set:
 
-  Options ExecCGI IncludesNoEXEC FollowSymlinks
+  Options ExecCGI IncludesNoEXEC
 
 6) User lists can be maintained two basic ways:
@@ -86,5 +88,9 @@
     remove the default user (or at least change its password).
 
-  b) Maintain an external .htpasswd file of your own, configured and 
+  b) Use the built-in user manager as in a) but create a short script to
+    export the user list to a standard .htpasswd file.  This may be
+    useful if mod_auth_pgsql isn't easily available.
+
+  c) Maintain an external .htpasswd file of your own, configured and 
     maintained however you like.  In this case the access-pwd-update.pl 
     script should edited to match the .htpasswd filename/path and should 
@@ -94,13 +100,13 @@
     in the database.
 
-You will have to either temporarily create a user "admin", so that user
-can grant other users priviledges, or run the following on the database:
+    You will have to either temporarily create a user "admin", so that user
+    can grant other users priviledges, or run the following on the database:
 
-  UPDATE users SET acl='bacdsA' WHERE username='newadminuser';
+      UPDATE users SET acl='bacdsA' WHERE username='newadminuser';
 
-Replace 'newadminuser' as appropriate.
+    Replace 'newadminuser' as appropriate.
 
-If you don't do this, nobody will be able to make any changes;  
-access-pwd-update.pl only grants minimal read access to new users.
+    If you don't do this, nobody will be able to make any changes;  
+    access-pwd-update.pl only grants minimal read access to new users.
 
 7) (optional) Pick a log facility by setting $IPDB::syslog_facility in 
Index: /branches/stable/Makefile
===================================================================
--- /branches/stable/Makefile	(revision 506)
+++ /branches/stable/Makefile	(revision 507)
@@ -3,5 +3,5 @@
 
 PKGNAME=ipdb
-VERSION=2.6
+VERSION=2.7
 RELEASE=1
 
@@ -108,3 +108,3 @@
 	gzip -v -f -9 $(PKGNAME)-$(VERSION).tar
 	rm -rf $(PKGNAME)-$(VERSION)
-	# gpg --detach-sign $(PKGNAME)-$(VERSION).tar.gz
+	gpg --detach-sign $(PKGNAME)-$(VERSION).tar.gz
Index: /branches/stable/addmaster.html
===================================================================
--- /branches/stable/addmaster.html	(revision 506)
+++ /branches/stable/addmaster.html	(revision 507)
@@ -2,5 +2,5 @@
 <div class="heading">Add new master IP block</div><br>
 <table class="regular" bgcolor="black" cellspacing="1" cellpadding="1">
-<form method="POST" action="/ip/cgi-bin/main.cgi" class="regular">
+<form method="POST" action="$$WEBPATH$$/cgi-bin/main.cgi" class="regular">
 <tr class="color1"><td>Master block to add: (CIDR)&nbsp</td><td><input type=text name=cidr></td></tr> <tr class="color2">
 <td class="center" colspan="2"><input type="submit" value="  Assign  "></td>
Index: /branches/stable/alloctypes.html
===================================================================
--- /branches/stable/alloctypes.html	(revision 506)
+++ /branches/stable/alloctypes.html	(revision 507)
@@ -3,6 +3,6 @@
 <title>IP Database</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
-<link rel="stylesheet" type="text/css" href="/ip/ipdb.css">
-<link rel="stylesheet" type="text/css" href="/ip/local.css">
+<link rel="stylesheet" type="text/css" href="ipdb.css">
+<link rel="stylesheet" type="text/css" href="local.css">
 
 </head>
Index: /branches/stable/assign.html
===================================================================
--- /branches/stable/assign.html	(revision 506)
+++ /branches/stable/assign.html	(revision 507)
@@ -8,5 +8,5 @@
 $$ALLCITIES$$
 </select>
-&nbsp;<a href="javascript:popNotes('/ip/newcity.html')">Add new location</a>
+&nbsp;<a href="javascript:popNotes('$$WEBPATH$$/newcity.html')">Add new location</a>
 </td>
 </tr>
@@ -33,5 +33,5 @@
 $$NODELIST$$
 </select>
-&nbsp;<a href="javascript:popNotes('/ip/newnode.html')">Add new location</a>
+&nbsp;<a href="javascript:popNotes('$$WEBPATH$$/newnode.html')">Add new location</a>
 </td></tr>
 <tr class="color2">
Index: /branches/stable/cgi-bin/CommonWeb.pm
===================================================================
--- /branches/stable/cgi-bin/CommonWeb.pm	(revision 506)
+++ /branches/stable/cgi-bin/CommonWeb.pm	(revision 507)
@@ -52,4 +52,5 @@
 sub printHeader {
   my $title = shift;
+  my $webpath = shift;
   print "Content-type: text/html\n\n";
 # This doesn't work well.  Must investigate.
@@ -62,4 +63,5 @@
 
   $html =~ s/\$\$TITLE\$\$/$title/;
+  $html =~ s/\$\$WEBPATH\$\$/$webpath/g;
 # Necessary for mangling arbitrary bits of the header
   my $i=0;
Index: /branches/stable/cgi-bin/MyIPDB.pm
===================================================================
--- /branches/stable/cgi-bin/MyIPDB.pm	(revision 506)
+++ /branches/stable/cgi-bin/MyIPDB.pm	(revision 507)
@@ -8,5 +8,5 @@
 # Last update by $Author$
 ###
-# Copyright (C) 2004-2010 - Kris Deugau
+# Copyright (C) 2004-2011 - Kris Deugau
 
 # don't remove!  required for GNU/FHS-ish install from tarball
@@ -23,9 +23,13 @@
 my $dbhost = 'ipdb-db';
 
+# Quick workaround for fixed web path.  Set this to the absolute web path to
+# your IPDB install, or leave blank for installation at the webroot.
+$IPDB::webpath = '';
+
 # Set some globals declared in IPDB.pm.  Most of these only affect mailNotify().
 # Note that while you *can* leave these at defaults, it's probably a Really Bad Idea.
-#$IPDB::org_name = "Bob's Big Bonaza";
+#$IPDB::org_name = "Example Corp";
 #$IPDB::smtphost = '127.0.0.1';
-#$IPDB::domain = 'bob.com';
+#$IPDB::domain = 'example.com';
 #$IPDB::defcustid = '5554242';
 # Globals for db2rwhois.pl
Index: /branches/stable/cgi-bin/admin.cgi
===================================================================
--- /branches/stable/cgi-bin/admin.cgi	(revision 506)
+++ /branches/stable/cgi-bin/admin.cgi	(revision 507)
@@ -10,5 +10,5 @@
 # Last update by $Author$
 ###
-# Copyright (C) 2004-2010 - Kris Deugau
+# Copyright (C) 2004-2011 - Kris Deugau
 
 use strict;
@@ -54,6 +54,6 @@
   print "Content-Type: text/html\n\n".
 	"<html>\n<head>\n\t<title>Access denied</title>\n".
-	qq(\t<link rel="stylesheet" type="text/css" href="/ip/ipdb.css">\n).
-	qq(\t<link rel="stylesheet" type="text/css" href="/ip/local.css">\n).
+	qq(\t<link rel="stylesheet" type="text/css" href="$IPDB::webpath/ipdb.css">\n).
+	qq(\t<link rel="stylesheet" type="text/css" href="$IPDB::webpath/local.css">\n).
 	"</head>\n<body>\n".
 	qq(Access to this tool is restricted.  Contact the <a href="mailto:ipdbadmin\@example.com">IPDB administrator</a> \n).
@@ -67,6 +67,6 @@
 print "Content-type: text/html\n\n".
 	"<html>\n<head>\n\t<title>[IPDB admin tools]</title>\n".
-	qq(\t<link rel="stylesheet" type="text/css" href="/ip/ipdb.css">\n).
-	qq(\t<link rel="stylesheet" type="text/css" href="/ip/local.css">\n).
+	qq(\t<link rel="stylesheet" type="text/css" href="$IPDB::webpath/ipdb.css">\n).
+	qq(\t<link rel="stylesheet" type="text/css" href="$IPDB::webpath/local.css">\n).
 	"</head>\n<body>\n".
 	"<h2>IPDB - Administrative Tools</h2>\n<hr>\n";
@@ -125,5 +125,5 @@
 );
 } else {
-  print '<a href="/ip/cgi-bin/admin.cgi">Back</a> to main<hr>';
+  print qq(<a href="$IPDB::webpath/cgi-bin/admin.cgi">Back</a> to main<hr>);
 }
 
@@ -213,5 +213,5 @@
 $cities
 </select>
-&nbsp;<a href="javascript:popNotes('/ip/newcity.html')">Add new location</a>
+&nbsp;<a href="javascript:popNotes('$IPDB::webpath/newcity.html')">Add new location</a>
 </td>
 </tr>
@@ -651,5 +651,5 @@
 #
 
-print qq(<hr><a href="/ip/">Back</a> to main interface</a>\n);
+print qq(<hr><a href="$IPDB::webpath/">Back</a> to main interface</a>\n);
 
 printFooter;
Index: /branches/stable/cgi-bin/ipdb.psql
===================================================================
--- /branches/stable/cgi-bin/ipdb.psql	(revision 506)
+++ /branches/stable/cgi-bin/ipdb.psql	(revision 507)
@@ -1,16 +1,3 @@
-DROP DATABASE ipdb;
-
-CREATE USER ipdb WITH PASSWORD 'ipdbpwd';
-
-CREATE DATABASE ipdb;
-
--- Need to do this or our triggers don't work.  Why do we need to do this?
-CREATE FUNCTION "plpgsql_call_handler" () RETURNS language_handler AS '$libdir/plpgsql' LANGUAGE C;
-CREATE TRUSTED LANGUAGE "plpgsql" HANDLER "plpgsql_call_handler";
-
-UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='ipdb')
-	WHERE datname='ipdb';
-
-\connect ipdb ipdb
+-- Initial table setup for IP Database
 
 CREATE TABLE "customers" (
@@ -32,7 +19,4 @@
 );
 
-REVOKE ALL on "customers" from PUBLIC;
-GRANT ALL on "customers" to "ipdb";
-
 CREATE TABLE "masterblocks" (
 	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
@@ -41,7 +25,4 @@
 	"rwhois" character(1) DEFAULT 'n' NOT NULL
 );
-
-REVOKE ALL on "masterblocks" from PUBLIC;
-GRANT ALL on "masterblocks" to "ipdb";
 
 CREATE TABLE "routed" (
@@ -52,14 +33,7 @@
 );
 
-REVOKE ALL on "routed" from PUBLIC;
-GRANT ALL on "routed" to "ipdb";
-GRANT SELECT on "routed" to "ipdb";
-
 CREATE TABLE "temp" (
 	"ofs" integer
 );
-
-REVOKE ALL on "temp" from PUBLIC;
-GRANT ALL on "temp" to "ipdb";
 
 CREATE TABLE "freeblocks" (
@@ -69,7 +43,4 @@
 	"routed" character(1) DEFAULT 'n'
 );
-
-REVOKE ALL on "freeblocks" from PUBLIC;
-GRANT ALL on "freeblocks" to "ipdb";
 
 CREATE TABLE "poolips" (
@@ -90,7 +61,4 @@
 );
 
-REVOKE ALL on "poolips" from PUBLIC;
-GRANT ALL on "poolips" to "ipdb";
-
 CREATE TABLE "allocations" (
 	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
@@ -109,11 +77,5 @@
 );
 
-REVOKE ALL on "allocations" from PUBLIC;
-GRANT ALL on "allocations" to "ipdb";
-
 CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes, allocations.oldcustid, allocations.circuitid FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes, poolips.oldcustid, poolips.circuitid FROM poolips;
-
-REVOKE ALL on "searchme" from PUBLIC;
-GRANT ALL on "searchme" to "ipdb";
 
 CREATE TABLE "alloctypes" (
@@ -167,7 +129,4 @@
 \.
 
-REVOKE ALL on "alloctypes" from PUBLIC;
-GRANT ALL on "alloctypes" to "ipdb";
-
 CREATE TABLE "cities" (
 	"id" serial NOT NULL PRIMARY KEY,
@@ -175,7 +134,4 @@
 	"routing" character(1) DEFAULT 'n' NOT NULL
 );
-
-REVOKE ALL on "cities" from PUBLIC;
-GRANT ALL on "cities" to "ipdb";
 
 --
Index: /branches/stable/cgi-bin/main.cgi
===================================================================
--- /branches/stable/cgi-bin/main.cgi	(revision 506)
+++ /branches/stable/cgi-bin/main.cgi	(revision 507)
@@ -7,5 +7,5 @@
 # Last update by $Author$
 ###
-# Copyright (C) 2004-2010 - Kris Deugau
+# Copyright (C) 2004-2011 - Kris Deugau
 
 use strict;		
@@ -50,6 +50,6 @@
 
 # Headerize!  Make sure we replace the $$EXTRA0$$ bit as needed.
-printHeader('', ($IPDBacl{$authuser} =~ /a/ ?
-	'<td align=right><a href="/ip/cgi-bin/main.cgi?action=assign">Add new assignment</a>' : ''
+printHeader('', $IPDB::webpath, ($IPDBacl{$authuser} =~ /a/ ?
+	'<td align=right><a href="'.$IPDB::webpath.'/cgi-bin/main.cgi?action=assign">Add new assignment</a>' : ''
 	));
 
@@ -73,5 +73,8 @@
   } else {
     open HTML, "<../addmaster.html";
-    print while <HTML>;
+    my $html = join('',<HTML>);
+    close HTML;
+    $html =~ s/\$\$WEBPATH\$\$/$IPDB::webpath/g;
+    print $html;
   }
 } elsif ($webvar{action} eq 'newmaster') {
@@ -136,4 +139,5 @@
   my $html = join('',<HTML>);
   close HTML;
+  $html =~ s/\$\$WEBPATH\$\$/$IPDB::webpath/g;
 
   $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
@@ -168,5 +172,5 @@
 
 print qq(<div align=right style="position: absolute; right: 30px;">).
-	qq(<a href="/ip/cgi-bin/admin.cgi">Admin tools</a></div><br>\n)
+	qq(<a href="$IPDB::webpath/cgi-bin/admin.cgi">Admin tools</a></div><br>\n)
 	if $IPDBacl{$authuser} =~ /A/;
 
@@ -263,5 +267,5 @@
   my $count=0;
   foreach my $master (@masterblocks) {
-    my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=showmaster&block=$master\">$master</a>",
+    my @row = ("<a href=\"$IPDB::webpath/cgi-bin/main.cgi?action=showmaster&block=$master\">$master</a>",
 	$routed{"$master"}, $allocated{"$master"}, $free{"$master"}, 
 	( ($bigfree{"$master"} eq '') ? ("&lt;NONE&gt;") : ("/".$bigfree{"$master"}) )
@@ -274,5 +278,5 @@
   print "</table>\n";
   if ($IPDBacl{$authuser} =~ /a/) {
-    print qq(<a href="/ip/cgi-bin/main.cgi?action=addmaster">Add new master block</a><br><br>\n);
+    print qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=addmaster">Add new master block</a><br><br>\n);
   }
   print "Note:  Free blocks noted here include both routed and unrouted blocks.\n";
@@ -348,5 +352,5 @@
     my $count=0;
     foreach my $master (@localmasters) {
-      my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=showrouted&block=$master\">$master</a>",
+      my @row = ("<a href=\"$IPDB::webpath/cgi-bin/main.cgi?action=showrouted&block=$master\">$master</a>",
 	$routed{"$master"}, $allocated{"$master"},
 	$free{"$master"},
@@ -363,5 +367,5 @@
         qq($master.</div>\n).
 	($IPDBacl{$authuser} =~ /d/ ?
-	        qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n).
+	        qq(<form action="$IPDB::webpath/cgi-bin/main.cgi" method=POST>\n).
 	        qq(<input type=hidden name=action value="delete">\n).
 	        qq(<input type=hidden name=block value="$master">\n).
@@ -437,10 +441,10 @@
     # Prefix subblocks with "Sub "
     my @row = ( (($data[2] =~ /^.r$/) ? 'Sub ' : '').
-	qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]&reallyblock=1">$data[0]</a>),
+	qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=edit&block=$data[0]&reallyblock=1">$data[0]</a>),
 	$data[1], $disp_alloctypes{$data[2]}, $data[3], 
 	($data[4] eq 'y' ? ($ncust == 0 ? 'Yes<small>*</small>' : 'Yes') : 'No'), $data[5]);
     # If the allocation is a pool, allow listing of the IPs in the pool.
     if ($data[2] =~ /^.[pd]$/) {
-      $row[0] .= ' &nbsp; <a href="/ip/cgi-bin/main.cgi?action=listpool'.
+      $row[0] .= ' &nbsp; <a href="$IPDB::webpath/cgi-bin/main.cgi?action=listpool'.
 	"&pool=$data[0]\">List IPs</a>";
     }
@@ -459,5 +463,5 @@
 	qq($master.</div></center>\n).
 	($IPDBacl{$authuser} =~ /d/ ?
-		qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n).
+		qq(<form action="$IPDB::webpath/cgi-bin/main.cgi" method=POST>\n).
 		qq(<input type=hidden name=action value="delete">\n).
 		qq(<input type=hidden name=block value="$master">\n).
@@ -484,5 +488,5 @@
     # Include some HairyPerl(TM) to prefix subblocks with "Sub "
     my @row = ((($data[1] ne 'y' && $data[1] ne 'n') ? 'Sub ' : '').
-	($IPDBacl{$authuser} =~ /a/ ? qq(<a href="/ip/cgi-bin/main.cgi?action=assign&block=$cidr&fbtype=$data[1]">$cidr</a>) : $cidr),
+	($IPDBacl{$authuser} =~ /a/ ? qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=assign&block=$cidr&fbtype=$data[1]">$cidr</a>) : $cidr),
 	$cidr->range);
     printRow(\@row, 'color1') if ($count%2 == 0);
@@ -540,8 +544,8 @@
     #   -> if $data[2] (aka poolips.available) == 'n' then we print the unassign link
     #	   else we print a blank space
-    my @row = ( qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
+    my @row = ( qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
 	$data[1],$data[2],$data[3],
 	( (($data[2] eq 'n') && ($IPDBacl{$authuser} =~ /d/)) ?
-	  ("<a href=\"/ip/cgi-bin/main.cgi?action=delete&block=$data[0]&".
+	  ("<a href=\"$IPDB::webpath/cgi-bin/main.cgi?action=delete&block=$data[0]&".
 	   "alloctype=$data[4]\">Unassign this IP</a>") :
 	  ("&nbsp;") )
@@ -577,4 +581,6 @@
     $html =~ s|\$\$MASKBITS\$\$|$block->masklen|;
     my $typelist = '';
+
+    $html =~ s|\$\$WEBPATH\$\$|$IPDB::webpath|g;
 
     # This is a little dangerous, as it's *theoretically* possible to
@@ -607,4 +613,5 @@
     $html = join('',<HTML>);
     close HTML;
+    $html =~ s|\$\$WEBPATH\$\$|$IPDB::webpath|g;
     my $masterlist = "<select name=allocfrom><option selected>-</option>\n";
     foreach my $master (@masterblocks) {
@@ -1218,5 +1225,5 @@
 
   # Link back to browse-routed or list-pool page on "Update complete" page.
-  my $backlink = "/ip/cgi-bin/main.cgi?action=";
+  my $backlink = "$IPDB::webpath/cgi-bin/main.cgi?action=";
   my $cblock;	# to contain the CIDR of the container block we're retrieving.
   my $sql;
@@ -1406,5 +1413,5 @@
 sub exitError {
   my $errStr = $_[0];
-  printHeader('','');
+  printHeader('', $IPDB::webpath, '');
   print qq(<center><p class="regular"> $errStr </p>
 <input type="button" value="Back" onclick="history.go(-1)">
Index: /branches/stable/cgi-bin/search.cgi
===================================================================
--- /branches/stable/cgi-bin/search.cgi	(revision 506)
+++ /branches/stable/cgi-bin/search.cgi	(revision 507)
@@ -9,5 +9,5 @@
 # Last update by $Author$
 ###
-# Copyright 2005-2010 - Kris Deugau
+# Copyright 2005-2011 - Kris Deugau
 
 use strict;		
@@ -64,6 +64,6 @@
 
 # Headerize!  Make sure we replace the $$EXTRA0$$ bit as needed.
-printHeader('', ($IPDBacl{$authuser} =~ /a/ ?
-	'<td align=right><a href="/ip/cgi-bin/main.cgi?action=assign">Add new assignment</a></td>' : ''
+printHeader('', $IPDB::webpath, ($IPDBacl{$authuser} =~ /a/ ?
+	'<td align=right><a href="'.$IPDB::webpath.'/cgi-bin/main.cgi?action=assign">Add new assignment</a></td>' : ''
 	));
 
@@ -244,4 +244,5 @@
   $html = join('',<HTML>);
   close HTML;
+  $html =~ s/\$\$WEBPATH\$\$/$IPDB::webpath/g;
 
 # Generate table of types
@@ -446,9 +447,9 @@
     # Another bit of HairyPerl(TM) to prefix subblocks with "Sub"
     my @row = (($data[2] =~ /^.r$/ ? 'Sub ' : '').
-	qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
+	qq(<a href="$IPDB::webpath/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
 	$data[1], $disp_alloctypes{$data[2]}, $data[3], $data[4]);
     # Allow listing of pool if desired/required.
     if ($data[2] =~ /^.[pd]$/) {
-      $row[0] .= ' &nbsp; <a href="/ip/cgi-bin/main.cgi?action=listpool'.
+      $row[0] .= ' &nbsp; <a href="'.$IPDB::webpath.'/cgi-bin/main.cgi?action=listpool'.
 	"&pool=$data[0]\">List IPs</a>";
     }
@@ -474,5 +475,5 @@
 	print "<b>$i&nbsp;</b>\n";
       } else {
-	print qq(<a href="/ip/cgi-bin/search.cgi?page=$i&stype=$webvar{stype}&);
+	print qq(<a href="$IPDB::webpath/cgi-bin/search.cgi?page=$i&stype=$webvar{stype}&);
 	if ($webvar{stype} eq 'c') {
 	  print "cidr=$webvar{cidr}&custid=$webvar{custid}&desc=$webvar{desc}&".
Index: /branches/stable/cgi-bin/snCalc.cgi
===================================================================
--- /branches/stable/cgi-bin/snCalc.cgi	(revision 506)
+++ /branches/stable/cgi-bin/snCalc.cgi	(revision 507)
@@ -8,4 +8,5 @@
 
 #file snCalc.cgi	little subnet calculator app
+use MyIPDB;
 
 my %webvar = parse_post();
@@ -17,4 +18,5 @@
 my $start = join('', <HTML>);
 close(HTML);
+$start =~ s/\$\$WEBPATH\$\$/$IPDB::webpath/g;
 print $start;
 
Index: /branches/stable/compsearch.html
===================================================================
--- /branches/stable/compsearch.html	(revision 506)
+++ /branches/stable/compsearch.html	(revision 507)
@@ -1,5 +1,5 @@
 <div class="indent">
 <div class="heading">Complex Search</div>
-<form action="/ip/cgi-bin/search.cgi" method=POST>
+<form action="$$WEBPATH$$/cgi-bin/search.cgi" method=POST>
 <table bgcolor="black" cellspacing="1" cellpadding="2">
 <tr class="color1">
Index: /branches/stable/fb-assign.html
===================================================================
--- /branches/stable/fb-assign.html	(revision 506)
+++ /branches/stable/fb-assign.html	(revision 507)
@@ -23,5 +23,5 @@
 $$NODELIST$$
 </select>
-&nbsp;<a href="javascript:popNotes('/ip/newnode.html')">Add new location</a>
+&nbsp;<a href="javascript:popNotes('$$WEBPATH$$/newnode.html')">Add new location</a>
 </td></tr>
 <tr class="color1">
Index: /branches/stable/footer.inc
===================================================================
--- /branches/stable/footer.inc	(revision 506)
+++ /branches/stable/footer.inc	(revision 507)
@@ -11,5 +11,5 @@
       <div align="right"><font face="Arial, Helvetica, sans-serif" size="1"> DeepNet
  <a href="http://projects.deepnet.cx/trac/ipdb" target="_blank">IP Database</a> |
- Copyright 2004-2010 <a href="mailto:kdeugau@deepnet.cx">Kris Deugau</a><br>
+ Copyright 2004-2011 <a href="mailto:kdeugau@deepnet.cx">Kris Deugau</a><br>
 Written for standards-based browsers (eg <a href="http://www.mozilla.org">Mozilla</a>)</font></div>
     </td>
Index: /branches/stable/header.inc
===================================================================
--- /branches/stable/header.inc	(revision 506)
+++ /branches/stable/header.inc	(revision 507)
@@ -3,16 +3,16 @@
 	<title>[IP Database v2]</title>
 	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
-	<link rel="stylesheet" type="text/css" href="/ip/ipdb.css">
-	<link rel="stylesheet" type="text/css" href="/ip/local.css">
+	<link rel="stylesheet" type="text/css" href="$$WEBPATH$$/ipdb.css">
+	<link rel="stylesheet" type="text/css" href="$$WEBPATH$$/local.css">
 
 <script language=javascript>
 function openHelp() {
-	window.open("/ip/help.html", "help_window", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=400")
+	window.open("$$WEBPATH$$/help.html", "help_window", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=400")
 }
 function openTables() {
-	window.open("/ip/tables.html", "subnet_tables", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=250")	
+	window.open("$$WEBPATH$$/tables.html", "subnet_tables", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=250")	
 }
 function helpAllocTypes() {
-	window.open("/ip/alloctypes.html", "alloc_window", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=750,height=550")
+	window.open("$$WEBPATH$$/alloctypes.html", "alloc_window", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=750,height=550")
 }
 function popNotes(page) {
@@ -26,8 +26,8 @@
 <table width="98%" border="0" cellspacing="0" cellpadding="0" height="0">
   <tbody><tr>
-      <td nowrap=""><a href="/ip/index.shtml" target="_blank"><img src="/ip/images/logo.png" width="167" height="60" border="0" alt="[ Logo ]"></a></td>
+      <td nowrap=""><a href="$$WEBPATH$$/index.shtml" target="_blank"><img src="$$WEBPATH$$/images/logo.png" width="167" height="60" border="0" alt="[ Logo ]"></a></td>
     <td nowrap="" valign="bottom"> 
       <div align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
-	  <a href="/ip/index.shtml">
+	  <a href="$$WEBPATH$$/index.shtml">
 	  [IP Database v2 Home]</a></font></b></div>
     </td>
@@ -41,5 +41,5 @@
 <tr class="color1">
 <td width=10></td>
-<form method="POST" action="/ip/cgi-bin/search.cgi">
+<form method="POST" action="$$WEBPATH$$/cgi-bin/search.cgi">
 <td width=390>Quick Search:
 <input type="text" name="input" size="20" maxlength="50" class="regular">
@@ -48,5 +48,5 @@
 <input type=submit value="Go!" class="heading">
 <input type="button" value=" Help? " onclick="openHelp()" class="regular">
-</td><td width=10></td><td><a href="/ip/cgi-bin/search.cgi">Complex Search</a></td>
+</td><td width=10></td><td><a href="$$WEBPATH$$/cgi-bin/search.cgi">Complex Search</a></td>
 $$EXTRA0$$
 <td width=60></td>
@@ -62,5 +62,5 @@
 </tbody></table>
 <table width="98%" border=0><tr><td align=right>
-<a href="/ip/cgi-bin/main.cgi?action=nodesearch">Find by connection point</a>
+<a href="$$WEBPATH$$/cgi-bin/main.cgi?action=nodesearch">Find by connection point</a>
 </td></tr></table>
 <br>
Index: /branches/stable/help.html
===================================================================
--- /branches/stable/help.html	(revision 506)
+++ /branches/stable/help.html	(revision 507)
@@ -3,6 +3,6 @@
 <title>IP Database</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
-<link rel="stylesheet" type="text/css" href="/ip/ipdb.css" />
-<link rel="stylesheet" type="text/css" href="/ip/local.css" />
+<link rel="stylesheet" type="text/css" href="ipdb.css" />
+<link rel="stylesheet" type="text/css" href="local.css" />
 
 </head>
Index: /branches/stable/index.shtml
===================================================================
--- /branches/stable/index.shtml	(revision 506)
+++ /branches/stable/index.shtml	(revision 507)
@@ -1,1 +1,1 @@
-<!--#include virtual="/ip/cgi-bin/main.cgi?action=index" -->
+<!--#include virtual="cgi-bin/main.cgi?action=index" -->
Index: /branches/stable/ipdb.spec
===================================================================
--- /branches/stable/ipdb.spec	(revision 506)
+++ /branches/stable/ipdb.spec	(revision 507)
@@ -2,4 +2,6 @@
 # $Id$
 
+# some defines for building on Debian with debbuild
+%if %{_vendor} == "debbuild"
 %define errata 99
 
@@ -28,4 +30,5 @@
 
 %define release %{relnum}.%{errata}%{debdist}
+%endif
 
 Summary: IP Database
Index: /branches/stable/newcity.html
===================================================================
--- /branches/stable/newcity.html	(revision 506)
+++ /branches/stable/newcity.html	(revision 507)
@@ -2,6 +2,6 @@
 <head>
 	<title>IP Database - Add new city</title>
-	<link rel="stylesheet" type="text/css" href="/ip/ipdb.css" />
-	<link rel="stylesheet" type="text/css" href="/ip/local.css" />
+	<link rel="stylesheet" type="text/css" href="ipdb.css" />
+	<link rel="stylesheet" type="text/css" href="local.css" />
 
 	<SCRIPT language="JavaScript" type="text/javascript">
Index: /branches/stable/newnode.html
===================================================================
--- /branches/stable/newnode.html	(revision 506)
+++ /branches/stable/newnode.html	(revision 507)
@@ -2,6 +2,6 @@
 <head>
 	<title>IP Database - Add new tower/demarc switch</title>
-	<link rel="stylesheet" type="text/css" href="/ip/ipdb.css" />
-	<link rel="stylesheet" type="text/css" href="/ip/local.css" />
+	<link rel="stylesheet" type="text/css" href="ipdb.css" />
+	<link rel="stylesheet" type="text/css" href="local.css" />
 
 	<SCRIPT language="JavaScript" type="text/javascript">
Index: /branches/stable/nodesearch.html
===================================================================
--- /branches/stable/nodesearch.html	(revision 506)
+++ /branches/stable/nodesearch.html	(revision 507)
@@ -1,5 +1,5 @@
 <div class="indent">
 <div class="heading">Switch/tower search</div>
-<form action="/ip/cgi-bin/search.cgi" method=POST>
+<form action="$$WEBPATH$$/cgi-bin/search.cgi" method=POST>
 <table bgcolor="black" cellspacing="1" cellpadding="2">
 <tr class="color1">
Index: /branches/stable/startsn.html
===================================================================
--- /branches/stable/startsn.html	(revision 506)
+++ /branches/stable/startsn.html	(revision 507)
@@ -4,6 +4,6 @@
 <title>IP Database</title>
 
-<link rel="stylesheet" type="text/css" href="/ip/ipdb.css" />
-<link rel="stylesheet" type="text/css" href="/ip/local.css" />
+<link rel="stylesheet" type="text/css" href="$$WEBPATH$$/ipdb.css" />
+<link rel="stylesheet" type="text/css" href="$$WEBPATH$$/local.css" />
 
 </head>
