-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: support for nasl snmp getnext #1047
Conversation
52a8ed3
to
3144979
Compare
/* Free request only, since members are pointers to the nasl lexic context | ||
which will be free()'d later */ | ||
g_free (request); | ||
|
||
return array_from_snmp_result (ret, result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the result struct also has to free its memory after the array is created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Result struct must not be free()'d, since the return nasl tree_cell structs does not have a copy of the result members, but points to them. You can see this in the array_from_snmp_result().
Once the script finishes, the memory used by tree_cells structures is released.
/* Free request only, since members are pointers to the nasl lexic context | ||
which will be free()'d later */ | ||
g_free (request); | ||
|
||
return array_from_snmp_result (ret, result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
Now is called nasl_snmpv3_get_action() and receives the new parameter "action" to specify if it will be called the "get" or "getnext" action. Add wrappers for this function which call nasl_snmpv3_get_action() with the requiered action.
…arameter "action". Pass the new action parameter set with NASL_SNMP_GET in the existing nasl_snmpv*_get() wrapper functions Add the new wrapper functions nasl_snmpv1_getnext() and nasl_snmpv2c_getnext()
This fixes a segmentation fault in the original PR, because result didn't have allocated memory.
The first time the oid is requiered. The next time, the oid is optional for getnext While snmpgetnext support mib descriptions instead of oids (like iso.3.6....), the older version snmp v1 doesn't. Therfore the iso. is formated in the right place, so the oid can be saved once it is in the result.
Now, also the oid is get with name.
…he result struct. The oid can be used now for getnext. (See some commits above.)
d9db3a5
to
7982a46
Compare
What:
Additional Nasle function to support GETNEXT for SNMP.
SC-443
Why:
This allows to iterate over OID trees
How:
Currently in testing phase
Used this script for testing:
Checklist: