SNMP Subagent Programmer's Guide

Programming Tutorials
SNMP Subagent Programmer’s Guide—119728 2-93
Security Checker
Example 2-20. Security Checker Access Functions (page 1 of 3)
/* securit.c -- access functions for hello-security subagent example */
/*
* Standard Header Files
*/
#include "syspubH"
#include "snmperrH"
#include "classdeH"
#include "smitypeH"
#include "snmpvblH"
static int
#ifdef USE_PROTOTYPES
GET_helloOutputText(void *ctxt, void **indices, void *attr_ref)
#else
GET_helloOutputText(ctxt, indices, attr_ref)
void *ctxt;
void **indices;
void *attr_ref;
#endif
{
OCTETSTRING *attr;
if (!authenticated) {return(SNMP_ERR_GEN_ERR);} <-
-19
attr = (OCTETSTRING *) attr_ref;
*attr = helloText;
return(SNMP_ERR_NO_ERROR);
}
static int
#ifdef USE_PROTOTYPES
TEST_helloOutputText(void *ctxt, void **indices, void *attr_ref)
#else
TEST_helloOutputText(ctxt, indices, attr_ref)
void *ctxt;
void **indices;
void *attr_ref;
#endif
{
OCTETSTRING *attr;
if (!authenticated) {return(SNMP_ERR_GEN_ERR);} <-
-19
attr = (OCTETSTRING *) attr_ref;
if ((attr->len < 0) || (attr->len > 255)) {return(SNMP_ERR_BAD_VALUE);}
return(SNMP_ERR_NO_ERROR);
}