ports/167841: [UPDATE] dns/poweradmin to 2.1.5
Edmondas Girkantas
eg at fbsd.lt
Sun May 13 15:30:03 UTC 2012
>Number: 167841
>Category: ports
>Synopsis: [UPDATE] dns/poweradmin to 2.1.5
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Sun May 13 15:30:02 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Edmondas Girkantas
>Release: FreeBSD 9.0-RELEASE
>Organization:
>Environment:
FreeBSD ports.fbsd.lt 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:15:25 UTC 2012 root at obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
Updated to 2.1.5 with additional patches. This is transitional port, after few weeks I'll submit another update request (latest available is 2.1.6).
I'm not sure where should go upgrading notes, maybe to /usr/ports/UPGRADING:
Upgrading from 2.1.4
Some database changes have been made between version 2.1.4 and 2.1.5, upgrading needs to be done manually by running the following SQL:
For MySQL users:
ALTER TABLE `zones` ADD `zone_templ_id` INT( 11 ) NOT NULL;
ALTER TABLE zones ENGINE = InnoDB;
ALTER TABLE zone_templ ENGINE = InnoDB;
ALTER TABLE zone_templ_records ENGINE = InnoDB;
For PostgreSQL users:
ALTER TABLE zones ADD zone_templ_id INT DEFAULT NULL;
Source:
https://www.poweradmin.org/trac/wiki/ReleaseNotes/2.1.5
>How-To-Repeat:
>Fix:
apply given patch
Patch attached with submission follows:
diff -ruN poweradmin.orig/Makefile poweradmin/Makefile
--- poweradmin.orig/Makefile 2012-05-13 17:01:03.000000000 +0300
+++ poweradmin/Makefile 2012-05-13 17:01:49.000000000 +0300
@@ -6,20 +6,21 @@
#
PORTNAME= poweradmin
-PORTVERSION= 2.1.4
+PORTVERSION= 2.1.5
CATEGORIES= dns www
-MASTER_SITES= https://www.poweradmin.org/download/
+MASTER_SITES= SF/${PORTNAME} \
+ https://www.poweradmin.org/download/
EXTRACT_SUFX= .tgz
MAINTAINER= eg at fbsd.lt
COMMENT= A set of PHP-scripts to manage PowerDNS over the web
-USE_PHP= gettext session
+USE_PHP= gettext session mcrypt
WANT_PHP_WEB= yes
NO_BUILD= yes
PEARDIR= ${PREFIX}/share/pear
-OPTIONS= MYSQL "Use Mysql database support" on \
+OPTIONS= MYSQL "Use Mysql database support" on \
PGSQL "Use Pgsql database support" off
SUB_FILES= pkg-message
diff -ruN poweradmin.orig/distinfo poweradmin/distinfo
--- poweradmin.orig/distinfo 2012-05-13 17:01:03.000000000 +0300
+++ poweradmin/distinfo 2012-05-13 17:01:49.000000000 +0300
@@ -1,2 +1,2 @@
-SHA256 (poweradmin-2.1.4.tgz) = 46a13d4ce34444896ed95d265935fc7605aadc489f81214d545f8ee8a47137a1
-SIZE (poweradmin-2.1.4.tgz) = 121052
+SHA256 (poweradmin-2.1.5.tgz) = fe296a512dc1fe24483ebb4fc63d469e555ac64ae83f6a9ae2e6947cb94aef52
+SIZE (poweradmin-2.1.5.tgz) = 179862
diff -ruN poweradmin.orig/files/patch-add_zone_master.php poweradmin/files/patch-add_zone_master.php
--- poweradmin.orig/files/patch-add_zone_master.php 1970-01-01 02:00:00.000000000 +0200
+++ poweradmin/files/patch-add_zone_master.php 2012-05-13 17:01:49.000000000 +0300
@@ -0,0 +1,39 @@
+--- add_zone_master.php.orig 2011-05-30 12:33:42.399768001 +0300
++++ add_zone_master.php 2011-05-30 12:34:41.423768002 +0300
+@@ -36,7 +36,10 @@
+ if (isset($_POST['domain'])) {
+ $temp = array();
+ foreach ($_POST['domain'] as $domain) {
+- $temp[] = trim($domain);
++ if($domain != "")
++ {
++ $temp[] = trim($domain);
++ }
+ }
+ $domains = $temp;
+ } else {
+@@ -56,6 +59,7 @@
+ (verify_permission('user_view_others')) ? $perm_view_others = "1" : $perm_view_others = "0" ;
+
+ if (isset($_POST['submit']) && $zone_master_add == "1" ) {
++ $error = false;
+ foreach ($domains as $domain) {
+ if (domain_exists($domain)) {
+ error($domain . " failed - " . ERR_DOMAIN_EXISTS);
+@@ -63,7 +67,6 @@
+ $error = true;
+ } elseif (add_domain($domain, $owner, $dom_type, '', $zone_template)) {
+ success("<a href=\"edit.php?id=" . get_zone_id_from_name($domain) . "\">".$domain . " - " . SUC_ZONE_ADD.'</a>');
+- $error = false;
+ }
+ }
+
+@@ -139,7 +142,7 @@
+ echo " <tr>\n";
+ echo " <td class=\"n\"> </td>\n";
+ echo " <td class=\"n\">\n";
+- echo " <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add zone') . "\">\n";
++ echo " <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add zone') . "\" onclick=\"checkDomainFilled();return false;\">\n";
+ echo " </td>\n";
+ echo " <td class=\"n\"> </td>\n";
+ echo " </tr>\n";
diff -ruN poweradmin.orig/files/patch-edit.php poweradmin/files/patch-edit.php
--- poweradmin.orig/files/patch-edit.php 1970-01-01 02:00:00.000000000 +0200
+++ poweradmin/files/patch-edit.php 2012-05-13 17:01:49.000000000 +0300
@@ -0,0 +1,20 @@
+--- edit.php.orig 2011-05-30 13:41:59.411768002 +0300
++++ edit.php 2011-05-30 12:59:05.851768002 +0300
+@@ -51,9 +51,15 @@
+ }
+
+ if (isset($_POST['save_as'])) {
++ if (zone_templ_name_exists($_POST['templ_name'])) {
++ error(ERR_ZONE_TEMPL_EXIST);
++ } elseif ($_POST['templ_name'] == '') {
++ error(ERR_ZONE_TEMPL_IS_EMPTY);
++ } else {
++ success(SUC_ZONE_TEMPL_ADD);
+ $records = get_records_from_domain_id($zone_id);
+- add_zone_templ_save_as($_POST['templ_name'], $_POST['templ_descr'], $_SESSION['userid'], $records);
+-
++ add_zone_templ_save_as($_POST['templ_name'], $_POST['templ_descr'], $_SESSION['userid'], $records, get_zone_name_from_id($zone_id));
++ }
+ }
+
+ /*
diff -ruN poweradmin.orig/files/patch-helper.js poweradmin/files/patch-helper.js
--- poweradmin.orig/files/patch-helper.js 1970-01-01 02:00:00.000000000 +0200
+++ poweradmin/files/patch-helper.js 2012-05-13 17:01:49.000000000 +0300
@@ -0,0 +1,55 @@
+--- inc/helper.js.orig 2011-05-30 12:32:41.799768002 +0300
++++ inc/helper.js 2011-05-30 12:35:03.911768000 +0300
+@@ -47,3 +47,52 @@
+ field_area.innerHTML += "<li><input name='domain[]' id='"+(field+count)+"' type='text' class='input' /> <a onclick=\"this.parentNode.parentNode.removeChild(this.parentNode);\">Remove Field</a></li>";
+ }
+ }
++
++function getDomainsElements(){
++ var
++ coll=document.getElementsByTagName('input'),
++ re=/^domain\[\]$/,
++ t,
++ elm,
++ i=0,
++ key=0,
++ records=new Array();
++
++ while(elm=coll.item(i++))
++ {
++ t=re.exec(elm.name);
++ if(t!=null)
++ {
++ records[key]=elm;
++ key++;
++ }
++ }
++ return records;
++}
++
++function checkDomainFilled(){
++ var
++ domains= new Array(),
++ allEmpty=true,
++ domains=getDomainsElements();
++
++ if (domains.length == 1) {
++ if ((domains[0].value.length == 0 || domains[0].value == null || domains[0].value == "")) {
++ alert('Zone name cannot be empty');
++ return false;
++ }
++ } else {
++ for (key in domains) {
++ if((domains[key].value.length != 0)) {
++ allEmpty = false;
++ }
++ }
++
++ if (true === allEmpty) {
++ alert('Please fill in at least one Zone name');
++ return false;
++ }
++ }
++
++ add_zone_master.submit();
++}
diff -ruN poweradmin.orig/files/patch-poweradmin-mysql-db-structure.sql poweradmin/files/patch-poweradmin-mysql-db-structure.sql
--- poweradmin.orig/files/patch-poweradmin-mysql-db-structure.sql 2012-05-13 17:01:03.000000000 +0300
+++ poweradmin/files/patch-poweradmin-mysql-db-structure.sql 1970-01-01 02:00:00.000000000 +0200
@@ -1,62 +0,0 @@
---- docs/poweradmin-mysql-db-structure.sql.orig 2008-03-27 22:38:03.000000000 +0200
-+++ docs/poweradmin-mysql-db-structure.sql 2010-03-14 17:07:14.000000000 +0200
-@@ -1,4 +1,3 @@
--DROP TABLE IF EXISTS `users`;
- CREATE TABLE `users` (
- `id` int(11) NOT NULL auto_increment,
- `username` varchar(16) NOT NULL default '',
-@@ -15,7 +14,6 @@
- INSERT INTO `users` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3','Administrator','admin at example.net','Administrator with full rights.',1,1);
- UNLOCK TABLES;
-
--DROP TABLE IF EXISTS `perm_items`;
- CREATE TABLE `perm_items` (
- `id` int(11) NOT NULL auto_increment,
- `name` varchar(64) NOT NULL,
-@@ -27,7 +25,6 @@
- INSERT INTO `perm_items` VALUES (41,'zone_master_add','User is allowed to add new master zones.'),(42,'zone_slave_add','User is allowed to add new slave zones.'),(43,'zone_content_view_own','User is allowed to see the content and meta data of zones he owns.'),(44,'zone_content_edit_own','User is allowed to edit the content of zones he owns.'),(45,'zone_meta_edit_own','User is allowed to edit the meta data of zones he owns.'),(46,'zone_content_view_others','User is allowed to see the content and meta data of zones he does not own.'),(47,'zone_content_edit_others','User is allowed to edit the content of zones he does not own.'),(48,'zone_meta_edit_others','User is allowed to edit the meta data of zones he does not own.'),(49,'search','User is allowed to perform searches.'),(50,'supermaster_view','User is allowed to view supermasters.'),(51,'supermaster_add','User is allowed to add new supermasters.'),(52,'supermaster_edit','User is allowed to edit supermasters.'),(53,'user_is_ueberu
ser','User has full access. God-like. Redeemer.'),(54,'user_view_others','User is allowed to see other users and their details.'),(55,'user_add_new','User is allowed to add new users.'),(56,'user_edit_own','User is allowed to edit their own details.'),(57,'user_edit_others','User is allowed to edit other users.'),(58,'user_passwd_edit_others','User is allowed to edit the password of other users.'),(59,'user_edit_templ_perm','User is allowed to change the permission template that is assigned to a us er.'),(60,'templ_perm_add','User is allowed to add new permission templates.'),(61,'templ_perm_edit','User is allowed to edit existing permission templates.');
- UNLOCK TABLES;
-
--DROP TABLE IF EXISTS `perm_templ`;
- CREATE TABLE `perm_templ` (
- `id` int(11) NOT NULL auto_increment,
- `name` varchar(128) NOT NULL,
-@@ -39,7 +36,6 @@
- INSERT INTO `perm_templ` VALUES (1,'Administrator','Administrator template with full rights.');
- UNLOCK TABLES;
-
--DROP TABLE IF EXISTS `perm_templ_items`;
- CREATE TABLE `perm_templ_items` (
- `id` int(11) NOT NULL auto_increment,
- `templ_id` int(11) NOT NULL,
-@@ -51,7 +47,6 @@
- INSERT INTO `perm_templ_items` VALUES (249,1,53);
- UNLOCK TABLES;
-
--DROP TABLE IF EXISTS `zones`;
- CREATE TABLE `zones` (
- `id` int(11) NOT NULL auto_increment,
- `domain_id` int(11) NOT NULL default '0',
-@@ -60,3 +55,22 @@
- PRIMARY KEY (`id`),
- KEY `owner` (`owner`)
- ) ENGINE=MyISAM AUTO_INCREMENT=22001 DEFAULT CHARSET=latin1;
-+
-+CREATE TABLE IF NOT EXISTS `zone_templ` (
-+ `id` int(11) NOT NULL auto_increment,
-+ `name` varchar(128) NOT NULL,
-+ `descr` varchar(1024) NOT NULL,
-+ `owner` int(11) NOT NULL,
-+ PRIMARY KEY (`id`)
-+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
-+
-+CREATE TABLE IF NOT EXISTS `zone_templ_records` (
-+ `id` int(11) NOT NULL auto_increment,
-+ `zone_templ_id` int(11) NOT NULL,
-+ `name` varchar(255) NOT NULL,
-+ `type` varchar(6) NOT NULL,
-+ `content` varchar(255) NOT NULL,
-+ `ttl` int(11) NOT NULL,
-+ `prio` int(11) NOT NULL,
-+ PRIMARY KEY (`id`)
-+) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
diff -ruN poweradmin.orig/files/patch-poweradmin-pqsql-db-structure.sql poweradmin/files/patch-poweradmin-pqsql-db-structure.sql
--- poweradmin.orig/files/patch-poweradmin-pqsql-db-structure.sql 2012-05-13 17:01:03.000000000 +0300
+++ poweradmin/files/patch-poweradmin-pqsql-db-structure.sql 1970-01-01 02:00:00.000000000 +0200
@@ -1,23 +0,0 @@
---- docs/poweradmin-pgsql-db-structure.sql.orig 2010-03-14 17:18:54.000000000 +0200
-+++ docs/poweradmin-pgsql-db-structure.sql 2010-03-14 17:28:38.000000000 +0200
-@@ -63,3 +63,20 @@
- );
-
- CREATE INDEX zone_domain_owner ON zones(domain_id, owner);
-+
-+CREATE TABLE zone_templ (
-+ id SERIAL PRIMARY KEY,
-+ name varchar(128) NOT NULL,
-+ descr text NOT NULL,
-+ owner integer default 0
-+);
-+
-+CREATE TABLE zone_templ_records (
-+ id SERIAL PRIMARY KEY,
-+ zone_templ_id integer NOT NULL,
-+ name varchar(255) NOT NULL,
-+ type varchar(6) NOT NULL,
-+ content varchar(255) NOT NULL,
-+ ttl integer default NULL,
-+ prio integer default NULL
-+);
diff -ruN poweradmin.orig/files/patch-record.inc.php poweradmin/files/patch-record.inc.php
--- poweradmin.orig/files/patch-record.inc.php 1970-01-01 02:00:00.000000000 +0200
+++ poweradmin/files/patch-record.inc.php 2012-05-13 17:01:49.000000000 +0300
@@ -0,0 +1,29 @@
+--- inc/record.inc.php.orig 2010-11-30 10:46:51.416703000 +0200
++++ inc/record.inc.php 2011-05-30 12:38:50.523768002 +0300
+@@ -1276,14 +1276,15 @@
+ }
+
+ if($zone_master_add == "1" || $zone_slave_add == "1") {
++ $domain = get_zone_name_from_id($zone_id);
+ $now = time();
+ $templ_records = get_zone_templ_records($zone_template);
+ foreach ($templ_records as $r) {
+ if ((preg_match('/in-addr.arpa/i', $zone_id) && ($r["type"] == "NS" || $r["type"] == "SOA")) || (!preg_match('/in-addr.arpa/i', $zone_id)))
+ {
+- $name = parse_template_value($r["name"], $zone_id);
++ $name = parse_template_value($r["name"], $domain);
+ $type = $r["type"];
+- $content = parse_template_value($r["content"], $zone_id);
++ $content = parse_template_value($r["content"], $domain);
+ $ttl = $r["ttl"];
+ $prio = intval($r["prio"]);
+
+@@ -1307,7 +1308,7 @@
+
+ $query = "UPDATE zones
+ SET zone_templ_id = " . $db->quote($zone_template, 'integer') . "
+- WHERE id = " . $db->quote($zone_id, 'integer') ;
++ WHERE domain_id = " . $db->quote($zone_id, 'integer') ;
+ $response = $db->exec($query);
+
+ if (PEAR::isError($response)) {
diff -ruN poweradmin.orig/files/patch-templates.inc.php poweradmin/files/patch-templates.inc.php
--- poweradmin.orig/files/patch-templates.inc.php 2012-05-13 17:01:03.000000000 +0300
+++ poweradmin/files/patch-templates.inc.php 2012-05-13 17:01:49.000000000 +0300
@@ -1,11 +1,25 @@
---- inc/templates.inc.php.orig 2010-03-14 16:47:47.000000000 +0200
-+++ inc/templates.inc.php 2010-03-14 16:48:00.000000000 +0200
-@@ -193,7 +193,7 @@
- while($r = $result->fetchRow()) {
- // Call get_record_from_id for each row.
- $ret[$retcount] = get_zone_templ_record_from_id($r["id"]);
-- $retcount;
-+ $retcount++;
- }
- return $ret;
- }
+--- inc/templates.inc.php.orig 2010-12-10 23:26:28.839400000 +0200
++++ inc/templates.inc.php 2011-05-30 12:39:13.319768001 +0300
+@@ -312,7 +312,7 @@
+
+ // Add a zone template from zone / another template.
+
+-function add_zone_templ_save_as($template_name, $description, $userid, $records) {
++function add_zone_templ_save_as($template_name, $description, $userid, $records, $domain = null) {
+ global $db;
+
+ if (!(verify_permission('zone_master_add'))) {
+@@ -339,9 +339,12 @@
+ $content = $db->quote($record['content'], 'text');
+ }
+
++ $name = $domain ? preg_replace('/'.$domain.'/', '[ZONE]',$record['name']) : $record['name'];
++ $content = $domain ? preg_replace('/'.$domain.'/', '[ZONE]',$content) : $content;
++
+ $query2 = "INSERT INTO zone_templ_records (zone_templ_id, name, type, content, ttl, prio) VALUES ("
+ . $db->quote($zone_templ_id, 'integer') . ","
+- . $db->quote($record['name'], 'text') . ","
++ . $db->quote($name, 'text') . ","
+ . $db->quote($record['type'], 'text') . ","
+ . $content . ","
+ . $db->quote($record['ttl'], 'integer') . ","
diff -ruN poweradmin.orig/pkg-descr poweradmin/pkg-descr
--- poweradmin.orig/pkg-descr 2012-05-13 17:01:03.000000000 +0300
+++ poweradmin/pkg-descr 2012-05-13 17:01:49.000000000 +0300
@@ -1,3 +1,6 @@
This project is a web-based front-end for the PowerDNS DNS server.
WWW: http://www.poweradmin.org/
+
+- Edmondas Girkantas
+eg at fbsd.lt
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list