SNMP Subagent Programmer's Guide
Security Checker
2-86 119728—SNMP Subagent Programmer’s Guide
Programming Tutorials
13. If connection with the NonStop agent is lost, the subagent calls
mgmt_del_instance() and mgmt_term_env() to release memory before terminating.
Authentication Function
The file named authentc contains the authentication function, authenticate():
14. A variable used to identify the pair of colons used to separate the agent’s community
string from the subagent password is declared.
15. A pointer used to parse the community string retrieved using mgmt_security() is
declared.
16. The community string is examined to determine whether it contains the double-
colon separator.
17. The beginning of the password is identified.
18. The password in the community string obtained from the NonStop agent is
compared with the password provided at subagent invocation. If they are the same,
the authentication function returns a value of 1. If they differ, it returns 0.
Access Functions
The file named securitc contains an access function supporting each operation allowed
on each MIB object by the ACCESS clause in the MIB definition:
When mgmt_poll() executes, the run-time library calls the access function appropriate to
the request and the target MIB object.
All the access functions for this subagent were coded starting with templates created
using GDMOC. GDMOC was run using as input the MIB definition without the access
function extensions:
19. This line of code was added to each access function template in order to
conditionally process the request based on the results of authenticate(). After these
simple modifications were made, the extensions were added to the MIB definition so
the subagent could be compiled successfully.
MIB Object SNMP Request Access Function Used
helloOutputText Get
GetNext
GET_helloOutputText
Set TEST_helloOutputText
SET_helloOutputText
helloPrintFreq Get
GetNext
GET_helloPrintFreq
Set TEST_helloPrintFreq
SET_helloPrintFreq
helloPrintCnt Get
GetNext
GET_helloPrintCnt