Rajoute l'option pour avoir un checksum des domaines

(permet un check d'intégrité des data dans alternc-slavedns, cf r4309)
This commit is contained in:
Alan Garcia 2013-04-24 08:07:42 +00:00
parent 2e8dc80289
commit 93df1709f1
2 changed files with 18 additions and 3 deletions

View File

@ -29,6 +29,11 @@
*/
require_once("../class/config_nochk.php");
$fields = array (
"integrity" => array ("get", "boolean", "0"),
);
getFields($fields);
// Check for the http authentication
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Domain List Authentication"');
@ -36,7 +41,11 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
exit;
} else {
if ($dom->check_slave_account($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])) {
$dom->echo_domain_list();
if (!$integrity) {
$dom->echo_domain_list();
} else {
$dom->echo_domain_list(true);
}
} else {
header('WWW-Authenticate: Basic realm="Domain List Authentication"');
header('HTTP/1.0 401 Unauthorized');

View File

@ -1210,11 +1210,17 @@ class m_dom {
/* ----------------------------------------------------------------- */
/** Out (echo) the complete hosted domain list :
*/
function echo_domain_list() {
function echo_domain_list($integrity=false) {
global $db,$err;
$db->query("SELECT domaine FROM domaines WHERE gesdns=1 ORDER BY domaine");
$tt="";
while ($db->next_record()) {
echo $db->f("domaine")."\n";
#echo $db->f("domaine")."\n";
$tt.=$db->f("domaine")."\n";
}
echo $tt;
if ($integrity) {
echo md5($tt)."\n";
}
return true;
}