]> git.pld-linux.org Git - packages/MigrationTools.git/blob - MigrationTools-distinguish_identically_named_services.patch
- drop obsolete and outdated manual inclusion of rpm macros
[packages/MigrationTools.git] / MigrationTools-distinguish_identically_named_services.patch
1 diff -ruN migrationtools-47.orig/migrate_services.pl migrationtools-47/migrate_services.pl
2 --- migrationtools-47.orig/migrate_services.pl  2006-01-25 05:18:16.000000000 +0100
3 +++ migrationtools-47/migrate_services.pl       2007-04-02 04:52:00.000000000 +0200
4 @@ -155,6 +155,8 @@
5         my $Rh_services = shift;
6         my $Rh_portmap = shift;
7  
8 +       my %protomap = ();
9 +
10         foreach $port (sort {$a <=> $b} (keys %{$Rh_services})) {
11                 foreach $servicename (keys %{$Rh_services->{$port}}) {
12                         my @protocols = (keys %{$Rh_services->{$port}{$servicename}});
13 @@ -180,13 +182,24 @@
14                                         $suffix = "+ipServicePort=" . &escape_metacharacters($port);
15                                 }
16  
17 -                               # Normalize aliases across protocols. Yet
18 -                               # another uncomfortable compromise.
19 -                               foreach (keys %{$Rh_services->{$port}{$servicename}{$proto}{'aliases'}}) {
20 -                                       $tmpaliases{$_} = 1;
21 +                               # Normalize aliases across protocols, and
22 +                               # strip those differing only in case.
23 +                               # Other uncomfortable compromises.
24 +                               foreach $alias (keys %{$Rh_services->{$port}{$servicename}{$proto}{'aliases'}}) {
25 +                                       next if (grep (/^$alias$/i, keys %tmpaliases));
26 +                                       $tmpaliases{$alias} = 1;
27                                 }
28                         }
29  
30 +                       # Distinguish different but identically named services
31 +                       # Example: echo on tcp/udp port 7 and on ddp port 4
32 +                       # TODO: Add suffix to oddest protocols (not just highest ports)
33 +                       my $protocols = join('+', sort (@protocols));
34 +                       $protomap{$servicename}{$protocols} = 1;
35 +                       if (scalar(keys %{$protomap{$servicename}}) > 1) {
36 +                               $suffix .= join('+ipServiceProtocol=', map { &escape_metacharacters($_) } ('', @protocols));
37 +                       }
38 +
39                         my @aliases = keys(%tmpaliases);
40                         
41                         # Finally we build LDIF records for services.
This page took 0.087115 seconds and 3 git commands to generate.