We do our very best to avoid mistakes but something they just creep in
when we were trying to do the 'right thing' (code cleanup).

This is one of these mistakes.

Regression introduced in 3.4.0.

It affects configuration of several critical component through the Web
interface and the CLI. Namely: interface, network, floating-device and
violation management. If configuration is performed via the flat files
things are fine.

We recommend applying the attached patch to production environments who
have upgraded. We plan doing a 3.4.1 release early next week.

Regards,

On 06/15/2012 10:42 AM, Michał Sochoń wrote:
> Yeah, cause I filed it ;)
> Thankfully yum downngrade was succesful.
> 
> On Fri, Jun 15, 2012 at 3:40 PM, Olivier Bilodeau <[email protected]> 
> wrote:
>> On 06/14/2012 02:55 PM, Michał Sochoń wrote:
>>> [root@packetfence pf]# bin/pfcmd interfaceconfig get all
>>> interface|ip|mask|type|enforcement|gateway
>>> eth1||||monitor||
>>> eth0||192.168.1.5|255.255.255.0|management||192.168.1.16
>>> eth0.2||192.168.2.1|255.255.255.0|internal|vlan|192.168.2.1
>>> eth0.3||192.168.3.1|255.255.255.0|internal|vlan|192.168.3.1
>>> eth0.5||192.168.5.1|255.255.255.0|internal|inline|192.168.5.1
>>>
>>>
>>> hm, too many pipes? ;-)
>>
>> This problem is tracked here:
>> http://www.packetfence.org/bugs/view.php?id=1468
>>
>> and will be fixed shortly. Expect a patch soon.
>>
>>>
>>> On Thu, Jun 14, 2012 at 8:08 PM, Michał Sochoń <[email protected]
>>> <mailto:[email protected]>> wrote:
>>>
>>>     Today I did upgrade to 3.4.0
>>>     I have noticed that the admin panel shows improerly data in the
>>>     Configuration > networks tab:
>>>
>>>     http://b.hlds.pl/pf/Screenshot-2012-06-14_20.04.10.png
>>>
>>>     When editing the networks also fields are propagated with above data.
>>>
>>>     Looks like parsing networks.conf is wrong
>>>
>>>     Edited interface to fix it, it returned worng values:
>>>     http://b.hlds.pl/pf/Screenshot-2012-06-14_20.06.36.png
>>>
>>>     So I edited it like this:
>>>     http://b.hlds.pl/pf/Screenshot-2012-06-14_20.00.39.png
>>>
>>>     Unfortunately it results in error:
>>>
>>>     *Error: Problems executing 'PFCMD networkconfig edit 192.168.5.0
>>>     type="inline", named="enabled", dhcpd="enabled",
>>>     netmask="255.255.255.0", gateway="192.168.5.1", next_hop="",
>>>     domainname="inline.hlds", dns="192.168.5.1",
>>>     dhcp_start="192.168.5.50", dhcp_end="192.168.5.150",
>>>     dhcp_default_lease_time="20", dhcp_max_lease_time="20"'*
>>>
>>>     Command not understood. (pfcmd grammar test failed at line 209.)
>>>

