~ubuntu-branches/ubuntu/wily/net-snmp/wily-proposed

« back to all changes in this revision

Viewing changes to agent/mibgroup/agentx/protocol.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-28 14:59:36 UTC
  • mfrom: (1.2.3 upstream) (1.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100628145936-cbiallic69pn044g
Tags: 5.4.3~dfsg-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Set Ubuntu maintainer address.
  - net-snmp-config: Use bash. (LP: #104738)
  - Removed multiuser option when calling update-rc.d. (LP: #254261)
  - debian/snmpd.init: LSBify the init script.
  - debian/patches/52_fix_snmpcmd_1_typo.patch: Adjust a typo in snmpcmd.1
    (LP: #250459)
  - debian/snmpd.postinst: source debconf before doing work, LP: #589056
  - debian/snmp.preinst, debian/snmp.prerm: kill any/all processes owned by
    snmp user before install/uninstall, LP: #573391
  - Add apport hook (LP: #533603):
  - debian/{snmp,snmpd}.apport: Added.
  - debian/control: Build-depends on dh-apport.
  - debian/rules: 
    + Add --with apport.
    + override_dh_apport to install hook on snmpd package only.
 * Dropped patches:
   - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1105
1105
{
1106
1106
    u_int           n_subid;
1107
1107
    u_int           prefix;
 
1108
    u_int           tmp_oid_len;
1108
1109
    int             i;
1109
1110
    int             int_offset;
1110
1111
    u_int          *int_ptr = (u_int *)oid_buf;
1111
1112
    u_char         *buf_ptr = data;
1112
1113
 
1113
1114
    if (*length < 4) {
1114
 
        DEBUGMSGTL(("agentx", "Incomplete Object ID"));
 
1115
        DEBUGMSGTL(("agentx", "Incomplete Object ID\n"));
1115
1116
        return NULL;
1116
1117
    }
1117
1118
 
1144
1145
        /*
1145
1146
         * Null OID 
1146
1147
         */
1147
 
        *int_ptr = 0;
1148
 
        int_ptr++;
1149
 
        *int_ptr = 0;
1150
 
        int_ptr++;
 
1148
        memset(int_ptr, 0, 2 * sizeof(oid));
1151
1149
        *oid_len = 2;
1152
1150
        DEBUGPRINTINDENT("dumpv_recv");
1153
1151
        DEBUGMSG(("dumpv_recv", "OID: NULL (0.0)\n"));
1155
1153
        return buf_ptr;
1156
1154
    }
1157
1155
 
 
1156
    /*
 
1157
     * Check that the expanded OID will fit in the buffer provided
 
1158
     */
 
1159
    tmp_oid_len = (prefix ? n_subid + 5 : n_subid);
 
1160
    if (*oid_len < tmp_oid_len) {
 
1161
        DEBUGMSGTL(("agentx", "Oversized Object ID\n"));
 
1162
        return NULL;
 
1163
    }
1158
1164
 
1159
1165
#ifdef WORDS_BIGENDIAN
1160
1166
# define endianoff 1
1162
1168
# define endianoff 0
1163
1169
#endif
1164
1170
    if (*length < 4 * n_subid) {
1165
 
        DEBUGMSGTL(("agentx", "Incomplete Object ID"));
 
1171
        DEBUGMSGTL(("agentx", "Incomplete Object ID\n"));
1166
1172
        return NULL;
1167
1173
    }
1168
1174
 
1199
1205
        *length -= 4;
1200
1206
    }
1201
1207
 
1202
 
    *oid_len = (prefix ? n_subid + 5 : n_subid);
 
1208
    *oid_len = tmp_oid_len;
1203
1209
 
1204
1210
    DEBUGINDENTLESS();
1205
1211
    DEBUGPRINTINDENT("dumpv_recv");
1220
1226
    u_int           len;
1221
1227
 
1222
1228
    if (*length < 4) {
1223
 
        DEBUGMSGTL(("agentx", "Incomplete string (too short: %d)",
 
1229
        DEBUGMSGTL(("agentx", "Incomplete string (too short: %d)\n",
1224
1230
                    *length));
1225
1231
        return NULL;
1226
1232
    }
1227
1233
 
1228
1234
    len = agentx_parse_int(data, network_byte_order);
1229
1235
    if (*length < len + 4) {
1230
 
        DEBUGMSGTL(("agentx", "Incomplete string (still too short: %d)",
 
1236
        DEBUGMSGTL(("agentx", "Incomplete string (still too short: %d)\n",
1231
1237
                    *length));
1232
1238
        return NULL;
1233
1239
    }
1234
1240
    if (len > *str_len) {
1235
 
        DEBUGMSGTL(("agentx", "String too long (too long)"));
 
1241
        DEBUGMSGTL(("agentx", "String too long (too long)\n"));
1236
1242
        return NULL;
1237
1243
    }
1238
1244
    memmove(string, data + 4, len);
1902
1908
     */
1903
1909
    len1 = BUFSIZ;
1904
1910
    if (agentx_build(&sess, pdu1, packet1, &len1) < 0) {
1905
 
        DEBUGMSGTL(("agentx", "First build failed"));
 
1911
        DEBUGMSGTL(("agentx", "First build failed\n"));
1906
1912
        exit(1);
1907
1913
    }
1908
1914