|
Lines 580-587
Link Here
|
| 580 |
* The command is set to the input command and the reqid, errstat, and |
580 |
* The command is set to the input command and the reqid, errstat, and |
| 581 |
* errindex are set to default values. |
581 |
* errindex are set to default values. |
| 582 |
* If the error status didn't indicate an error, the error index didn't |
582 |
* If the error status didn't indicate an error, the error index didn't |
| 583 |
* indicate a variable, the pdu wasn't a get response message, or there |
583 |
* indicate a variable, the pdu wasn't a get response message, there |
| 584 |
* would be no remaining variables, this function will return 0. |
584 |
* would be no remaining variables, or the marked variable was not |
|
|
585 |
* present in the initial request, this function will return 0. |
| 585 |
* If everything was successful, a pointer to the fixed cloned pdu will |
586 |
* If everything was successful, a pointer to the fixed cloned pdu will |
| 586 |
* be returned. |
587 |
* be returned. |
| 587 |
*/ |
588 |
*/ |
|
Lines 590-599
Link Here
|
| 590 |
{ |
591 |
{ |
| 591 |
netsnmp_pdu *newpdu; |
592 |
netsnmp_pdu *newpdu; |
| 592 |
|
593 |
|
| 593 |
if ((pdu->command != SNMP_MSG_RESPONSE) |
594 |
if ( |
|
|
595 |
// We're only going to fix a PDU if it was a *response* to us. |
| 596 |
(pdu->command != SNMP_MSG_RESPONSE) |
| 597 |
// We're only going to fix a PDU that had an error. |
| 594 |
|| (pdu->errstat == SNMP_ERR_NOERROR) |
598 |
|| (pdu->errstat == SNMP_ERR_NOERROR) |
|
|
599 |
// We're only going to fix a PDU that has varbinds. |
| 595 |
|| (0 == pdu->variables) |
600 |
|| (0 == pdu->variables) |
| 596 |
|| (pdu->errindex <= 0)) { |
601 |
// We're only going to fix a PDU with a positive error-index. |
|
|
602 |
|| (pdu->errindex <= 0) |
| 603 |
// We're only going to fix a PDU if we can actually remove |
| 604 |
// the varbind that was listed as being "bad". If the number |
| 605 |
// of varbinds is *less* than the error-index value, then |
| 606 |
// we can't really do anything except simply resend the PDU |
| 607 |
// and hope for a better response, and that's not a good |
| 608 |
// thing to do; previously, this had led to infinite loops |
| 609 |
// of send, receive, and resend. |
| 610 |
|| (pdu->errindex > snmp_varbind_len(pdu)) |
| 611 |
) { |
| 597 |
return 0; /* pre-condition tests fail */ |
612 |
return 0; /* pre-condition tests fail */ |
| 598 |
} |
613 |
} |
| 599 |
|
614 |
|