[SNMP4J] Issue with default context for SNMPv3

Frank Fock fock at agentpp.com
Thu Jan 9 00:56:47 CET 2014


Hi Mark,

This fix is needed cannot be undone. Nevertheless, you can simply
use "v2" for the v2 context and "v3" (or "") for the v3 (default) context.

This should not be a problem.

Best regards,
Frank


Am 09.01.2014 00:53, schrieb forum at friendlysnmp.org:
> (updated wrong subject)
>
> Frank,
>
> My old versions before upgrade were snmp4j-1.11 and snmp4j-agent-1.4
> My new versions are snmp4j-2.2.3 and snmp4j-agent-2.0.10a
>
> The line numbers for code in question in 
> org.snmp4j.agent.DefaultMOServer class:
> === snmp4j-agent-2.0.10a ===
> 271  public void register(ManagedObject mo, OctetString context)
> 272      throws DuplicateRegistrationException
> 273  {
> 274    if ((context == null) || (context.length() == 0)) {
>
> === snmp4j-agent-1.4 ===
> 282  public void register(ManagedObject mo, OctetString context)
> 283      throws DuplicateRegistrationException
> 284  {
> 285    if (context == null) {
>
> Compare lines #274 and #285 for the above versions.
> With default context (empty string) for the SNMPv3 the additional
> verification in line #274 "(context.length() == 0)" breaks my agent.
>
> It's possible that my BaseAgent implementation has bugs.
> However, it was working with snmp4j-1.11/snmp4j-agent-1.4
> and failed with snmp4j-2.2.3/snmp4j-agent-2.0.10a
>
> The problem appears for registering managed objects for different 
> contexts:
> v2 and default (empty string) v3.
>
> Thanks,
> Mark
>
> On 2013-12-28 04:28, Frank Fock wrote:
>> Hi Mark,
>>
>> You wrote that you upgraded SNMP4J but quoted SNMP4J-Agent
>> code. Have updated SNMP4J-Agent as well? To which version?
>> Why do you think that user (USM user?) contexts are related
>> to the MOServer.register(..) method?
>> (I would claim that they are not related)
>>
>> Best regards,
>> Frank
>>
>>
>> Am 25.12.2013 22:15, schrieb forum at friendlysnmp.org:
>>> Hi,
>>>
>>> I upgraded my working application from SNMP4J v1.11 to v2.2.3...
>>> There were some minor updates required in my code to use generics.
>>>
>>> I discovered a serious problem in my code with SNMP4J v2.2.3:
>>> empty default context for v3 user is not allowed any more
>>> if there is a v2 user defined as well.
>>>
>>> The problem is in a org.snmp4j.agent.DefaultMOServer class.
>>> The method register(ManagedObject mo, OctetString context) in v2.2.3
>>> makes following validation:
>>>    if ((context == null) || (context.length() == 0)) {
>>>    } else ...
>>>
>>> The v1.11 implementation had
>>>    if (context == null) {
>>>    } else ...
>>>
>>> The v2.2.3 validates default v3 empty context as v2 and
>>> throws DuplicateRegistrationException if v2 user is present.
>>> Am I missing something or this is a bug?
>>>
>>> Thanks,
>>> Mark
>>> _______________________________________________
>>> SNMP4J mailing list
>>> SNMP4J at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231




More information about the SNMP4J mailing list