SNMP Subagent Programmer's Guide
Security Checker
2-94 119728—SNMP Subagent Programmer’s Guide
Programming Tutorials
static int
#ifdef USE_PROTOTYPES
SET_helloOutputText(void *ctxt, void **indices, void *attr_ref)
#else
SET_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;
   helloText.len = attr->len;
   (void) memcpy((char *) helloText.val, (char *) attr->val,
          (int) attr->len);
   return(SNMP_ERR_NO_ERROR);
}
static int
#ifdef USE_PROTOTYPES
GET_helloPrintFreq(void *ctxt, void **indices, void *attr_ref)
#else
GET_helloPrintFreq(ctxt, indices, attr_ref)
void         *ctxt;
void         **indices;
void         *attr_ref;
#endif
{
   INTEGER *attr;
   if (!authenticated) {return(SNMP_ERR_GEN_ERR);}           <-
-19
   attr = (INTEGER *) attr_ref;
   *attr = helloPrintFreq;
   return(SNMP_ERR_NO_ERROR);
}
static int
#ifdef USE_PROTOTYPES
TEST_helloPrintFreq(void *ctxt, void **indices, void *attr_ref)
#else
TEST_helloPrintFreq(ctxt, indices, attr_ref)
void         *ctxt;
void         **indices;
void         *attr_ref;
#endif
{
   INTEGER *attr;
   if (!authenticated) {return(SNMP_ERR_GEN_ERR);}           <-
-19
   attr = (INTEGER *) attr_ref;
   if ((*attr < (INTEGER) 1) || (*attr > (INTEGER) 120))         
    {return(SNMP_ERR_BAD_VALUE);}
   return(SNMP_ERR_NO_ERROR);
}
Example 2-20. Security Checker Access Functions (page 2 of 3)










