how does CommandResponderEvent getSecurityName() work?

Hi Frank,

I’ve got a question regarding to getSecurityName() of CommandResponderEvent class.

Scenario is:
I set a community & security name with addSnmpCommunityEntry() of SnmpCommunityMIB.
e.g. community is ‘comm-1’ and security name is ‘secName’.

I print log info in CommandProcessor -> processRequest() with ‘command.getSecurityName()’.

@Override
 protected void processRequest(CommandResponderEvent command, CoexistenceInfo cinfo, RequestHandler<SnmpRequest> handler) {
    LOGGER.info("SecurityName " + OctetString.fromByteArray(command.getSecurityName())
                                            + " SecurityModel " + command.getSecurityModel());

When I execute ‘snmpget -c comm-1 -v 2c 127.0.0.1 1.3.6.1.2.1.2.2.1.5.1’, I found the printed log info for ‘command.getSecurityName()’ is the community string ‘comm-1’, not the security name ‘secName’.

The ‘-c’ in net-snmp usage is for setting community string.

My expectation is ‘command.getSecurityName()’ could return the real security name ‘secName’ that corresponding to community string ‘comm-1’ in the snmpget command.

Would you please help to check, if this is my misunderstanding or any bug behind this behavior?
Very appreciated.

[vcapuser@localhost ~]$ snmpget
No hostname specified.
USAGE: snmpget [OPTIONS] AGENT OID [OID]...

  Version:  5.7.2
  Web:      http://www.net-snmp.org/
  Email:    net-snmp-coders@lists.sourceforge.net

OPTIONS:
  -h, --help            display this help message
  -H                    display configuration file directives understood
  -v 1|2c|3             specifies SNMP version to use
  -V, --version         display package version number
SNMP Version 1 or 2c specific
  -c COMMUNITY          set the community string

In the command object the raw message information is hold. That means, if the PDU is a ScopedPDU, then command.getSecurityName() will return the SNMPv3 security name. In any other (currently implemented case), it will contain the SNMPv1 or v2c community.
If you are interested in the finally mapped security name for the SNMPv3 VACM, then use the security name from the provided CoexistenceInfo parameter cinfo:

OctetString vacmSecurityName = cinfo.getSecurityName();