Re: Sample code to change passwords

David Yo <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAJ_ATWXNwMVSGLE8pOgPZYtsjWW3RK-Cv1HXZ9pSr3q0yhsYmg@mail.gmail.com>
Hi,

I ran into the same problem recently and came up with a workaround. When a
session is closed, I remove the usm user from the user list, preventing it
from messing up my further modifications.

The code is as follows:

void close_session(netsnmp_session *session) {
    // NOTE: remove cached user, otherwise have fun debugging snmp v3
options modification :)
    auto session = this->session_handler_;
    auto user = usm_get_user(session->contextEngineID,
session->contextEngineIDLen, session->securityName);
    if (user) {
        usm_remove_user(user);
    }
    snmp_close(session);
}

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.