~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to apps/snmptrapd_auth.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-12-08 14:59:50 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071208145950-u1tykhpw56nyzqik
Tags: 5.4.1~dfsg-4ubuntu1
* Merge from debian unstable.
* Remaining Ubuntu changes:
  - Remove stop links from rc0 and rc6
  - Munge Maintainer field as per spec.
* Ubuntu changes dropped:
  - Symlink common files between the packages, CDBS ought to handle that
    for us automatically.
* The latest Debian changes has dropped history from the changelog. Slot in
  the Ubuntu changes as best I can. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        return NETSNMPTRAPD_HANDLER_FINISH;
73
73
    
74
74
    /* convert to v2 so we can check it in a consistent manner */
75
 
#ifndef DISABLE_SNMPV1
76
 
    if (pdu->version == SNMP_VERSION_1)
 
75
#ifndef NETSNMP_DISABLE_SNMPV1
 
76
    if (pdu->version == SNMP_VERSION_1) {
77
77
        newpdu = convert_v1pdu_to_v2(pdu);
 
78
        if (!newpdu) {
 
79
            snmp_log(LOG_ERR, "Failed to duplicate incoming PDU.  Refusing to authorize.\n");
 
80
            return NETSNMPTRAPD_HANDLER_FINISH;
 
81
        }
 
82
    }
78
83
#endif
79
84
 
80
 
    if (!newpdu) {
81
 
        snmp_log(LOG_ERR, "Failed to duplicate incoming PDU.  Refusing to authorize.\n");
82
 
        return NETSNMPTRAPD_HANDLER_FINISH;
83
 
    }
84
 
 
85
85
    if (!vacm_is_configured()) {
 
86
#ifndef NETSNMP_DISABLE_SNMPV1
86
87
        if (newpdu != pdu)
87
88
            snmp_free_pdu(newpdu);
 
89
#endif
88
90
        snmp_log(LOG_WARNING, "No access configuration - dropping trap.\n");
89
91
        return NETSNMPTRAPD_HANDLER_FINISH;
90
92
    }
100
102
    /* make sure we can continue: we found the snmpTrapOID.0 and its an oid */
101
103
    if (!var || var->type != ASN_OBJECT_ID) {
102
104
        snmp_log(LOG_ERR, "Can't determine trap identifier; refusing to authorize it\n");
 
105
#ifndef NETSNMP_DISABLE_SNMPV1
103
106
        if (newpdu != pdu)
104
107
            snmp_free_pdu(newpdu);
 
108
#endif
105
109
        return NETSNMPTRAPD_HANDLER_FINISH;
106
110
    }
107
111
 
125
129
    if (ret) {
126
130
        /* we have policy to at least do "something".  Remember and continue. */
127
131
        lastlookup = ret;
 
132
#ifndef NETSNMP_DISABLE_SNMPV1
128
133
        if (newpdu != pdu)
129
134
            snmp_free_pdu(newpdu);
 
135
#endif
130
136
        return NETSNMPTRAPD_HANDLER_OK;
131
137
    }
132
138
 
133
139
    /* No policy was met, so we drop the PDU from further processing */
134
140
    DEBUGMSGTL(("snmptrapd:auth", "Dropping unauthorized message\n"));
 
141
#ifndef NETSNMP_DISABLE_SNMPV1
135
142
    if (newpdu != pdu)
136
143
        snmp_free_pdu(newpdu);
 
144
#endif
137
145
    return NETSNMPTRAPD_HANDLER_FINISH;
138
146
}
139
147