Re: community delete at run-time

ashok kumar <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CACtqA-sVb6W6dqZHQqg7UsRtMy5=gn=k1ajJaSyi+1nd7HSSRg@mail.gmail.com>
Hello Wes,

I was not really bothered about the SNMP-COMMUNITY-MIB but was just
for looking to removing the community string through my CLI.

I could add the community string through my CLI by calling
vacm_parse_rocommunity and vacm_parse_rwcommunity and then I was
looking for an API to delete the community string added.

I could not find any API for that but with some older post I got the
API to delete all the community strings
(netsnmp_udp_com2SecList_free). I just modified this API to remove a
particular community string and succeeded.

Here is the API I used:
void
netsnmp_udp_com2SecList_free_by_name(char *communityName)
{
    com2SecEntry   *e = com2SecList;
    com2SecEntry   *tmp1 = e;
    if (strcmp(tmp1->community, communityName) == 0)
    {
        e = e->next;
        com2SecList = e;
        free(tmp1);
        return;
    }
    while (e != NULL) {
        com2SecEntry *tmp2 = e->next;
        if(tmp2 == NULL)
                break;
        if (strcmp(tmp2->community, communityName))
        {
                e = e->next;
                continue;
        }
        else
        {
                e->next = e->next->next;
                free(tmp2);
                break;
        }
    }
}

Hope this will be useful for some other. Thanks.

Regards,
Ashok

On Wed, Aug 31, 2011 at 5:26 AM, Wes Hardaker
<[email protected]> wrote:
>>>>>> On Wed, 24 Aug 2011 15:00:15 +0530, ashok kumar <[email protected]> said:
>
> ak> I have a requirement to add / delete community at run-time. (with out
> ak> restarting snmpd)
>
> ak> I am using vacm_parse_rocommunity or vacm_parse_rwcommunity for adding
> ak> a new community and it is working. I want to delete the created view,
> ak> Can you please suggest me any API for that.
>
> What you're looking for is the SNMP-COMMUNITY-MIB, which we don't
> support at this time.
> --
> Wes Hardaker
> SPARTA, Inc.
>

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
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.