Commit 4990aa7fee0ff0d7cc34938a7e93e41fd8794993
1 parent
e56c67df
php8 support, bugfixes
Showing
6 changed files
with
25 additions
and
22 deletions
README.md
config/config.php-default
... | ... | @@ -18,4 +18,7 @@ $_CONF['nocaptcha'] = array ( |
18 | 18 | $_CONF['path'] = '/path/of/your/zones'; |
19 | 19 | $_CONF['conf'] = '/path/of/your/main/config'; |
20 | 20 | $_CONF['rollerconf'] = '/path/of/your/rollrec/config'; |
21 | +$_CONF['namedcheckconf']= '/usr/bin/named-checkconf'; | |
22 | +$_CONF['namedcheckzone']= '/usr/bin/named-checkzone'; | |
23 | +$_CONF['rndc'] = '/usr/sbin/rndc'; | |
21 | 24 | ?> | ... | ... |
lib/punycode.class.php
... | ... | @@ -50,7 +50,7 @@ class Punycode |
50 | 50 | $punycode_pieces = array(); |
51 | 51 | foreach($pieces as $piece) |
52 | 52 | { |
53 | - if (preg_match("/[\x{80}-\x{FFFF}]/u", $piece))//is multi byte utf8 | |
53 | + if (preg_match("/[\x[80]-\x{FFFF}]/u", $piece))//is multi byte utf8 | |
54 | 54 | { |
55 | 55 | $punycode_pieces[] = "xn--".self::encode($piece); |
56 | 56 | } |
... | ... | @@ -344,11 +344,11 @@ class Punycode |
344 | 344 | |
345 | 345 | public static function uniord($c)//cousin of ord() but for unicode |
346 | 346 | { |
347 | - $ord0 = ord($c{0}); if ($ord0>=0 && $ord0<=127) return $ord0; | |
348 | - $ord1 = ord($c{1}); if ($ord0>=192 && $ord0<=223) return ($ord0-192)*64 + ($ord1-128); | |
347 | + $ord0 = ord($c[0]); if ($ord0>=0 && $ord0<=127) return $ord0; | |
348 | + $ord1 = ord($c[1]); if ($ord0>=192 && $ord0<=223) return ($ord0-192)*64 + ($ord1-128); | |
349 | 349 | if ($ord0==0xed && ($ord1 & 0xa0) == 0xa0) return false; //code points, 0xd800 to 0xdfff |
350 | - $ord2 = ord($c{2}); if ($ord0>=224 && $ord0<=239) return ($ord0-224)*4096 + ($ord1-128)*64 + ($ord2-128); | |
351 | - $ord3 = ord($c{3}); if ($ord0>=240 && $ord0<=247) return ($ord0-240)*262144 + ($ord1-128)*4096 + ($ord2-128)*64 + ($ord3-128); | |
350 | + $ord2 = ord($c[2]); if ($ord0>=224 && $ord0<=239) return ($ord0-224)*4096 + ($ord1-128)*64 + ($ord2-128); | |
351 | + $ord3 = ord($c[3]); if ($ord0>=240 && $ord0<=247) return ($ord0-240)*262144 + ($ord1-128)*4096 + ($ord2-128)*64 + ($ord3-128); | |
352 | 352 | return false; |
353 | 353 | } |
354 | 354 | public static function utf8($num)//cousin of ascii() but for utf8 |
... | ... | @@ -365,17 +365,17 @@ class Punycode |
365 | 365 | { |
366 | 366 | for ($i=0, $ix=strlen($string); $i < $ix; $i++) |
367 | 367 | { |
368 | - $c = ord($string{$i}); | |
368 | + $c = ord($string[$i]); | |
369 | 369 | if ($c==0x09 || $c==0x0a || $c==0x0d || (0x20 <= $c && $c < 0x7e) ) $n = 0; # 0bbbbbbb |
370 | 370 | else if (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb |
371 | - else if ($c==0xed && (ord($string{$i+1}) & 0xa0)==0xa0) return false; //code points, 0xd800 to 0xdfff | |
371 | + else if ($c==0xed && (ord($string[$i+1]) & 0xa0)==0xa0) return false; //code points, 0xd800 to 0xdfff | |
372 | 372 | else if (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb |
373 | 373 | else if (($c & 0xF8) == 0xF0) $n=3; # 11110bbb |
374 | 374 | //else if (($c & 0xFC) == 0xF8) $n=4; # 111110bb //byte 5, unnecessary in 4 byte UTF-8 |
375 | 375 | //else if (($c & 0xFE) == 0xFC) $n=5; # 1111110b //byte 6, unnecessary in 4 byte UTF-8 |
376 | 376 | else return false; |
377 | 377 | for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ? |
378 | - if ((++$i == $ix) || ((ord($string{$i}) & 0xC0) != 0x80)) | |
378 | + if ((++$i == $ix) || ((ord($string[$i]) & 0xC0) != 0x80)) | |
379 | 379 | return false; |
380 | 380 | } |
381 | 381 | } | ... | ... |
lib/smbind.class.php
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | define('TIMES_PATTERN', '/\s*(\d+\w?)\s+(\d+\w?)\s+(\d+\w?)\s+(\d+\w?)\s+(\d+\w?)/msi'); |
13 | 13 | define('TXT_PATTERN', '/^\"(.*)\"/msi'); |
14 | 14 | define('MX_PATTERN', '/^(\d+)\s+([^\s]*)/msi'); |
15 | - define('TYPE_PATTERN', '(A|A6|AAAA|AFSDB|APL|ATMA|AXFR|CERT|CNAME|DNAME|DNSKEY|DS|EID|GPOS|HINFO|ISDN|IXFR|KEY|KX|LOC|MAILB|MINFO|MX|NAPTR|NIMLOC|NS|NSAP|NSAP-PTR|NSEC|NXT|OPT|PTR|PX|RP|RRSIG|RT|SIG|SINK|SRV|SSHFP|TKEY|TSIG|TXT|WKS|X25)'); | |
15 | + define('TYPE_PATTERN', '(A|A6|AAAA|AFSDB|APL|ATMA|AXFR|CERT|CAA|CNAME|DNAME|DNSKEY|DS|EID|GPOS|HINFO|ISDN|IXFR|KEY|KX|LOC|MAILB|MINFO|MX|NAPTR|NIMLOC|NS|NSAP|NSAP-PTR|NSEC|NXT|OPT|PTR|PX|RP|RRSIG|RT|SIG|SINK|SRV|SSHFP|TKEY|TSIG|TXT|WKS|X25)'); | |
16 | 16 | define('RECORD_PATTERN', '/^([^\s]+)?(\s+[\d][\d\w]*)?(\s+IN)?\s+'.TYPE_PATTERN.'\s+([^\s].*$)/msi'); |
17 | 17 | define('BIND_TIME_PATTERN', '/^(\d+)([smhdw])/'); |
18 | 18 | define('IDN_PUNY_PATTERN', '/[^a-z0-9-]/i'); |
... | ... | @@ -220,8 +220,8 @@ |
220 | 220 | $_CONF['nocaptcha'] = array(); |
221 | 221 | $_CONF['path'] = "/etc/smbind-ng/zones/"; |
222 | 222 | $_CONF['conf'] = "/etc/smbind-ng/smbind-ng.conf"; |
223 | - $_CONF['namedcheckconf'] = (is_executable("/usr/sbin/named-checkconf")) ? "/usr/sbin/named-checkconf" : ""; | |
224 | - $_CONF['namedcheckzone'] = (is_executable("/usr/sbin/named-checkzone")) ? "/usr/sbin/named-checkzone" : ""; | |
223 | + $_CONF['namedcheckconf'] = (is_executable("/usr/bin/named-checkconf")) ? "/usr/bin/named-checkconf" : ""; | |
224 | + $_CONF['namedcheckzone'] = (is_executable("/usr/bin/named-checkzone")) ? "/usr/bin/named-checkzone" : ""; | |
225 | 225 | $_CONF['rndc'] = (is_executable("/usr/sbin/rndc")) ? "/usr/sbin/rndc" : ""; |
226 | 226 | $_CONF['zonesigner'] = "/usr/sbin/zonesigner"; |
227 | 227 | $_CONF['rollinit'] = "/usr/sbin/rollinit"; |
... | ... | @@ -495,14 +495,14 @@ |
495 | 495 | $this->data['id'] = $ret['id']; |
496 | 496 | return true; |
497 | 497 | } else { |
498 | - $self->data['id'] = $aid['id']; | |
499 | - $res = $this->db->query("SELECT * FROM users WHERE id = '" . $self->data['id'] . "'"); | |
498 | + $this->data['id'] = $aid['id']; | |
499 | + $res = $this->db->query("SELECT * FROM users WHERE id = '" . $this->data['id'] . "'"); | |
500 | 500 | if (MDB2::isError($res)) { |
501 | 501 | $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo(); |
502 | 502 | error_log($this->err); |
503 | 503 | return false; |
504 | 504 | } elseif ($res->numRows() == 0) { |
505 | - $this->err .= "User not found with this id = " . $self->data['id']; | |
505 | + $this->err .= "User not found with this id = " . $this->data['id']; | |
506 | 506 | error_log($this->err); |
507 | 507 | return false; |
508 | 508 | } else { |
... | ... | @@ -655,9 +655,9 @@ |
655 | 655 | |
656 | 656 | public function eraseUser() { |
657 | 657 | $this->loadUserZones(); |
658 | - $mz =array(); | |
658 | + $mz = array(); | |
659 | 659 | foreach ($this->mzones as $master) { |
660 | - $mz = new masterRecord($master); | |
660 | + $mz = new masterZone($master); | |
661 | 661 | $mz->loadZoneHead(); |
662 | 662 | $mzh = $mz->getZoneHead(); |
663 | 663 | $mzh['owner'] = 1; |
... | ... | @@ -667,7 +667,7 @@ |
667 | 667 | $mz =array(); |
668 | 668 | $sz =array(); |
669 | 669 | foreach ($this->szones as $slave) { |
670 | - $sz = new slaveRecord($slave); | |
670 | + $sz = new slaveZone($slave); | |
671 | 671 | $sz->loadZoneHead(); |
672 | 672 | $szh = $sz->getZoneHead(); |
673 | 673 | $szh['owner'] = 1; |
... | ... | @@ -1907,13 +1907,13 @@ |
1907 | 1907 | if ( |
1908 | 1908 | ($this->head['sec_dns'] == '##EMPTY##') && |
1909 | 1909 | ($parsed['type'] == 'NS') && |
1910 | - ($parsed['destination'] != $self->head['pri_dns']) && | |
1910 | + ($parsed['destination'] != $this->head['pri_dns']) && | |
1911 | 1911 | ( |
1912 | 1912 | ($parsed['host'] == '@') || |
1913 | 1913 | ($parsed['host'] == '') |
1914 | 1914 | ) |
1915 | 1915 | ) { |
1916 | - $self->head['sec_dns'] == $parsed['destination']; | |
1916 | + $this->head['sec_dns'] == $parsed['destination']; | |
1917 | 1917 | } |
1918 | 1918 | $this->records[] = $recd; |
1919 | 1919 | $recrow = ''; | ... | ... |
mysql.sql
... | ... | @@ -91,7 +91,7 @@ CREATE TABLE `options` ( |
91 | 91 | |
92 | 92 | LOCK TABLES `options` WRITE; |
93 | 93 | /*!40000 ALTER TABLE `options` DISABLE KEYS */; |
94 | -INSERT INTO `options` VALUES ('A','record','on'),('A6','record','off'),('AAAA','record','off'),('AFSDB','record','off'),('APL','record','off'),('ATMA','record','off'),('AXFR','record','off'),('CERT','record','off'),('CNAME','record','on'),('DNAME','record','off'),('DNSKEY','record','off'),('DS','record','off'),('EID','record','off'),('GPOS','record','off'),('HINFO','record','off'),('hostmaster','normal','postmaster.your.ns'),('ISDN','record','off'),('IXFR','record','off'),('KEY','record','off'),('KX','record','off'),('LOC','record','off'),('MAILB','record','off'),('master','normal','0.0.0.0'),('MINFO','record','off'),('MX','record','on'),('NAPTR','record','off'),('NIMLOC','record','off'),('NS','record','on'),('NSAP','record','off'),('NSAP-PTR','record','off'),('NSEC','record','off'),('NXT','record','off'),('OPT','record','off'),('prins','normal','your.master.ns'),('PTR','record','off'),('PX','record','off'),('range','normal','10'),('RP','record','off'),('RRSIG','record','off'),('RT','record','off'),('secns','normal','your.sec.ns'),('SIG','record','off'),('SINK','record','off'),('SRV','record','on'),('SSHFP','record','off'),('TKEY','record','off'),('TSIG','record','off'),('TXT','record','on'),('WKS','record','off'),('X25','record','off'); | |
94 | +INSERT INTO `options` VALUES ('A','record','on'),('A6','record','off'),('AAAA','record','off'),('AFSDB','record','off'),('APL','record','off'),('ATMA','record','off'),('AXFR','record','off'),('CAA','record','off'),('CERT','record','off'),('CNAME','record','on'),('DNAME','record','off'),('DNSKEY','record','off'),('DS','record','off'),('EID','record','off'),('GPOS','record','off'),('HINFO','record','off'),('hostmaster','normal','postmaster.your.ns'),('ISDN','record','off'),('IXFR','record','off'),('KEY','record','off'),('KX','record','off'),('LOC','record','off'),('MAILB','record','off'),('master','normal','0.0.0.0'),('MINFO','record','off'),('MX','record','on'),('NAPTR','record','off'),('NIMLOC','record','off'),('NS','record','on'),('NSAP','record','off'),('NSAP-PTR','record','off'),('NSEC','record','off'),('NXT','record','off'),('OPT','record','off'),('prins','normal','your.master.ns'),('PTR','record','off'),('PX','record','off'),('range','normal','10'),('RP','record','off'),('RRSIG','record','off'),('RT','record','off'),('secns','normal','your.sec.ns'),('SIG','record','off'),('SINK','record','off'),('SRV','record','on'),('SSHFP','record','off'),('TKEY','record','off'),('TSIG','record','off'),('TXT','record','on'),('WKS','record','off'),('X25','record','off'); | |
95 | 95 | /*!40000 ALTER TABLE `options` ENABLE KEYS */; |
96 | 96 | UNLOCK TABLES; |
97 | 97 | ... | ... |
pgsql.sql
... | ... | @@ -29,7 +29,7 @@ CREATE TABLE "options" ( |
29 | 29 | UNIQUE ("prefkey") |
30 | 30 | ); |
31 | 31 | |
32 | -INSERT INTO "options" VALUES ('A','record','on'),('A6','record','off'),('AAAA','record','off'),('AFSDB','record','off'),('APL','record','off'),('ATMA','record','off'),('AXFR','record','off'),('CERT','record','off'),('CNAME','record','on'),('DNAME','record','off'),('DNSKEY','record','off'),('DS','record','off'),('EID','record','off'),('GPOS','record','off'),('HINFO','record','off'),('hostmaster','normal','postmaster.your.ns'),('ISDN','record','off'),('IXFR','record','off'),('KEY','record','off'),('KX','record','off'),('LOC','record','off'),('MAILB','record','off'),('master','normal','0.0.0.0'),('MINFO','record','off'),('MX','record','on'),('NAPTR','record','off'),('NIMLOC','record','off'),('NS','record','on'),('NSAP','record','off'),('NSAP-PTR','record','off'),('NSEC','record','off'),('NXT','record','off'),('OPT','record','off'),('prins','normal','your.master.ns'),('PTR','record','off'),('PX','record','off'),('range','normal','10'),('RP','record','off'),('RRSIG','record','off'),('RT','record','off'),('secns','normal','your.sec.ns'),('SIG','record','off'),('SINK','record','off'),('SRV','record','on'),('SSHFP','record','off'),('TKEY','record','off'),('TSIG','record','off'),('TXT','record','on'),('WKS','record','off'),('X25','record','off'); | |
32 | +INSERT INTO "options" VALUES ('A','record','on'),('A6','record','off'),('AAAA','record','off'),('AFSDB','record','off'),('APL','record','off'),('ATMA','record','off'),('AXFR','record','off'),('CAA','record','off'),('CERT','record','off'),('CNAME','record','on'),('DNAME','record','off'),('DNSKEY','record','off'),('DS','record','off'),('EID','record','off'),('GPOS','record','off'),('HINFO','record','off'),('hostmaster','normal','postmaster.your.ns'),('ISDN','record','off'),('IXFR','record','off'),('KEY','record','off'),('KX','record','off'),('LOC','record','off'),('MAILB','record','off'),('master','normal','0.0.0.0'),('MINFO','record','off'),('MX','record','on'),('NAPTR','record','off'),('NIMLOC','record','off'),('NS','record','on'),('NSAP','record','off'),('NSAP-PTR','record','off'),('NSEC','record','off'),('NXT','record','off'),('OPT','record','off'),('prins','normal','your.master.ns'),('PTR','record','off'),('PX','record','off'),('range','normal','10'),('RP','record','off'),('RRSIG','record','off'),('RT','record','off'),('secns','normal','your.sec.ns'),('SIG','record','off'),('SINK','record','off'),('SRV','record','on'),('SSHFP','record','off'),('TKEY','record','off'),('TSIG','record','off'),('TXT','record','on'),('WKS','record','off'),('X25','record','off'); | |
33 | 33 | CREATE TABLE "records" ( |
34 | 34 | "id" integer NOT NULL, |
35 | 35 | "zone" integer NOT NULL DEFAULT '0', | ... | ... |