~ubuntu-branches/ubuntu/intrepid/net-snmp/intrepid-updates

« back to all changes in this revision

Viewing changes to snmplib/parse.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2006-11-28 12:29:34 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20061128122934-82xxzy2zcvypnvy7
Tags: 5.2.3-4ubuntu1
* Merge from debian unstable, remaining changes:
  - remove stop links from rc0 and rc6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * parse.c
3
3
 *
4
 
 * Update: 1998-09-22 <mslifcak@iss.net>
5
 
 * Clear nbuckets in init_node_hash.
6
 
 * New method xcalloc returns zeroed data structures.
7
 
 * New method alloc_node encapsulates common node creation.
8
 
 * New method to configure terminate comment at end of line.
9
 
 * New method to configure accept underscore in labels.
10
 
 *
11
 
 * Update: 1998-10-10 <daves@csc.liv.ac.uk>
12
 
 * fully qualified OID parsing patch
13
 
 *
14
 
 * Update: 1998-10-20 <daves@csc.liv.ac.uk>
15
 
 * merge_anon_children patch
16
 
 *
17
 
 * Update: 1998-10-21 <mslifcak@iss.net>
18
 
 * Merge_parse_objectid associates information with last node in chain.
19
4
 */
20
5
/* Portions of this file are subject to the following copyrights.  See
21
6
 * the Net-SNMP's COPYING file for more details and other copyrights
62
47
#endif
63
48
#include <ctype.h>
64
49
#include <sys/types.h>
 
50
#if HAVE_SYS_STAT_H
65
51
#include <sys/stat.h>
 
52
#endif
66
53
 
67
54
/*
68
55
 * Wow.  This is ugly.  -- Wes 
110
97
#include <dmalloc.h>
111
98
#endif
112
99
 
 
100
#include <errno.h>
 
101
 
113
102
#include <net-snmp/types.h>
114
103
#include <net-snmp/output_api.h>
115
104
#include <net-snmp/config_api.h>
2164
2153
        nexttype = get_token(fp, nexttoken, MAXTOKEN);
2165
2154
        if (nexttype == RANGE) {
2166
2155
            nexttype = get_token(fp, nexttoken, MAXTOKEN);
 
2156
            errno = 0;
2167
2157
            high = strtol(nexttoken, NULL, 10);
 
2158
            if ( errno == ERANGE ) {
 
2159
                if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
 
2160
                                       NETSNMP_DS_LIB_MIB_WARNINGS))
 
2161
                    snmp_log(LOG_WARNING,
 
2162
                             "Warning: Upper bound not handled correctly (%s != %d): At line %d in %s\n",
 
2163
                                 nexttoken, high, mibLine, File);
 
2164
            }
2168
2165
            nexttype = get_token(fp, nexttoken, MAXTOKEN);
2169
2166
        }
2170
2167
        *rpp = (struct range_list *) calloc(1, sizeof(struct range_list));
4391
4388
            return NULL;
4392
4389
        }
4393
4390
        if (nnp) {
4394
 
            if (nnp->type == TYPE_OTHER)
4395
 
                nnp->type = type;
4396
4391
            if (np)
4397
4392
                np->next = nnp;
4398
4393
            else
4399
4394
                np = root = nnp;
4400
4395
            while (np->next)
4401
4396
                np = np->next;
 
4397
            if (np->type == TYPE_OTHER)
 
4398
                np->type = type;
4402
4399
        }
4403
4400
    }
4404
4401
    DEBUGMSGTL(("parse-file", "End of file (%s)\n", File));