rpms/bind/FC-4 bind-9.3.1-dbus_archdep_libdir_sdb.patch, NONE, 1.1 filter_requires.sh, NONE, 1.1 namedGetForwarders, NONE, 1.1 namedSetForwarders, NONE, 1.1 bind-9.3.1-dbus_archdep_libdir.patch, 1.1, 1.2 bind.spec, 1.67, 1.68 named.init, 1.34, 1.35

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Mar 7 21:48:21 UTC 2006


Author: jvdias

Update of /cvs/dist/rpms/bind/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv11150

Modified Files:
	bind-9.3.1-dbus_archdep_libdir.patch bind.spec named.init 
Added Files:
	bind-9.3.1-dbus_archdep_libdir_sdb.patch filter_requires.sh 
	namedGetForwarders namedSetForwarders 
Log Message:
- fix bug 181730: fix creation of named user & gid
- fix bug 179816: fix builds for all combinations of WITH_DBUS=0/1 SDB=0/1 LIBBIND=0/1                  
- fix bug 177595: handle case where $ROOTDIR is a link in initscript 
- improve method used to mount /proc and /var/run/dbus under chroot in initscript 
- add namedGetForwarders and namedSetForwarders scripts for use with -D option


bind-9.3.1-dbus_archdep_libdir_sdb.patch:
 Makefile.in |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

--- NEW FILE bind-9.3.1-dbus_archdep_libdir_sdb.patch ---
--- bind-9.3.1/bin/named_sdb/Makefile.in.dbus_archdep_libdir	2005-08-16 21:23:28.000000000 -0400
+++ bind-9.3.1/bin/named_sdb/Makefile.in	2005-08-16 23:00:49.000000000 -0400
@@ -35,8 +35,9 @@
 		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
 		${DBDRIVER_INCLUDES}
+DBUS_ARCHDEP_LIBDIR ?= lib
 DBUS_INCLUDES = \
-	-I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
+	-I/usr/${DBUS_ARCHDEP_LIBDIR}/dbus-1.0/include -I/usr/include/dbus-1.0
 CDEFINES =
 CWARNINGS =
 


--- NEW FILE filter_requires.sh ---
#!/bin/bash
/usr/lib/rpm/find-requires $* | /bin/egrep -v perl


--- NEW FILE namedGetForwarders ---
#!/usr/bin/perl
#  
#  This script uses the named D-BUS support, which must be enabled in
#  the running named with the named '-D' option, to get and print the
#  list of forwarding zones in the running server.
#
#  It accepts an optional <zone> first argument which is the DNS name
#  of the zone whose forwarders (if any) will be retrieved.
#
#  If no zone argument is specified, all forwarding zones will be listed.
#
#  Usage: GetForwarders [-n -r] [ <zone> ]
#    -n : output forward zone statements for named.conf
#    -r : output in resolv.conf format
#       : no -r or -n: just list the forwarders
#
#  Copyright(C) Jason Vas Dias<jvdias at redhat.com> Red Hat Inc. 2005
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation at
#           http://www.fsf.org/licensing/licenses/gpl.txt
#  and included in this software distribution as the "LICENSE" file.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
use Getopt::Std;

%opts=();

getopts("rn",\%opts);

