Hi.

I want to add the source ip address to the log when
authentication failed.

In more concrete terms, the 2480th line in the
usm_process_in_msg() function in snmpusm.c outputs the log
message like below.


# I'm using the net-snmp-5.6.1.1 on NetBSD.

   2260 int
   2261 usm_process_in_msg(int msgProcModel,    /* (UNUSED) */
     :
   2465     /*
   2466      * Check the authentication credentials of the message.
   2467      */
   2468     if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
   2469         || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
   2470         if (sc_check_keyed_hash(user->authProtocol, user->authProtoc...
   2471                                 user->authKey, user->authKeyLen,
   2472                                 wholeMsg, wholeMsgLen,
   2473                                 signature, signature_length)
   2474             != SNMP_ERR_NOERROR) {
   2475             DEBUGMSGTL(("usm", "Verification failed.\n"));
   2476             if (snmp_increment_statistic(STAT_USMSTATSWRONGDIGESTS) ...
   2477                 DEBUGMSGTL(("usm", "%s\n",
   2478                             "Failed to increment statistic."));
   2479             }
   2480             snmp_log(LOG_WARNING, "Authentication failed for %s\n",
   2481                                 user->name);
   2482             return SNMPERR_USM_AUTHENTICATIONFAILURE;
   2483         }
   2484


With the use of `netsnmp_session *sess', the parameter of
usm_process_in_msg(), I tried but it didn't work as
sess->peername is NULL.

So I want to use the value of sess->peername at that point,
where should sess->peernaem be prepared?
Or, does anyone have the other idea?

I will appreciate your frank comments.

Regards,

--
Kuroishi Mitsuo

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to