-- 
Olivier Bilodeau
[email protected]  ::  +1.514.447.4918 *115  ::  www.inverse.ca
Inverse inc. :: Leaders behind SOGo (www.sogo.nu) and PacketFence
(www.packetfence.org)
#
# Regression in 3.4.0 fixed: consolidation of field_order introduced a problem
# Licensed under the GPLv2
# Olivier Bilodeau <[email protected]>
#
diff --git a/bin/pfcmd b/bin/pfcmd
index 77a4c96..3f9ed37 100755
--- a/bin/pfcmd
+++ b/bin/pfcmd
@@ -469,16 +469,19 @@ sub violationconfig {
 
         my @fields = field_order();
         print join( $delimiter, @fields ) . "\n";
+
+        # Now that we printed all the fields, we skip the key since it's not
+        # under the config section but actually the section itself
+        shift @fields;
+
+        # Loop, filter and display
         foreach my $section ( keys %violations_conf ) {
-            if (   ( $cmd{'command'}[2] eq 'all' )
-                || ( $cmd{'command'}[2] eq $section ) )
-            {
+            if ( $cmd{'command'}[2] eq 'all' || $cmd{'command'}[2] eq $section ) {
+
                 my @values;
                 foreach my $column (@fields) {
                     push @values,
-                        (      $violations_conf{$section}{$column}
-                            || $violations_conf{'defaults'}{$column}
-                            || '' );
+                        ( $violations_conf{$section}{$column} || $violations_conf{'defaults'}{$column} || '' );
                 }
                 print $section . $delimiter . join( $delimiter, @values ) . "\n";
             }
@@ -616,10 +619,14 @@ sub floatingnetworkdeviceconfig {
 
         my @fields = field_order();
         print join( $delimiter, @fields ) . "\n";
+
+        # Now that we printed all the fields, we skip the key since it's not
+        # under the config section but actually the section itself
+        shift @fields;
+
+        # Loop, filter and display
         foreach my $section (@sections) {
-            if (   ( $cmd{'command'}[2] eq 'all' )
-                || ( $cmd{'command'}[2] eq $section ) )
-            {
+            if ( $cmd{'command'}[2] eq 'all' || $cmd{'command'}[2] eq $section ) {
                 my @values;
                 foreach my $column (@fields) {
                     push @values, ( $floatingnetworkdevice_conf{$section}{$column} || '' );
@@ -713,9 +720,14 @@ sub networkconfig {
 
         my @fields = field_order();
         print join( $delimiter, @fields ) . "\n";
+
+        # Now that we printed all the fields, we skip the key since it's not
+        # under the config section but actually the section itself
+        shift @fields;
+
+        # Loop, filter and display
         foreach my $network (@networks) {
-            if (   ( $cmd{'command'}[2] eq 'all' )
-                || ( $cmd{'command'}[2] eq $network ) )
+            if ( $cmd{'command'}[2] eq 'all' || $cmd{'command'}[2] eq $network )
             {
                 my @values;
                 foreach my $column (@fields) {
@@ -839,12 +851,16 @@ sub interfaceconfig {
 
         my @fields = field_order();
         print join( $delimiter, @fields ) . "\n";
+
+        # Now that we printed all the fields, we skip the key since it's not
+        # under the config section but actually the section itself
+        shift @fields;
+
+        # Loop, filter and display
         foreach my $section ( keys %pf_conf ) {
             if ( $section =~ /^interface (.+)$/ ) {
                 my $interface_name = $1;
-                if (   ( $cmd{'command'}[2] eq 'all' )
-                    || ( $cmd{'command'}[2] eq $interface_name ) )
-                {
+                if ( $cmd{'command'}[2] eq 'all' || $cmd{'command'}[2] eq $interface_name ) {
                     my @values;
                     foreach my $column (@fields) {
                         push @values, ( $pf_conf{$section}{$column} || '' );
@@ -960,22 +976,19 @@ sub switchconfig {
         my @fields = field_order();
         print join( $delimiter, @fields ) . "\n";
 
+        # Now that we printed all the fields, we skip the key since it's not
+        # under the config section but actually the section itself
+        shift @fields;
+
+        # Loop, filter and display
         foreach my $section (@sections) {
-            if (   ( $cmd{'command'}[2] eq 'all' )
-                || ( $cmd{'command'}[2] eq $section ) )
-            {
+            if ( $cmd{'command'}[2] eq 'all' || $cmd{'command'}[2] eq $section ) {
                 my @values;
                 foreach my $column (@fields) {
-                    if ( $column eq 'ip' ) {
-                        push @values, $section;
-                    } else {
-                        push @values,
-                            (      $switches_conf{$section}{$column}
-                                || $switches_conf{'default'}{$column}
-                                || '' );
-                    }
+                    push @values,
+                        ( $switches_conf{$section}{$column} || $switches_conf{'default'}{$column} || '' );
                 }
-                print join( $delimiter, @values ) . "\n";
+                print $section . $delimiter . join( $delimiter, @values ) . "\n";
             }
         }
     } elsif ( $mode eq 'delete' ) {
@@ -2391,7 +2404,7 @@ sub field_order {
         if ($command =~ /^$uiconfig{$section}{'command'}/) {
 
             foreach my $val ( split( /\s*,\s*/, $uiconfig{$section}{'display'} ) ) {
-                $val =~ s/-//;
+                $val =~ s/^-//;
                 push @fields, $val;
             }
             last;
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to