$zone = '';
if ( $#ARGV >= 0 )
{
    $zone = "string:'". join("' string:'", at ARGV)."'";
};

@dn=(); 

open(DNS,
     '/usr/bin/dbus-send --system --type=method_call --print-reply --reply-timeout=20000 '
    .'--dest=com.redhat.named /com/redhat/named com.redhat.named.text.GetForwarders '
    .$zone .'|'
    ) || die("dbus-send failed: $?: $!");

while(<DNS>)
{ 
    $_=~s/[\s\r\n]+$//;
    if ( /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ )
    { # nameserver address
	push @{${$dn[-1]}{'s'}}, { 'a' => "$1.$2.$3.$4" }; 
    }elsif
       ( /\"(\d+)\"$/ )      
    { # port
	if ( $1 != 53 )
	{
	    ${@{${$dn[-1]}{'s'}}[-1]}{'p'} = $1;
	};
    }elsif
       ( /string\s+\"([^\"]+)\"$/ )
    { 
	if ( ($1 eq 'first') || ($1 eq 'only') )
	{ # policy
	    if( $1 eq 'only' )
	    { # not default
		${$dn[-1]}{'o'} = 1;
	    }
	}else
	{ # new DN - "zone"
	    push @dn, {'n'=>$1,'s'=>[]}; 
	};
    }; 
};
close(DNS);

if( exists($opts{'r'}) )
{ # resolv.conf style:
    my %svrs=();
    print 'search ', 
          join( ' ', 
		grep { !( $_ =~ /\.in-addr\.arpa$/) }
		map  { ${$_}{'n'} }
		@dn
	      ),"\n",
          'nameserver ',
	  join( "\nnameserver ",
		grep { exists ( $svrs{ $_ } ) ? undef : { $svrs{$_}=$_ } } 
		map  { ${$_}{'a'} }
		map  { @{${$_}{'s'}} } @dn			     
	      ),"\n";
}elsif( exists($opts{'n'}) )
{ # named.conf style:
    foreach $d (@dn)
    {
	print 'zone "',${$d}{'n'},'." IN { type forward; forwarders { ',
	      join("; ",
		   map { exists( ${$_}{'p'} ) 
			 ? ${$_}{'a'} . ' port ' . ${$_}{'p'}  
			 : ${$_}{'a'}
		       } @{${$d}{'s'}}
		  ),
	      '; }; ',
	      exists(${$d}{'o'}) ? ' forward only; ' : '',
              "};\n";
    };
}else
{ # just list:
    foreach $d (@dn)
    {
	print  ${$d}{'n'}, "\n\t", 
	       (exists(${$d}{'o'}) ? "forward only\n\t" : ''),
	       join( "\n\t",	
		     map { exists( ${$_}{'p'} )
			   ? ${$_}{'a'} . ':' . ${$_}{'p'} 
			   : ${$_}{'a'}
		         } @{${$d}{'s'}}
		   ),"\n";
    };
};


--- NEW FILE namedSetForwarders ---
#!/bin/bash
#
#  This script uses the named D-BUS support, which must be enabled in
#  the running named with the named '-D' option, to set the forwarding zones
#  in the running server.
#  
#  One zone argument is required, followed by any number of server IP (v4 or v6)
#  addresses. If the server IP address list is empty, any forwarders for the zone
#  will be removed.
#
#  Usage:
#        SetForwarders [ -t <'first' | 'only'> ] <zone> [ <server IP> [...<server IP>] ] 
#
#  Copyright(C) Jason Vas Dias<jvdias at redhat.com> Red Hat Inc. 2005
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation at 
#           http://www.fsf.org/licensing/licenses/gpl.txt
#  and included in this software distribution as the "LICENSE" file.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
usage() { echo "Usage: SetForwarders [ -t <'first' | 'only'> ] <zone> [ <server> [...<server>] ]"; }
type=''
if [ $# -eq 0 ]; then
   usage;
   exit 1;
elif [ "$1" = "-t" ]; then
   if [ $# -lt 2 ]; then
      echo '-t option requires an argument.'
      exit 1;
   fi;
   type=$2;
   shift 2;
fi;
if [ $# -lt 1 ]; then
   echo '<zone> first argument required.'
   exit 1;
fi; 
zone='string:'"$1";
shift;
servers='';
if [ $# -gt 0 ]; then
  for svr in $*; do
    servers="$servers string:$svr";
  done
fi;
dbus-send --system --type=method_call --print-reply --reply-timeout=20000 --dest=com.redhat.named /com/redhat/named com.redhat.named.text.SetForwarders $zone $type $servers;

bind-9.3.1-dbus_archdep_libdir.patch:
 Makefile.in |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

Index: bind-9.3.1-dbus_archdep_libdir.patch
===================================================================
RCS file: /cvs/dist/rpms/bind/FC-4/bind-9.3.1-dbus_archdep_libdir.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- bind-9.3.1-dbus_archdep_libdir.patch	22 Aug 2005 20:25:52 -0000	1.1
+++ bind-9.3.1-dbus_archdep_libdir.patch	7 Mar 2006 21:48:18 -0000	1.2
@@ -1,16 +1,3 @@
---- bind-9.3.1/bin/named_sdb/Makefile.in.dbus_archdep_libdir	2005-08-16 21:23:28.000000000 -0400
-+++ bind-9.3.1/bin/named_sdb/Makefile.in	2005-08-16 23:00:49.000000000 -0400
-@@ -35,8 +35,9 @@
- 		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
- 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
- 		${DBDRIVER_INCLUDES}
-+DBUS_ARCHDEP_LIBDIR ?= lib
- DBUS_INCLUDES = \
--	-I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
-+	-I/usr/${DBUS_ARCHDEP_LIBDIR}/dbus-1.0/include -I/usr/include/dbus-1.0
- CDEFINES =
- CWARNINGS =
- 
 --- bind-9.3.1/bin/named/Makefile.in.dbus_archdep_libdir	2005-08-16 21:23:28.000000000 -0400
 +++ bind-9.3.1/bin/named/Makefile.in	2005-08-16 23:00:58.000000000 -0400
 @@ -35,8 +35,9 @@


Index: bind.spec
===================================================================
RCS file: /cvs/dist/rpms/bind/FC-4/bind.spec,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- bind.spec	19 Oct 2005 21:55:24 -0000	1.67
+++ bind.spec	7 Mar 2006 21:48:18 -0000	1.68
@@ -9,7 +9,7 @@
 Name: bind
 License: BSD-like
 Version: 9.3.1
-Release: 14_FC4
+Release: 16_FC4
 Epoch:   24
 Url: http://www.isc.org/products/BIND/
 Buildroot: %{_tmppath}/%{name}-root
@@ -29,6 +29,9 @@
 Source10: named-dbus.conf
 Source11: named.service
 Source12: README.sdb_pgsql
+Source13: namedSetForwarders
+Source14: namedGetForwarders
+Source15: filter_requires.sh
 # http://www.venaas.no/ldap/bind-sdb/dnszone-schema.txt
 Patch: bind-9.2.0rc3-varrun.patch
 Patch1: bind-9.2.1-key.patch
@@ -56,6 +59,7 @@
 Patch23: bind-9.3.1-dbus_archdep_libdir.patch
 Patch24: bind-9.3.1-t_no_default_lookups.patch
 Patch25: bind-9.3.1-fix_dbus.patch
+Patch26: bind-9.3.1-dbus_archdep_libdir_sdb.patch
 Requires(pre,preun): shadow-utils
 Requires(post,preun): chkconfig
 Requires(post): textutils, fileutils, sed, grep
@@ -75,6 +79,11 @@
 BuildRequires: openssl-devel gcc glibc-devel >= 2.2.5-26 glibc-kernheaders >= 2.4-7.10 libtool pkgconfig tar
 %endif
 %endif
+# do not Require: perl just for namedGetForwarders ! 
+%define __perl_requires %SOURCE15
+%define __find_requires %SOURCE15
+%define _use_internal_dependency_generator 0
+#
 
 %description
 BIND (Berkeley Internet Name Domain) is an implementation of the DNS
@@ -210,21 +219,22 @@
 %endif
 %if %{SDB}
 %patch17 -p1 -b .fix_sdb_ldap
+%patch21 -p1 -b .fix_sdb_pgsql
 %endif
 %patch18 -p1 -b .reject_resolv_conf_errors
 %patch19 -p1 -b .next_server_on_referral
 %patch20 -p1 -b .no_servfail_stops
-%patch21 -p1 -b .fix_sdb_pgsql
 %if %{WITH_DBUS}
+%patch25 -p1 -b .fix_dbus
 %if %{SDB}
 cp -fp bin/named/{dbus_mgr.c,dbus_service.c,log.c,server.c} bin/named_sdb
 cp -fp bin/named/include/named/{dbus_mgr.h,dbus_service.h,globals.h,server.h,log.h,types.h} bin/named_sdb/include/named
 %patch22 -p1 -b .sdb_dbus
+%patch26 -p1 -b .dbus_archdep_libdir_sdb
 %endif
 %patch23 -p1 -b .dbus_archdep_libdir
 %endif
 %patch24 -p1 -b .-t_no_default_lookups
-%patch25 -p1 -b .fix_dbus
 
 %build
 libtoolize --copy --force; aclocal; autoconf
@@ -316,6 +326,9 @@
 cp -fp %{SOURCE10} $RPM_BUILD_ROOT/etc/dbus-1/system.d/named.conf
 cp -fp %{SOURCE11} $RPM_BUILD_ROOT/usr/share/dbus-1/services/named.service
 %endif
+cp -fp %{SOURCE13} $RPM_BUILD_ROOT/%{_sbindir}/namedSetForwarders
+cp -fp %{SOURCE14} $RPM_BUILD_ROOT/%{_sbindir}/namedGetForwarders
+chmod 754 $RPM_BUILD_ROOT/%{_sbindir}/named{Set,Get}Forwarders 
 %if %{test}
 if [ "`whoami`" = 'root' ]; then
    set -e
@@ -347,9 +360,21 @@
 :;
 
 %pre
-/usr/sbin/groupadd -g 25 named >/dev/null 2>&1 || :;
-/usr/sbin/useradd -c "Named" -u 25 -g named \
-	-s /sbin/nologin -r -d /var/named named >/dev/null 2>&1 || :;
+if [ "$1" -eq 1 ]; then
+   # create named group IFF it does not already exist 
+   # - use any free ID between 1 and 499 if group 25 exists:
+   /usr/sbin/groupadd -g 25 -f -r named >/dev/null 2>&1 || :;
+   # if named user does not already exist, create it as system user:
+   if ! /usr/bin/id -u named > /dev/null 2>&1; then
+      if ! /bin/egrep -q '^[^:]+:[^:]+:25:' /etc/passwd >/dev/null 2>&1 ; then
+         /usr/sbin/useradd -u 25 -r -n -M -g named -s /sbin/nologin -d /var/named -c Named named >/dev/null 2>&1 || :;
+      else
+         # use any free ID between 1 and 499:
+         /usr/sbin/useradd -r -n -M -g named -s /sbin/nologin -d /var/named -c Named named >/dev/null 2>&1 || :;
+      fi;
+   fi;
+fi;
+:;
 
 %post
 if [ "$1" -eq 1 ]; then
@@ -469,6 +494,8 @@
 %{_sbindir}/named-check*
 %{_sbindir}/rndc*
 %{_sbindir}/dns-keygen
+%{_sbindir}/namedSetForwarders
+%{_sbindir}/namedGetForwarders
 
 %{_mandir}/man5/named.conf.5*
 %{_mandir}/man5/rndc.conf.5*
@@ -677,12 +704,17 @@
 [ ! -e "%{prefix}/dev/random" ] && mknod "%{prefix}/dev/random" c 1 8
 [ ! -e "%{prefix}/dev/zero" ] && mknod "%{prefix}/dev/zero" c 1 5
 [ ! -e "%{prefix}/dev/null" ] && mknod "%{prefix}/dev/null" c 1 3
-chmod a+r "%{prefix}/dev/random" "%{prefix}/dev/null" "%{prefix}/dev/" 
+chmod 666 %{prefix}/dev/{null,random,zero}
+if [ -d /selinux ] && [ -x /usr/bin/chcon ]; then
+   for dev in null random zero; do
+      /usr/bin/chcon --reference=/dev/$dev %{prefix}/dev/$dev >/dev/null 2>&1 || :;
+   done;
+fi;
 chown root:named "%{prefix}/var/named"
 chown named:named "%{prefix}/var/named/slaves"
 chown named:named "%{prefix}/var/named/data"
 /etc/init.d/named condrestart >/dev/null 2>&1 || :;
-[ -d /selinux ] && [ -x /sbin/restorecon ] && /sbin/restorecon -R %{prefix} >/dev/null 2>&1
+[ -d /selinux ] && [ -x /sbin/restorecon ] && /sbin/restorecon -R %{prefix} -e %{prefix}/proc -e %{prefix}/dev -e %{prefix}/var/run >/dev/null 2>&1
 :;
 
 %preun chroot
@@ -718,7 +750,14 @@
 :;
 
 %changelog
-* Wed Oct 19 2005 Jason Vas Dias <jvdias at redhat.com> - 24.9.3.1-14
+* Tue Mar 07 2006 Jason Vas Dias <jvdias at redhat.com> - 24:9.3.1-16
+- fix bug 181730: fix creation of named user & gid
+- fix bug 179816: fix builds for all combinations of WITH_DBUS=0/1 SDB=0/1 LIBBIND=0/1                  
+- fix bug 177595: handle case where $ROOTDIR is a link in initscript 
+- improve method used to mount /proc and /var/run/dbus under chroot in initscript 
+- add namedGetForwarders and namedSetForwarders scripts for use with -D option
+
+* Wed Oct 19 2005 Jason Vas Dias <jvdias at redhat.com> - 24:9.3.1-14
 - Allow the -D enable D-BUS option to be used within bind-chroot .
 - fix bug 171178: supply some documentation for pgsql SDB .
 


Index: named.init
===================================================================
RCS file: /cvs/dist/rpms/bind/FC-4/named.init,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- named.init	19 Oct 2005 21:50:33 -0000	1.34
+++ named.init	7 Mar 2006 21:48:18 -0000	1.35
@@ -19,7 +19,13 @@
 
 [ -r /etc/sysconfig/named ] && . /etc/sysconfig/named
 
-[ -n "$ROOTDIR" ] && ROOTDIR=`echo $ROOTDIR | sed 's#//*#/#g;s#/$##'`
+if [ -n "$ROOTDIR" ]; then
+   ROOTDIR=`echo $ROOTDIR | sed 's#//*#/#g;s#/$##'`;
+   rdl=`/usr/bin/readlink $ROOTDIR`;
+   if [ -n "$rdl" ]; then
+      ROOTDIR="$rdl";
+   fi;
+fi
 
 RETVAL=0
 named='named'
@@ -64,17 +70,24 @@
 		if [ ! -d ${ROOTDIR}/proc ]; then
 		    mkdir -p ${ROOTDIR}/proc
 		fi
-		if ! egrep -q "/proc ${ROOTDIR}/proc" /proc/mounts; then
+		if ! egrep -q '^/proc[[:space:]]+'${ROOTDIR}'/proc' /proc/mounts; then
 		    mount --bind /proc ${ROOTDIR}/proc >/dev/null 2>&1 
 		fi
-		if echo "$OPTIONS" | egrep -q '(\<|['"'"'"\ ])-D(\>|['"'"'"\ ])'; then
-		    if ! /bin/mount | egrep -q "^/var/run/dbus/system_bus_socket on ${ROOTDIR}/var/run/dbus/system_bus_socket"; then
+		dbus=0;
+		for a in $OPTIONS; do
+		    if [ $a  = "-D" ]; then
+			dbus=1;
+	            fi;
+	        done
+		if [ $dbus -eq 1 ]; then
+		    if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${ROOTDIR}'/var/run/dbus' /proc/mounts; then
 			mkdir -p ${ROOTDIR}/var/run/dbus
-			touch ${ROOTDIR}/var/run/dbus/system_bus_socket;
-			mount --bind /var/run/dbus/system_bus_socket ${ROOTDIR}/var/run/dbus/system_bus_socket > /dev/null 2>&1;
+			if [ ! -d  /var/run/dbus ] ; then
+			    mkdir -p /var/run/dbus ;
+			fi;
+			mount --bind /var/run/dbus ${ROOTDIR}/var/run/dbus > /dev/null 2>&1;
 		    fi;		    
-		fi;
-		
+		fi;		
 	fi
 	no_write_master_zones=0
 	if [ -e /etc/selinux/config ]; then




More information about the fedora-cvs-commits mailing list