SHA256
1
0
forked from pool/dhcp
dhcp/0022-dhcp-4.2.x-contrib-conf-to-ldap-reorder.886094.patch

251 lines
6.1 KiB
Diff
Raw Normal View History

- Applied contrib/ldap/dhcpd-conf-to-ldap patch by Ales Novak to reorder config to add all global options or option declarations to the dhcpService object instead to create new service object (bsc#886094,ISC-Bugs#37876). [+ dhcp-4.2.x-contrib-conf-to-ldap-reorder.886094.patch] - Applied an upstream patch by Thomas Markwalder adding missed mapping of SHA TSIG algorithm names to their constants to enable hmac-sha1, hmac_sha224, hmac_sha256, hmac_sha384 and hmac_sha512 authenticated dynamic DNS updates (bsc#890731, ISC-Bugs#36947). [+ dhcp-4.2.x-ddns-tsig-hmac-sha-support.890731.patch] - Decline IPv6 addresses on Duplicate Address Detection failure and stop client message exchanges on reached MRD rather than at some point after it. Applied fedora patches by Jiri Popelka and added DAD reporting via exit 3 to the dhclient-script and a fix to use correct address variables in the DEPREF6 action (bsc#872609,ISC-Bugs#26735,ISC-Bugs#21238). [+ dhcp-4.2.x-dhcpv6-decline-on-DAD-failure.872609.patch, + dhcp-4.2.x-dhcpv6-retransmission-until-MRD.872609.patch] - Applied backport patch by William Preston avoiding to bind ddns socket in the server when ddns-update-style is none (bsc#891655). [+ dhcp-4.2.x-disable-unused-ddns-port-in-server.891655.patch] - Applied patch for the contrib/ldap/dhcpd-conf-to-ldap script fixing subclass statement handling (bnc#878846,[ISC-Bugs #36409]) [+ dhcp-4.2.4-P2-bnc878846-conf-to-ldap.patch] - Updated licence statement and FSF address in our scripts. - Added missed service_add_pre macro calls for dhcrelay services OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=141
2014-11-21 12:33:30 +01:00
Author: Ales Novak <alnovak@suse.com>
Subject: reorder config entries for ldap tree
References: bsc#886094, ISC-Bugs#37876
Upstream: sent
Reorder config to add all global options or option declarations
to the dhcpService object instead to create new service object,
e.g.:
option opt-one code 1 = text;
class "class-one" {
option opt-one "...";
};
option opt-two code 2 = text;
class "class-two" {
option opt-two "...";
};
has to contain both options (declarations) in the dhcpService,
followed by other objects as the dhcpClass objects under the
service in the ldap tree.
--- dhcp-4.2.4-P2/contrib/ldap/dhcpd-conf-to-ldap
+++ dhcp-4.2.4-P2/contrib/ldap/dhcpd-conf-to-ldap
@@ -137,6 +137,7 @@ add_dn_to_stack
local ($dn) = @_;
$current_dn = "$dn, $current_dn";
+ $curentry{'current_dn'} = $current_dn;
}
@@ -154,6 +155,26 @@ parse_error
exit (1);
}
+sub
+new_entry
+{
+ if (%curentry) {
+ $curentry{'current_dn'} = $current_dn;
+ push(@entrystack, {%curentry});
+ undef(%curentry);
+ }
+}
+
+sub
+pop_entry
+{
+ if (%curentry) {
+ push(@outputlist, {%curentry});
+ }
+ $rentry = pop(@entrystack);
+ %curentry = %$rentry if $rentry;
+}
+
sub
print_entry
@@ -167,7 +188,7 @@ print_entry
print "cn: $server\n";
print "objectClass: top\n";
print "objectClass: dhcpServer\n";
- print "dhcpServiceDN: $current_dn\n";
+ print "dhcpServiceDN: $curentry{'current_dn'}\n";
if(grep(/FaIlOvEr/i, @use))
{
foreach my $fo_peer (keys %failover)
@@ -179,7 +200,7 @@ print_entry
}
print "\n";
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: $dhcpcn\n";
print "objectClass: top\n";
print "objectClass: dhcpService\n";
@@ -195,7 +216,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'subnet')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'ip'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpSubnet\n";
@@ -215,7 +236,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'shared-network')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'descr'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpSharedNetwork\n";
@@ -226,7 +247,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'group')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: group", $curentry{'idx'}, "\n";
print "objectClass: top\n";
print "objectClass: dhcpGroup\n";
@@ -237,7 +258,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'host')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'host'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpHost\n";
@@ -254,7 +275,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'pool')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: pool", $curentry{'idx'}, "\n";
print "objectClass: top\n";
print "objectClass: dhcpPool\n";
@@ -273,7 +294,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'class')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'class'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpClass\n";
@@ -284,7 +305,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'subclass')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'subclass'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpSubClass\n";
@@ -344,7 +365,7 @@ sub parse_subnet
{
local ($ip, $tmp, $netmask);
- print_entry () if %curentry;
+ new_entry ();
$ip = next_token (0);
parse_error () if !defined ($ip);
@@ -374,7 +395,7 @@ sub parse_shared_network
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$descr = next_token (0);
parse_error () if !defined ($descr);
@@ -393,7 +414,7 @@ sub parse_host
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$host = next_token (0);
parse_error () if !defined ($host);
@@ -412,7 +433,7 @@ sub parse_group
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$tmp = next_token (0);
parse_error () if !defined ($tmp);
@@ -435,7 +456,7 @@ sub parse_pool
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$tmp = next_token (0);
parse_error () if !defined ($tmp);
@@ -458,7 +479,7 @@ sub parse_class
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$class = next_token (0);
parse_error () if !defined ($class);
@@ -478,7 +499,7 @@ sub parse_subclass
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$class = next_token (0);
parse_error () if !defined ($class);
@@ -500,7 +521,7 @@ sub parse_subclass
$curentry{'subclass'} = $subclass;
if ($tmp eq ';') {
- print_entry () if %curentry;
+ pop_entry ();
remove_dn_from_stack ();
}
}
@@ -691,11 +712,11 @@ print STDERR "\n";
my $token;
my $token_number = 0;
my $line_number = 0;
-my %curentry;
my $cursubnet = '';
my %curcounter = ( '' => { pool => 0, group => 0 } );
$current_dn = "$dhcpdn";
+$curentry{'current_dn'} = $current_dn;
$curentry{'descr'} = $dhcpcn;
$line = '';
%failover = ();
@@ -704,7 +725,7 @@ while (($token = next_token (1)))
{
if ($token eq '}')
{
- print_entry () if %curentry;
+ pop_entry ();
if($current_dn =~ /.+?,\s*${dhcpdn}$/) {
# don't go below dhcpdn ...
remove_dn_from_stack ();
@@ -762,6 +783,16 @@ while (($token = next_token (1)))
}
}
+pop_entry ();
+
+while ($#outputlist >= 0) {
+ $rentry = pop(@outputlist);
+ if ($rentry) {
+ %curentry = %$rentry;
+ print_entry ();
+ }
+}
+
close(STDIN) if($i_conf);
close(STDOUT) if($o_ldif);