PacketFence
Bug Tracking System

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000897PacketFenceerror-handlingpublic2010-01-22 09:542015-02-13 15:35
Reporterobilodeau 
Assigned To 
PrioritynormalSeverityminorReproducibilitysometimes
StatusclosedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000897: improved SNMP validation
DescriptionThere are a lot of places in the code with stuff like that:

    return (
            defined($result)
            && exists( $result->{"$OID_vmVlan.$ifIndex"})
            && ( $result->{"$OID_vmVlan.$ifIndex"} ne 'noSuchInstance' )
           )

We should do validation of these type of cases. Since validation will be similar, I think we would need an error wrapper in SNMP.pm and use that to validate SNMP's answers. Logger would then need to complain about the caller to the error handler and not the error wrapper itself (to know what sub in what module exactly caused the problem). I know this is doable in log4perl.
TagsNo tags attached.
fixed in git revision
fixed in mtn revision
Attached Files

- Relationships

-  Notes
(0001465)
obilodeau (reporter)
2010-02-09 11:42

Just did one isolated case that I could test. I added noSuchObject to the below test in isLearntTrapsEnabled sub:

    return (
        exists( $result->{"$OID_cmnMacAddrLearntEnable.$ifIndex"} )
            && ( $result->{"$OID_cmnMacAddrLearntEnable.$ifIndex"} ne 'noSuchInstance' )
            && ( $result->{"$OID_cmnMacAddrLearntEnable.$ifIndex"} ne 'noSuchObject' )
            && ( $result->{"$OID_cmnMacAddrLearntEnable.$ifIndex"} == 1 )
    );

committed in branch 1.9 with revno: 951bcc89a66e3caf1e7d0381ed62912111bb69d4
(0001948)
obilodeau (reporter)
2011-03-18 10:26

here's a good way to do it

    # if $result is defined, it works we can return $TRUE
    return $TRUE if (defined($result));

    # otherwise report failure
    $logger->warn("setting VLAN failed with " . $this->{_sessionWrite}->error());
    return;
}
(0003760)
lmunro (administrator)
2015-02-13 15:35

No longer relevant.

- Issue History
Date Modified Username Field Change
2010-01-22 09:54 obilodeau New Issue
2010-01-22 09:55 obilodeau Status new => assigned
2010-01-22 09:55 obilodeau Assigned To => obilodeau
2010-02-09 11:42 obilodeau Note Added: 0001465
2010-04-15 17:43 obilodeau Project PacketFence 1.9 => PacketFence
2011-01-18 11:43 obilodeau Target Version => trunk
2011-03-18 10:26 obilodeau Note Added: 0001948
2012-10-19 14:29 fgaudreault Assigned To obilodeau =>
2012-10-19 14:29 fgaudreault Target Version devel => general
2015-02-13 15:35 lmunro Note Added: 0003760
2015-02-13 15:35 lmunro Status assigned => closed


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker