hello

i want to reset password o my device through snmp client (i.e.MIB
browser).Agent will receive the password string and send it to UART.
MIB contains-
PasswordReset OBJECT-TYPE
    SYNTAX    DisplayString
    MAX-ACCESS    read-write
    STATUS    current
    DESCRIPTION
        "Device password reset. Password length is Max 8 characters"
    ::= { commonSystemParams 10}

following is code snipt for password handle-


char pwd_str[]="1234";


int handle_PasswordReset(netsnmp_mib_handler *handler,
                          netsnmp_handler_registration *reginfo,
                          netsnmp_agent_request_info   *reqinfo,
                          netsnmp_request_info         *requests)
{
    int ret; char str_pwd[4]="";
    /* We are never called for a GETNEXT if it's registered as a
       "instance", as it's "magically" handled for us.  */

    /* a instance handler also only hands us one request at a time, so
       we don't need to loop over a list of requests; we'll only get one. */

    switch(reqinfo->mode) {

        case MODE_GET:
            snmp_set_var_typed_value(requests->requestvb, ASN__OCTET_STR,
                                     /* XXX: a pointer to the scalar's data
*/
                (u_char*)&pwd_str,
                                     /* XXX: the length of the data in
bytes */
                sizeof(pwd));
            break;

       .
       .
       .
       .

        case MODE_SET_COMMIT:

        //here is the problem to store password string

        str_ pwd=*(requests->requestvb->val.string);/* XXX: delete
temporary storage */

         write(fd,str_pwd,4); //write to serial port
         usleep(100000);

            /* XXX: delete temporary storage */
            if (/* XXX: error? */0) {
                /* try _really_really_ hard to never get to this point */
                netsnmp_set_request_error(reqinfo, requests,
  .
       .
       .
       .

    return SNMP_ERR_NOERROR;
}


I am able to get the password string but not able to set.

Any suggestion
Thanks in advance.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to