From: Alexander M. <key...@us...> - 2003-07-16 13:54:09
|
CVSROOT : /cvsroot/publicdnsadmin Module : publicdnsadmin Commit time: 2003-07-16 13:54:07 UTC Modified files: whois.php docs/CHANGELOG docs/INSTALL docs/TODO docs/mysql.sql docs/postgresql.sql Added files: docs/whois.update.mysql.sql docs/whois.update.postgres.sql Log message: Author: Alexander Maassen <out...@ke...> Log message: - whois now uses SQL as source for whois servers. If you upgrade, import docs/whois.update.<dbtype>.sql - Various documentation updates regarding new changes ---------------------- diff included ---------------------- Index: publicdnsadmin/docs/CHANGELOG diff -u publicdnsadmin/docs/CHANGELOG:1.17 publicdnsadmin/docs/CHANGELOG:1.18 --- publicdnsadmin/docs/CHANGELOG:1.17 Wed Jul 16 05:38:20 2003 +++ publicdnsadmin/docs/CHANGELOG Wed Jul 16 06:53:57 2003 @@ -33,3 +33,5 @@ the gziped sql file the user downloads. - Bug reporting address is now a link to submitting a bug in the sourceforge project interface. +OUTsider <out...@ke...> - 16/7/2003 - Updated TODO and docs again to reflect new changes + - Moved whois to use SQL instead as source for whois servers Index: publicdnsadmin/docs/INSTALL diff -u publicdnsadmin/docs/INSTALL:1.5 publicdnsadmin/docs/INSTALL:1.6 --- publicdnsadmin/docs/INSTALL:1.5 Thu Jun 19 22:57:39 2003 +++ publicdnsadmin/docs/INSTALL Wed Jul 16 06:53:57 2003 @@ -24,4 +24,5 @@ can be written there. If you are upgrading from a CVS version, make sure you run the *.update.sql - scripts. + scripts. (In some cases the update.sql files are specified for your type of + sql backend, so don't simply use *update*sql !!! (Do NOT complain afterwards) Index: publicdnsadmin/docs/TODO diff -u publicdnsadmin/docs/TODO:1.6 publicdnsadmin/docs/TODO:1.7 --- publicdnsadmin/docs/TODO:1.6 Wed Jul 16 04:51:30 2003 +++ publicdnsadmin/docs/TODO Wed Jul 16 06:53:57 2003 @@ -1,5 +1,6 @@ - Some sort of maintenence news system (displayed on the main login page). -- Graphical code check upon signup (and possibly login). -DONE -- Improve dbbackup.php. -DONE - Improve nsstats.php. -- Add URL/HWINFO/MBOXFW/RP support +- Add URL/HWINFO/MBOXFW/RP record type support. +- Create an interface to manage domain registries whois servers. +- Syntax check records for validity to make it more fool proof. + Index: publicdnsadmin/docs/mysql.sql diff -u publicdnsadmin/docs/mysql.sql:1.2 publicdnsadmin/docs/mysql.sql:1.3 --- publicdnsadmin/docs/mysql.sql:1.2 Wed Jun 18 01:05:47 2003 +++ publicdnsadmin/docs/mysql.sql Wed Jul 16 06:53:57 2003 @@ -38,7 +38,16 @@ KEY username (username,password) ) TYPE=MyISAM; +CREATE TABLE whoisservers ( + id int(11) NOT NULL auto_increment, + tld varchar(8) NOT NULL default '', + server varchar(128) NOT NULL default '', + PRIMARY KEY (id) +) TYPE=MyISAM; + CREATE TABLE gfxcodes ( + x + x code VARCHAR(25) NOT NULL, crc VARCHAR(128) NOT NULL, expire INT NOT NULL @@ -47,3 +56,13 @@ CREATE INDEX gfxcodes_idx ON gfxcodes(code,crc,expire); INSERT INTO users VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'DNS Administrator', 'hos...@ex...', '', '2'); +INSERT INTO whoisservers VALUES (1,'com','whois.crsnic.net'); +INSERT INTO whoisservers VALUES (2,'net','whois.crsnic.net'); +INSERT INTO whoisservers VALUES (3,'edu','whois.crsnic.net'); +INSERT INTO whoisservers VALUES (4,'info','whois.afilias.net'); +INSERT INTO whoisservers VALUES (5,'name','whois.nic.name'); +INSERT INTO whoisservers VALUES (6,'biz','whois.nic.biz'); +INSERT INTO whoisservers VALUES (7,'us','whois.nic.us'); +INSERT INTO whoisservers VALUES (8,'cc','whois.enicregistrar.com'); +INSERT INTO whoisservers VALUES (9,'org','whois.enom.com'); +INSERT INTO whoisservers VALUES (10,'ws','whois.nic.ws'); Index: publicdnsadmin/docs/postgresql.sql diff -u publicdnsadmin/docs/postgresql.sql:1.4 publicdnsadmin/docs/postgresql.sql:1.5 --- publicdnsadmin/docs/postgresql.sql:1.4 Tue Jul 15 19:33:08 2003 +++ publicdnsadmin/docs/postgresql.sql Wed Jul 16 06:53:57 2003 @@ -38,6 +38,13 @@ CREATE INDEX "users_password_key" ON "users" ("password"); CREATE INDEX "users_username_key" ON "users" ("username"); +CREATE TABLE whoisservers ( + id SERIAL, + tld varchar(8) NOT NULL default '', + server varchar(128) NOT NULL default '', + PRIMARY KEY (id) +); + CREATE TABLE gfxcodes ( code VARCHAR(25) NOT NULL, crc VARCHAR(128) NOT NULL, @@ -47,3 +54,14 @@ CREATE INDEX gfxcodes_idx ON gfxcodes(code,crc,expire); INSERT INTO "users" ("username", "password", "name", "email", "company", "permission") VALUES('outsider', '21232f297a57a5a743894a0e4a801fc3', 'DNS Administrator', 'out...@ke...', 'Key2Peace BotServices', 2); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('com','whois.crsnic.net'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('net','whois.crsnic.net'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('edu','whois.crsnic.net'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('info','whois.afilias.net'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('name','whois.nic.name'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('biz','whois.nic.biz'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('us','whois.nic.us'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('cc','whois.enicregistrar.com'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('org','whois.enom.com'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('ws','whois.nic.ws'); + Index: publicdnsadmin/docs/whois.update.mysql.sql diff -u /dev/null publicdnsadmin/docs/whois.update.mysql.sql:1.1 --- /dev/null Wed Jul 16 06:54:08 2003 +++ publicdnsadmin/docs/whois.update.mysql.sql Wed Jul 16 06:53:57 2003 @@ -0,0 +1,17 @@ +CREATE TABLE whoisservers ( + id int(11) NOT NULL auto_increment, + tld varchar(8) NOT NULL default '', + server varchar(128) NOT NULL default '', + PRIMARY KEY (id) +); + +INSERT INTO whoisservers VALUES (1,'com','whois.crsnic.net'); +INSERT INTO whoisservers VALUES (2,'net','whois.crsnic.net'); +INSERT INTO whoisservers VALUES (3,'edu','whois.crsnic.net'); +INSERT INTO whoisservers VALUES (4,'info','whois.afilias.net'); +INSERT INTO whoisservers VALUES (5,'name','whois.nic.name'); +INSERT INTO whoisservers VALUES (6,'biz','whois.nic.biz'); +INSERT INTO whoisservers VALUES (7,'us','whois.nic.us'); +INSERT INTO whoisservers VALUES (8,'cc','whois.enicregistrar.com'); +INSERT INTO whoisservers VALUES (9,'org','whois.enom.com'); +INSERT INTO whoisservers VALUES (10,'ws','whois.nic.ws'); Index: publicdnsadmin/docs/whois.update.postgres.sql diff -u /dev/null publicdnsadmin/docs/whois.update.postgres.sql:1.1 --- /dev/null Wed Jul 16 06:54:08 2003 +++ publicdnsadmin/docs/whois.update.postgres.sql Wed Jul 16 06:53:57 2003 @@ -0,0 +1,19 @@ +CREATE TABLE whoisservers ( + id SERIAL, + tld varchar(8) NOT NULL default '', + server varchar(128) NOT NULL default '', + PRIMARY KEY (id) +); +DELETE FROM whoisservers; + +INSERT INTO "whoisservers" ("tld", "server") VALUES ('com','whois.crsnic.net'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('net','whois.crsnic.net'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('edu','whois.crsnic.net'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('info','whois.afilias.net'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('name','whois.nic.name'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('biz','whois.nic.biz'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('us','whois.nic.us'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('cc','whois.enicregistrar.com'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('org','whois.enom.com'); +INSERT INTO "whoisservers" ("tld", "server") VALUES ('ws','whois.nic.ws'); + Index: publicdnsadmin/whois.php diff -u publicdnsadmin/whois.php:1.1.1.1 publicdnsadmin/whois.php:1.2 --- publicdnsadmin/whois.php:1.1.1.1 Wed Apr 16 00:19:07 2003 +++ publicdnsadmin/whois.php Wed Jul 16 06:53:57 2003 @@ -12,83 +12,68 @@ require("lib/prepend.php"); include("lib/header.php"); -$dbh = db_connect(); +function wwwhois($target){ + global $ntarget; + $dbh = db_connect(); + $tld = end(explode(".", $target)); + $result = $dbh->query("SELECT server FROM whoisservers WHERE tld = '$tld'"); + + if (!$dbh->isError($result) && $result->numRows()) { + $row = $result->fetchRow(); + $server = $row["server"]; + } else { + $msg .= "Sorry but this top level domain is not \(yet\) supported.</blockquote>"; + message($msg); + return; + } + $dbh->disconnect(); -function wwwhois($target){ -global $ntarget; -$server = "whois.crsnic.net"; -message("<p><b>Whois Results:</b><blockquote>"); -#Determine which WHOIS server to use for the supplied TLD -if((eregi("\.com\$|\.net\$|\.edu\$", $target)) || (eregi("\.com\$|\.net\$|\.edu\$", $ntarget))) - $server = "whois.crsnic.net"; -else if((eregi("\.info\$", $target)) || (eregi("\.info\$", $ntarget))) - $server = "whois.afilias.net"; -else if((eregi("\.name\$", $target)) || (eregi("\.name\$", $ntarget))) - $server = "whois.nic.name"; -else if((eregi("\.biz\$", $target)) || (eregi("\.biz\$", $ntarget))) - $server = "whois.nic.biz"; -else if((eregi("\.us\$", $target)) || (eregi("\.us\$", $ntarget))) - $server = "whois.nic.us"; -else if((eregi("\.cc\$", $target)) || (eregi("\.cc\$", $ntarget))) - $server = "whois.enicregistrar.com"; -else if((eregi("\.org\$", $target)) || (eregi("\.org\$", $ntarget))) - $server = "whois.enom.com"; -else if((eregi("\.ws\$", $target)) || (eregi("\.ws\$", $ntarget))) - $server = "whois.nic.ws"; -else{ - $msg .= "I only support .com, .net, .org, .edu, .info, .name, .us, .cc, .ws, and .biz.</blockquote>"; + message("Connecting to $server.. <br><br>"); + if (! $sock = fsockopen($server, 43, $num, $error, 10)){ + unset($sock); + $msg .= "Timed-out connecting to $server (port 43)"; + } else { + fputs($sock, "$target\n"); + while (!feof($sock)) + $buffer .= fgets($sock, 10240); + } + fclose($sock); + if(! eregi("Whois Server:", $buffer)){ + if(eregi("no match", $buffer)) + message("NOT FOUND: No match for $target<br>"); + else + message("Ambiguous query, multiple matches for $target:<br>"); + } else { + $buffer = split("\n", $buffer); + for ($i=0; $i<sizeof($buffer); $i++){ + if (eregi("Whois Server:", $buffer[$i])) + $buffer = $buffer[$i]; + } + $nextServer = substr($buffer, 17, (strlen($buffer)-17)); + $buffer = ""; + message("Deferred to specific whois server: $nextServer...<br><br>"); + if(! $sock = fsockopen($nextServer, 43, $num, $error, 10)){ + unset($sock); + $msg .= "Timed-out connecting to $nextServer (port 43)"; + } else { + fputs($sock, "$target\n"); + while (!feof($sock)) + $buffer .= fgets($sock, 10240); + fclose($sock); + } + } + $msg .= nl2br($buffer); + $msg .= "</blockquote></p>"; message($msg); - return; -} - -message("Connecting to $server...<br><br>"); -if (! $sock = fsockopen($server, 43, $num, $error, 10)){ - unset($sock); - $msg .= "Timed-out connecting to $server (port 43)"; -} -else{ - fputs($sock, "$target\n"); - while (!feof($sock)) - $buffer .= fgets($sock, 10240); -} - fclose($sock); - if(! eregi("Whois Server:", $buffer)){ - if(eregi("no match", $buffer)) - message("NOT FOUND: No match for $target<br>"); - else - message("Ambiguous query, multiple matches for $target:<br>"); - } - else{ - $buffer = split("\n", $buffer); - for ($i=0; $i<sizeof($buffer); $i++){ - if (eregi("Whois Server:", $buffer[$i])) - $buffer = $buffer[$i]; - } - $nextServer = substr($buffer, 17, (strlen($buffer)-17)); - $buffer = ""; - message("Deferred to specific whois server: $nextServer...<br><br>"); - if(! $sock = fsockopen($nextServer, 43, $num, $error, 10)){ - unset($sock); - $msg .= "Timed-out connecting to $nextServer (port 43)"; - } - else{ - fputs($sock, "$target\n"); - while (!feof($sock)) - $buffer .= fgets($sock, 10240); - fclose($sock); - } -} -$msg .= nl2br($buffer); -$msg .= "</blockquote></p>"; -message($msg); } function message($msg){ -echo $msg; -flush(); + echo $msg; + flush(); } +$dbh = db_connect(); $zoneid = $_GET["id"]; $result = $dbh->query("SELECT name FROM domains WHERE id = '$zoneid'"); @@ -104,5 +89,6 @@ } $dbh->disconnect(); include("lib/footer.php"); + ?> ----------------------- End of diff ----------------------- |