~ubuntu-branches/ubuntu/precise/net-snmp/precise

« back to all changes in this revision

Viewing changes to snmplib/mib.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-11-26 01:27:00 UTC
  • mfrom: (1.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091126012700-pox7w0a5j2x305h9
Tags: 5.4.2.1~dfsg-3ubuntu1
* Merge from debian testing.  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/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.
    (LP: #426813).
 * Dropped patches:
   - debian/patches/101-fix-ipalias.patch: Applied upstream.
   - debian/patches/99-fix-net-snmp-syslog.patch: Applied upstream.
   - debian/patches/99-fix-perl-counter-in-subagent.patch: Applied upstream.
   - ebian/patches/103-fix-ubuntu-lmsensors.patch: No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * mib.c
3
3
 *
4
 
 * $Id: mib.c 16360 2007-05-12 11:14:39Z magfr $
 
4
 * $Id: mib.c 17137 2008-07-30 07:57:19Z dts12 $
5
5
 *
6
6
 * Update: 1998-07-17 <jhy@gsu.edu>
7
7
 * Added print_oid_report* functions.
434
434
    const char     *saved_hint = hint;
435
435
    int             hex = 0, x = 0;
436
436
    u_char         *cp;
437
 
    int             output_format;
 
437
    int             output_format, len_needed;
438
438
 
439
439
    if ((var->type != ASN_OCTET_STR) && 
440
440
        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
528
528
                    break;
529
529
                case 't': /* new in rfc 3411 */
530
530
                case 'a':
531
 
                    while ((*out_len + width + 1) >= *buf_len) {
 
531
                    /* A string hint gives the max size - we may not need this much */
 
532
                    len_needed = SNMP_MIN( width, ecp-cp );
 
533
                    while ((*out_len + len_needed + 1) >= *buf_len) {
532
534
                        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
533
535
                            return 0;
534
536
                        }
3241
3243
#ifndef NETSNMP_DISABLE_MIB_LOADING
3242
3244
    } else if (subtree) {
3243
3245
        const char *units = NULL;
 
3246
        const char *hint = NULL;
3244
3247
        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
3245
3248
                                    NETSNMP_DS_LIB_DONT_PRINT_UNITS)) {
3246
3249
            units = subtree->units;
3247
3250
        }
 
3251
 
 
3252
                if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
 
3253
                                    NETSNMP_DS_LIB_NO_DISPLAY_HINT)) {
 
3254
                        hint = subtree->hint;
 
3255
        }
 
3256
 
3248
3257
        if (subtree->printomat) {
3249
3258
            return (*subtree->printomat) (buf, buf_len, out_len,
3250
3259
                                          allow_realloc, variable,
3251
 
                                          subtree->enums, subtree->hint,
 
3260
                                          subtree->enums, hint,
3252
3261
                                          units);
3253
3262
        } else {
3254
3263
            return sprint_realloc_by_type(buf, buf_len, out_len,
3255
3264
                                          allow_realloc, variable,
3256
 
                                          subtree->enums, subtree->hint,
 
3265
                                          subtree->enums, hint,
3257
3266
                                          units);
3258
3267
        }
3259
3268
#endif /* NETSNMP_DISABLE_MIB_LOADING */