~ubuntu-branches/ubuntu/gutsy/wireshark/gutsy-security

« back to all changes in this revision

Viewing changes to epan/load_snmp_users_file.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2007-04-01 08:58:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070401085840-or3qhrpv8alt1bwg
Tags: 0.99.5-1
* New upstream release.
* debian/patches/09_idl2wrs.dpatch: updated to patch idl2wrs.sh.in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#line 2 "load_snmp_users_file.c"
 
2
 
 
3
#line 4 "load_snmp_users_file.c"
 
4
 
 
5
#define  YY_INT_ALIGNED short int
 
6
 
 
7
/* A lexical scanner generated by flex */
 
8
 
 
9
#define FLEX_SCANNER
 
10
#define YY_FLEX_MAJOR_VERSION 2
 
11
#define YY_FLEX_MINOR_VERSION 5
 
12
#define YY_FLEX_SUBMINOR_VERSION 31
 
13
#if YY_FLEX_SUBMINOR_VERSION > 0
 
14
#define FLEX_BETA
 
15
#endif
 
16
 
 
17
/* First, we deal with  platform-specific or compiler-specific issues. */
 
18
 
 
19
/* begin standard C headers. */
 
20
#include <stdio.h>
 
21
#include <string.h>
 
22
#include <errno.h>
 
23
#include <stdlib.h>
 
24
 
 
25
/* end standard C headers. */
 
26
 
 
27
/* flex integer type definitions */
 
28
 
 
29
#ifndef FLEXINT_H
 
30
#define FLEXINT_H
 
31
 
 
32
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
33
 
 
34
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
 
35
#include <inttypes.h>
 
36
typedef int8_t flex_int8_t;
 
37
typedef uint8_t flex_uint8_t;
 
38
typedef int16_t flex_int16_t;
 
39
typedef uint16_t flex_uint16_t;
 
40
typedef int32_t flex_int32_t;
 
41
typedef uint32_t flex_uint32_t;
 
42
#else
 
43
typedef signed char flex_int8_t;
 
44
typedef short int flex_int16_t;
 
45
typedef int flex_int32_t;
 
46
typedef unsigned char flex_uint8_t; 
 
47
typedef unsigned short int flex_uint16_t;
 
48
typedef unsigned int flex_uint32_t;
 
49
#endif /* ! C99 */
 
50
 
 
51
/* Limits of integral types. */
 
52
#ifndef INT8_MIN
 
53
#define INT8_MIN               (-128)
 
54
#endif
 
55
#ifndef INT16_MIN
 
56
#define INT16_MIN              (-32767-1)
 
57
#endif
 
58
#ifndef INT32_MIN
 
59
#define INT32_MIN              (-2147483647-1)
 
60
#endif
 
61
#ifndef INT8_MAX
 
62
#define INT8_MAX               (127)
 
63
#endif
 
64
#ifndef INT16_MAX
 
65
#define INT16_MAX              (32767)
 
66
#endif
 
67
#ifndef INT32_MAX
 
68
#define INT32_MAX              (2147483647)
 
69
#endif
 
70
#ifndef UINT8_MAX
 
71
#define UINT8_MAX              (255U)
 
72
#endif
 
73
#ifndef UINT16_MAX
 
74
#define UINT16_MAX             (65535U)
 
75
#endif
 
76
#ifndef UINT32_MAX
 
77
#define UINT32_MAX             (4294967295U)
 
78
#endif
 
79
 
 
80
#endif /* ! FLEXINT_H */
 
81
 
 
82
#ifdef __cplusplus
 
83
 
 
84
/* The "const" storage-class-modifier is valid. */
 
85
#define YY_USE_CONST
 
86
 
 
87
#else   /* ! __cplusplus */
 
88
 
 
89
#if __STDC__
 
90
 
 
91
#define YY_USE_CONST
 
92
 
 
93
#endif  /* __STDC__ */
 
94
#endif  /* ! __cplusplus */
 
95
 
 
96
#ifdef YY_USE_CONST
 
97
#define yyconst const
 
98
#else
 
99
#define yyconst
 
100
#endif
 
101
 
 
102
/* Returned upon end-of-file. */
 
103
#define YY_NULL 0
 
104
 
 
105
/* Promotes a possibly negative, possibly signed char to an unsigned
 
106
 * integer for use as an array index.  If the signed char is negative,
 
107
 * we want to instead treat it as an 8-bit unsigned char, hence the
 
108
 * double cast.
 
109
 */
 
110
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
 
111
 
 
112
/* Enter a start condition.  This macro really ought to take a parameter,
 
113
 * but we do it the disgusting crufty way forced on us by the ()-less
 
114
 * definition of BEGIN.
 
115
 */
 
116
#define BEGIN (yy_start) = 1 + 2 *
 
117
 
 
118
/* Translate the current start state into a value that can be later handed
 
119
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
 
120
 * compatibility.
 
121
 */
 
122
#define YY_START (((yy_start) - 1) / 2)
 
123
#define YYSTATE YY_START
 
124
 
 
125
/* Action number for EOF rule of a given start state. */
 
126
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
127
 
 
128
/* Special action meaning "start processing a new file". */
 
129
#define YY_NEW_FILE Snmp_UE_file_restart(Snmp_UE_file_in  )
 
130
 
 
131
#define YY_END_OF_BUFFER_CHAR 0
 
132
 
 
133
/* Size of default input buffer. */
 
134
#ifndef YY_BUF_SIZE
 
135
#define YY_BUF_SIZE 16384
 
136
#endif
 
137
 
 
138
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
 
139
#define YY_TYPEDEF_YY_BUFFER_STATE
 
140
typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
141
#endif
 
142
 
 
143
extern int Snmp_UE_file_leng;
 
144
 
 
145
extern FILE *Snmp_UE_file_in, *Snmp_UE_file_out;
 
146
 
 
147
#define EOB_ACT_CONTINUE_SCAN 0
 
148
#define EOB_ACT_END_OF_FILE 1
 
149
#define EOB_ACT_LAST_MATCH 2
 
150
 
 
151
    #define YY_LESS_LINENO(n)
 
152
    
 
153
/* Return all but the first "n" matched characters back to the input stream. */
 
154
#define yyless(n) \
 
155
        do \
 
156
                { \
 
157
                /* Undo effects of setting up Snmp_UE_file_text. */ \
 
158
        int yyless_macro_arg = (n); \
 
159
        YY_LESS_LINENO(yyless_macro_arg);\
 
160
                *yy_cp = (yy_hold_char); \
 
161
                YY_RESTORE_YY_MORE_OFFSET \
 
162
                (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
 
163
                YY_DO_BEFORE_ACTION; /* set up Snmp_UE_file_text again */ \
 
164
                } \
 
165
        while ( 0 )
 
166
 
 
167
#define unput(c) yyunput( c, (yytext_ptr)  )
 
168
 
 
169
/* The following is because we cannot portably get our hands on size_t
 
170
 * (without autoconf's help, which isn't available because we want
 
171
 * flex-generated scanners to compile on their own).
 
172
 */
 
173
 
 
174
#ifndef YY_TYPEDEF_YY_SIZE_T
 
175
#define YY_TYPEDEF_YY_SIZE_T
 
176
typedef unsigned int yy_size_t;
 
177
#endif
 
178
 
 
179
#ifndef YY_STRUCT_YY_BUFFER_STATE
 
180
#define YY_STRUCT_YY_BUFFER_STATE
 
181
struct yy_buffer_state
 
182
        {
 
183
        FILE *yy_input_file;
 
184
 
 
185
        char *yy_ch_buf;                /* input buffer */
 
186
        char *yy_buf_pos;               /* current position in input buffer */
 
187
 
 
188
        /* Size of input buffer in bytes, not including room for EOB
 
189
         * characters.
 
190
         */
 
191
        yy_size_t yy_buf_size;
 
192
 
 
193
        /* Number of characters read into yy_ch_buf, not including EOB
 
194
         * characters.
 
195
         */
 
196
        int yy_n_chars;
 
197
 
 
198
        /* Whether we "own" the buffer - i.e., we know we created it,
 
199
         * and can realloc() it to grow it, and should free() it to
 
200
         * delete it.
 
201
         */
 
202
        int yy_is_our_buffer;
 
203
 
 
204
        /* Whether this is an "interactive" input source; if so, and
 
205
         * if we're using stdio for input, then we want to use getc()
 
206
         * instead of fread(), to make sure we stop fetching input after
 
207
         * each newline.
 
208
         */
 
209
        int yy_is_interactive;
 
210
 
 
211
        /* Whether we're considered to be at the beginning of a line.
 
212
         * If so, '^' rules will be active on the next match, otherwise
 
213
         * not.
 
214
         */
 
215
        int yy_at_bol;
 
216
 
 
217
    int yy_bs_lineno; /**< The line count. */
 
218
    int yy_bs_column; /**< The column count. */
 
219
    
 
220
        /* Whether to try to fill the input buffer when we reach the
 
221
         * end of it.
 
222
         */
 
223
        int yy_fill_buffer;
 
224
 
 
225
        int yy_buffer_status;
 
226
 
 
227
#define YY_BUFFER_NEW 0
 
228
#define YY_BUFFER_NORMAL 1
 
229
        /* When an EOF's been seen but there's still some text to process
 
230
         * then we mark the buffer as YY_EOF_PENDING, to indicate that we
 
231
         * shouldn't try reading from the input source any more.  We might
 
232
         * still have a bunch of tokens to match, though, because of
 
233
         * possible backing-up.
 
234
         *
 
235
         * When we actually see the EOF, we change the status to "new"
 
236
         * (via Snmp_UE_file_restart()), so that the user can continue scanning by
 
237
         * just pointing Snmp_UE_file_in at a new input file.
 
238
         */
 
239
#define YY_BUFFER_EOF_PENDING 2
 
240
 
 
241
        };
 
242
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
243
 
 
244
/* Stack of input buffers. */
 
245
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
 
246
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
 
247
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
 
248
 
 
249
/* We provide macros for accessing buffer states in case in the
 
250
 * future we want to put the buffer states in a more general
 
251
 * "scanner state".
 
252
 *
 
253
 * Returns the top of the stack, or NULL.
 
254
 */
 
255
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
 
256
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
 
257
                          : NULL)
 
258
 
 
259
/* Same as previous macro, but useful when we know that the buffer stack is not
 
260
 * NULL or when we need an lvalue. For internal use only.
 
261
 */
 
262
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
 
263
 
 
264
/* yy_hold_char holds the character lost when Snmp_UE_file_text is formed. */
 
265
static char yy_hold_char;
 
266
static int yy_n_chars;          /* number of characters read into yy_ch_buf */
 
267
int Snmp_UE_file_leng;
 
268
 
 
269
/* Points to current character in buffer. */
 
270
static char *yy_c_buf_p = (char *) 0;
 
271
static int yy_init = 1;         /* whether we need to initialize */
 
272
static int yy_start = 0;        /* start state number */
 
273
 
 
274
/* Flag which is used to allow Snmp_UE_file_wrap()'s to do buffer switches
 
275
 * instead of setting up a fresh Snmp_UE_file_in.  A bit of a hack ...
 
276
 */
 
277
static int yy_did_buffer_switch_on_eof;
 
278
 
 
279
void Snmp_UE_file_restart (FILE *input_file  );
 
280
void Snmp_UE_file__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
 
281
YY_BUFFER_STATE Snmp_UE_file__create_buffer (FILE *file,int size  );
 
282
void Snmp_UE_file__delete_buffer (YY_BUFFER_STATE b  );
 
283
void Snmp_UE_file__flush_buffer (YY_BUFFER_STATE b  );
 
284
void Snmp_UE_file_push_buffer_state (YY_BUFFER_STATE new_buffer  );
 
285
void Snmp_UE_file_pop_buffer_state (void );
 
286
 
 
287
static void Snmp_UE_file_ensure_buffer_stack (void );
 
288
static void Snmp_UE_file__load_buffer_state (void );
 
289
static void Snmp_UE_file__init_buffer (YY_BUFFER_STATE b,FILE *file  );
 
290
 
 
291
#define YY_FLUSH_BUFFER Snmp_UE_file__flush_buffer(YY_CURRENT_BUFFER )
 
292
 
 
293
YY_BUFFER_STATE Snmp_UE_file__scan_buffer (char *base,yy_size_t size  );
 
294
YY_BUFFER_STATE Snmp_UE_file__scan_string (yyconst char *yy_str  );
 
295
YY_BUFFER_STATE Snmp_UE_file__scan_bytes (yyconst char *bytes,int len  );
 
296
 
 
297
void *Snmp_UE_file_alloc (yy_size_t  );
 
298
void *Snmp_UE_file_realloc (void *,yy_size_t  );
 
299
void Snmp_UE_file_free (void *  );
 
300
 
 
301
#define yy_new_buffer Snmp_UE_file__create_buffer
 
302
 
 
303
#define yy_set_interactive(is_interactive) \
 
304
        { \
 
305
        if ( ! YY_CURRENT_BUFFER ){ \
 
306
        Snmp_UE_file_ensure_buffer_stack (); \
 
307
                YY_CURRENT_BUFFER_LVALUE =    \
 
308
            Snmp_UE_file__create_buffer(Snmp_UE_file_in,YY_BUF_SIZE ); \
 
309
        } \
 
310
        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
 
311
        }
 
312
 
 
313
#define yy_set_bol(at_bol) \
 
314
        { \
 
315
        if ( ! YY_CURRENT_BUFFER ){\
 
316
        Snmp_UE_file_ensure_buffer_stack (); \
 
317
                YY_CURRENT_BUFFER_LVALUE =    \
 
318
            Snmp_UE_file__create_buffer(Snmp_UE_file_in,YY_BUF_SIZE ); \
 
319
        } \
 
320
        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
 
321
        }
 
322
 
 
323
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
 
324
 
 
325
/* Begin user sect3 */
 
326
 
 
327
#define Snmp_UE_file_wrap() 1
 
328
#define YY_SKIP_YYWRAP
 
329
 
 
330
typedef unsigned char YY_CHAR;
 
331
 
 
332
FILE *Snmp_UE_file_in = (FILE *) 0, *Snmp_UE_file_out = (FILE *) 0;
 
333
 
 
334
typedef int yy_state_type;
 
335
 
 
336
extern int Snmp_UE_file_lineno;
 
337
 
 
338
int Snmp_UE_file_lineno = 1;
 
339
 
 
340
extern char *Snmp_UE_file_text;
 
341
#define yytext_ptr Snmp_UE_file_text
 
342
 
 
343
static yy_state_type yy_get_previous_state (void );
 
344
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
 
345
static int yy_get_next_buffer (void );
 
346
static void yy_fatal_error (yyconst char msg[]  );
 
347
 
 
348
/* Done after the current pattern has been matched and before the
 
349
 * corresponding action - sets up Snmp_UE_file_text.
 
350
 */
 
351
#define YY_DO_BEFORE_ACTION \
 
352
        (yytext_ptr) = yy_bp; \
 
353
        Snmp_UE_file_leng = (size_t) (yy_cp - yy_bp); \
 
354
        (yy_hold_char) = *yy_cp; \
 
355
        *yy_cp = '\0'; \
 
356
        (yy_c_buf_p) = yy_cp;
 
357
 
 
358
#define YY_NUM_RULES 30
 
359
#define YY_END_OF_BUFFER 31
 
360
/* This struct is not used in this scanner,
 
361
   but its presence is necessary. */
 
362
struct yy_trans_info
 
363
        {
 
364
        flex_int32_t yy_verify;
 
365
        flex_int32_t yy_nxt;
 
366
        };
 
367
static yyconst flex_int16_t yy_accept[102] =
 
368
    {   0,
 
369
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
370
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
371
        0,    0,   31,   30,    8,    8,    3,    8,    8,    8,
 
372
        7,    6,    9,   12,   12,   11,   13,   16,   16,   15,
 
373
       17,   20,   20,   19,   21,   22,   30,   29,   23,   28,
 
374
       29,   29,   29,   29,   29,    1,    2,    1,    0,    0,
 
375
        3,    0,    5,    0,    0,    4,    6,    9,    0,   10,
 
376
        0,   11,   13,    0,   14,    0,   15,   17,    0,   18,
 
377
        0,   19,   21,   22,   23,   28,    0,    0,    0,    0,
 
378
        2,    5,   10,   14,   18,   27,   26,   24,   25,   25,
 
379
 
 
380
        0
 
381
    } ;
 
382
 
 
383
static yyconst flex_int32_t yy_ec[256] =
 
384
    {   0,
 
385
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
 
386
        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
 
387
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
388
        1,    2,    1,    5,    6,    1,    1,    1,    1,    1,
 
389
        1,    7,    1,    1,    1,    1,    1,    8,    9,    8,
 
390
        8,    8,   10,    8,    8,    8,    8,    1,    1,    1,
 
391
        1,    1,    1,    1,   12,    8,    8,   13,   14,    8,
 
392
        1,   15,    1,    1,    1,    1,   16,    1,    1,    1,
 
393
        1,    1,   17,    1,    1,    1,    1,    1,    1,    1,
 
394
        1,   11,    1,    1,    1,    1,   12,    8,    8,   13,
 
395
 
 
396
       14,    8,    1,   15,    1,    1,    1,    1,   16,    1,
 
397
        1,    1,    1,    1,   17,    1,    1,    1,    1,    1,
 
398
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
399
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
400
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
401
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
402
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
403
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
404
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
405
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
406
 
 
407
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
408
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
409
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
410
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
411
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
412
        1,    1,    1,    1,    1
 
413
    } ;
 
414
 
 
415
static yyconst flex_int32_t yy_meta[18] =
 
416
    {   0,
 
417
        1,    1,    1,    1,    1,    1,    1,    2,    2,    2,
 
418
        1,    2,    2,    2,    1,    1,    1
 
419
    } ;
 
420
 
 
421
static yyconst flex_int16_t yy_base[113] =
 
422
    {   0,
 
423
        0,    0,    0,    0,  180,  179,   17,    0,  178,  177,
 
424
       34,    0,  176,  175,   51,    0,   67,   70,   74,    0,
 
425
       89,   91,  176,  183,  183,   94,  183,  172,   92,  171,
 
426
      183,    0,  171,  183,   93,    0,  170,  183,   94,    0,
 
427
      169,  183,   96,    0,  168,  183,  166,  183,  166,  183,
 
428
      164,  152,  151,  151,  148,  183,  183,  159,  100,  158,
 
429
      183,  103,  183,  104,  157,  183,    0,  157,  105,  183,
 
430
      106,    0,  156,  107,  183,  108,    0,  155,  115,  183,
 
431
      116,    0,  154,  183,  153,  183,  137,  136,  142,  139,
 
432
      183,  117,  118,  119,  120,  183,  183,  183,  141,  183,
 
433
 
 
434
      183,  131,  133,  135,  137,  147,  139,  146,  141,  145,
 
435
      143,  144
 
436
    } ;
 
437
 
 
438
static yyconst flex_int16_t yy_def[113] =
 
439
    {   0,
 
440
      102,  102,  101,    3,  102,  102,  101,    7,  102,  102,
 
441
      101,   11,  102,  102,  101,   15,  102,  102,  101,   19,
 
442
      103,  103,  101,  101,  101,  101,  101,  101,  104,  105,
 
443
      101,  106,  101,  101,  107,  108,  101,  101,  109,  110,
 
444
      101,  101,  111,  112,  101,  101,  101,  101,  101,  101,
 
445
      101,  101,  101,  101,  101,  101,  101,  101,  101,  105,
 
446
      101,  104,  101,  104,  105,  101,  106,  101,  107,  101,
 
447
      107,  108,  101,  109,  101,  109,  110,  101,  111,  101,
 
448
      111,  112,  101,  101,  101,  101,  101,  101,  101,  101,
 
449
      101,  104,  107,  109,  111,  101,  101,  101,  101,  101,
 
450
 
 
451
        0,  101,  101,  101,  101,  101,  101,  101,  101,  101,
 
452
      101,  101
 
453
    } ;
 
454
 
 
455
static yyconst flex_int16_t yy_nxt[201] =
 
456
    {   0,
 
457
       25,   26,   27,   28,   29,   30,   31,   32,   32,   32,
 
458
       25,   32,   32,   32,   25,   25,   25,   34,   34,   24,
 
459
       34,   35,   34,   34,   36,   36,   36,   34,   36,   36,
 
460
       36,   34,   34,   34,   38,   38,   24,   38,   39,   38,
 
461
       38,   40,   40,   40,   38,   40,   40,   40,   38,   38,
 
462
       38,   42,   42,   24,   42,   43,   42,   42,   44,   44,
 
463
       44,   42,   44,   44,   44,   42,   42,   42,   45,   46,
 
464
       47,   45,   46,   47,   48,   49,   50,   51,   48,   48,
 
465
       48,   48,   48,   48,   48,   52,   53,   48,   48,   54,
 
466
       55,   57,   58,   57,   58,   59,   63,   70,   75,   60,
 
467
 
 
468
       80,   59,   64,   71,   76,   60,   81,   63,   92,   70,
 
469
       93,   75,   94,   64,   64,   71,   71,   76,   76,   80,
 
470
       95,   63,   70,   75,   80,   81,   81,   64,   71,   76,
 
471
       81,   24,   24,   56,   56,   62,   62,   65,   65,   69,
 
472
       69,   74,   74,   79,   79,   82,   77,   72,   67,  100,
 
473
       99,   98,   97,   96,   85,   83,   78,   73,   68,   66,
 
474
       66,   91,   90,   89,   88,   87,   86,   85,   84,   83,
 
475
       78,   73,   68,   66,   61,  101,   41,   41,   37,   37,
 
476
       33,   33,   23,  101,  101,  101,  101,  101,  101,  101,
 
477
      101,  101,  101,  101,  101,  101,  101,  101,  101,  101
 
478
 
 
479
    } ;
 
480
 
 
481
static yyconst flex_int16_t yy_chk[201] =
 
482
    {   0,
 
483
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
 
484
        3,    3,    3,    3,    3,    3,    3,    7,    7,    7,
 
485
        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
 
486
        7,    7,    7,    7,   11,   11,   11,   11,   11,   11,
 
487
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
 
488
       11,   15,   15,   15,   15,   15,   15,   15,   15,   15,
 
489
       15,   15,   15,   15,   15,   15,   15,   15,   17,   17,
 
490
       17,   18,   18,   18,   19,   19,   19,   19,   19,   19,
 
491
       19,   19,   19,   19,   19,   19,   19,   19,   19,   19,
 
492
       19,   21,   21,   22,   22,   26,   29,   35,   39,   26,
 
493
 
 
494
       43,   59,   29,   35,   39,   59,   43,   62,   64,   69,
 
495
       71,   74,   76,   62,   64,   69,   71,   74,   76,   79,
 
496
       81,   92,   93,   94,   95,   79,   81,   92,   93,   94,
 
497
       95,  102,  102,  103,  103,  104,  104,  105,  105,  107,
 
498
      107,  109,  109,  111,  111,  112,  110,  108,  106,   99,
 
499
       90,   89,   88,   87,   85,   83,   78,   73,   68,   65,
 
500
       60,   58,   55,   54,   53,   52,   51,   49,   47,   45,
 
501
       41,   37,   33,   30,   28,   23,   14,   13,   10,    9,
 
502
        6,    5,  101,  101,  101,  101,  101,  101,  101,  101,
 
503
      101,  101,  101,  101,  101,  101,  101,  101,  101,  101
 
504
 
 
505
    } ;
 
506
 
 
507
static yy_state_type yy_last_accepting_state;
 
508
static char *yy_last_accepting_cpos;
 
509
 
 
510
extern int Snmp_UE_file__flex_debug;
 
511
int Snmp_UE_file__flex_debug = 0;
 
512
 
 
513
/* The intent behind this definition is that it'll catch
 
514
 * any uses of REJECT which flex missed.
 
515
 */
 
516
#define REJECT reject_used_but_not_detected
 
517
#define yymore() yymore_used_but_not_detected
 
518
#define YY_MORE_ADJ 0
 
519
#define YY_RESTORE_YY_MORE_OFFSET
 
520
char *Snmp_UE_file_text;
 
521
#line 1 "./load_snmp_users_file.l"
 
522
#line 8 "./load_snmp_users_file.l"
 
523
        /*
 
524
         * load_snmp_users_file.l
 
525
         *
 
526
         * User-based Security Model for SNMPv3
 
527
         * SNMP user-engine association file parser 
 
528
         *
 
529
         * Copyright 2007, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
 
530
         *
 
531
         * $Id: load_snmp_users_file.l 20393 2007-01-11 17:39:16Z lego $
 
532
         *
 
533
         * Wireshark - Network traffic analyzer
 
534
         * By Gerald Combs <gerald@wireshark.org>
 
535
         * Copyright 1998 Gerald Combs
 
536
         *
 
537
         * This program is free software; you can redistribute it and/or
 
538
         * modify it under the terms of the GNU General Public License
 
539
         * as published by the Free Software Foundation; either version 2
 
540
         * of the License, or (at your option) any later version.
 
541
         * 
 
542
         * This program is distributed in the hope that it will be useful,
 
543
         * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
544
         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
545
         * GNU General Public License for more details.
 
546
         * 
 
547
         * You should have received a copy of the GNU General Public License
 
548
         * along with this program; if not, write to the Free Software
 
549
         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
550
         */
 
551
#ifdef HAVE_CONFIG_H
 
552
# include "config.h"
 
553
#endif
 
554
        
 
555
        
 
556
#include <glib.h>
 
557
#include <string.h>
 
558
#include <errno.h>
 
559
#include <stdio.h>
 
560
 
 
561
 
 
562
#include <epan/tvbuff.h>
 
563
#include <epan/proto.h>
 
564
#include <epan/packet_info.h>
 
565
#include <epan/emem.h>
 
566
        
 
567
#include <epan/dissectors/packet-snmp.h>
 
568
        
 
569
#define AUTH_MD5 1
 
570
#define AUTH_SHA 2
 
571
#define PRIV_DES 4
 
572
#define PRIV_AES 5
 
573
 
 
574
        static GString* error;
 
575
        static GArray* assoc_arr = NULL;
 
576
        
 
577
        static guint8* engine = NULL;
 
578
        static guint engine_len = 0; 
 
579
        static guint8* user = NULL;
 
580
        static guint user_len = 0; 
 
581
        static guint8* auth_password = NULL;
 
582
        static guint auth_password_len = 0; 
 
583
        static guint8* priv_password = NULL;
 
584
        static guint priv_password_len = 0; 
 
585
        static int auth = AUTH_MD5;
 
586
        static int enc = PRIV_DES;
 
587
        static guint linenum = 0;
 
588
        static const gchar* filename = "";
 
589
        static guint loaded = 0;
 
590
        
 
591
        static void add_engine(void);
 
592
        static guint8* unhexbytes(const char* s, guint len, guint* len_p);
 
593
        static guint8* undquote(const char* s, guint in_len, guint* len_p);
 
594
        
 
595
        static snmp_usm_auth_model_t model_md5 = {snmp_usm_password_to_key_md5, snmp_usm_auth_md5, 16};
 
596
        static snmp_usm_auth_model_t model_sha1 = {snmp_usm_password_to_key_sha1, snmp_usm_auth_sha1, 20};
 
597
        
 
598
#define ERR(str) 
 
599
#define START_LINE() { \
 
600
                linenum++; \
 
601
                engine = NULL;\
 
602
                engine_len = 0;\
 
603
                user = NULL;\
 
604
                user_len = 0;\
 
605
                auth_password = NULL;\
 
606
                auth_password_len = 0;\
 
607
                priv_password = NULL;\
 
608
                priv_password_len = 0;\
 
609
                auth = AUTH_MD5;\
 
610
                enc = PRIV_DES;\
 
611
                BEGIN START_ENGINE;\
 
612
        }
 
613
 
 
614
 
 
615
 
 
616
 
 
617
 
 
618
 
 
619
 
 
620
#line 621 "load_snmp_users_file.c"
 
621
 
 
622
#define INITIAL 0
 
623
#define START_ENGINE 1
 
624
#define STOP_ENGINE 2
 
625
#define START_USER 3
 
626
#define STOP_USER 4
 
627
#define START_AUTHPASSWORD 5
 
628
#define STOP_AUTHPASSWORD 6
 
629
#define START_PRIVPASSWORD 7
 
630
#define STOP_PRIVPASSWORD 8
 
631
#define ATTRIBUTES 9
 
632
#define ERRORED 10
 
633
 
 
634
#ifndef YY_NO_UNISTD_H
 
635
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 
636
 * down here because we want the user's section 1 to have been scanned first.
 
637
 * The user has a chance to override it with an option.
 
638
 */
 
639
#include <unistd.h>
 
640
#endif
 
641
 
 
642
#ifndef YY_EXTRA_TYPE
 
643
#define YY_EXTRA_TYPE void *
 
644
#endif
 
645
 
 
646
/* Macros after this point can all be overridden by user definitions in
 
647
 * section 1.
 
648
 */
 
649
 
 
650
#ifndef YY_SKIP_YYWRAP
 
651
#ifdef __cplusplus
 
652
extern "C" int Snmp_UE_file_wrap (void );
 
653
#else
 
654
extern int Snmp_UE_file_wrap (void );
 
655
#endif
 
656
#endif
 
657
 
 
658
#ifndef yytext_ptr
 
659
static void yy_flex_strncpy (char *,yyconst char *,int );
 
660
#endif
 
661
 
 
662
#ifdef YY_NEED_STRLEN
 
663
static int yy_flex_strlen (yyconst char * );
 
664
#endif
 
665
 
 
666
#ifndef YY_NO_INPUT
 
667
 
 
668
#ifdef __cplusplus
 
669
static int yyinput (void );
 
670
#else
 
671
static int input (void );
 
672
#endif
 
673
 
 
674
#endif
 
675
 
 
676
/* Amount of stuff to slurp up with each read. */
 
677
#ifndef YY_READ_BUF_SIZE
 
678
#define YY_READ_BUF_SIZE 8192
 
679
#endif
 
680
 
 
681
/* Copy whatever the last rule matched to the standard output. */
 
682
#ifndef ECHO
 
683
/* This used to be an fputs(), but since the string might contain NUL's,
 
684
 * we now use fwrite().
 
685
 */
 
686
#define ECHO (void) fwrite( Snmp_UE_file_text, Snmp_UE_file_leng, 1, Snmp_UE_file_out )
 
687
#endif
 
688
 
 
689
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 
690
 * is returned in "result".
 
691
 */
 
692
#ifndef YY_INPUT
 
693
#define YY_INPUT(buf,result,max_size) \
 
694
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 
695
                { \
 
696
                int c = '*'; \
 
697
                size_t n; \
 
698
                for ( n = 0; n < max_size && \
 
699
                             (c = getc( Snmp_UE_file_in )) != EOF && c != '\n'; ++n ) \
 
700
                        buf[n] = (char) c; \
 
701
                if ( c == '\n' ) \
 
702
                        buf[n++] = (char) c; \
 
703
                if ( c == EOF && ferror( Snmp_UE_file_in ) ) \
 
704
                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
705
                result = n; \
 
706
                } \
 
707
        else \
 
708
                { \
 
709
                errno=0; \
 
710
                while ( (result = fread(buf, 1, max_size, Snmp_UE_file_in))==0 && ferror(Snmp_UE_file_in)) \
 
711
                        { \
 
712
                        if( errno != EINTR) \
 
713
                                { \
 
714
                                YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
715
                                break; \
 
716
                                } \
 
717
                        errno=0; \
 
718
                        clearerr(Snmp_UE_file_in); \
 
719
                        } \
 
720
                }\
 
721
\
 
722
 
 
723
#endif
 
724
 
 
725
/* No semi-colon after return; correct usage is to write "yyterminate();" -
 
726
 * we don't want an extra ';' after the "return" because that will cause
 
727
 * some compilers to complain about unreachable statements.
 
728
 */
 
729
#ifndef yyterminate
 
730
#define yyterminate() return YY_NULL
 
731
#endif
 
732
 
 
733
/* Number of entries by which start-condition stack grows. */
 
734
#ifndef YY_START_STACK_INCR
 
735
#define YY_START_STACK_INCR 25
 
736
#endif
 
737
 
 
738
/* Report a fatal error. */
 
739
#ifndef YY_FATAL_ERROR
 
740
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
 
741
#endif
 
742
 
 
743
/* end tables serialization structures and prototypes */
 
744
 
 
745
/* Default declaration of generated scanner - a define so the user can
 
746
 * easily add parameters.
 
747
 */
 
748
#ifndef YY_DECL
 
749
#define YY_DECL_IS_OURS 1
 
750
 
 
751
extern int Snmp_UE_file_lex (void);
 
752
 
 
753
#define YY_DECL int Snmp_UE_file_lex (void)
 
754
#endif /* !YY_DECL */
 
755
 
 
756
/* Code executed at the beginning of each rule, after Snmp_UE_file_text and Snmp_UE_file_leng
 
757
 * have been set up.
 
758
 */
 
759
#ifndef YY_USER_ACTION
 
760
#define YY_USER_ACTION
 
761
#endif
 
762
 
 
763
/* Code executed at the end of each rule. */
 
764
#ifndef YY_BREAK
 
765
#define YY_BREAK break;
 
766
#endif
 
767
 
 
768
#define YY_RULE_SETUP \
 
769
        YY_USER_ACTION
 
770
 
 
771
/** The main scanner function which does all the work.
 
772
 */
 
773
YY_DECL
 
774
{
 
775
        register yy_state_type yy_current_state;
 
776
        register char *yy_cp, *yy_bp;
 
777
        register int yy_act;
 
778
    
 
779
#line 119 "./load_snmp_users_file.l"
 
780
 
 
781
 
 
782
#line 783 "load_snmp_users_file.c"
 
783
 
 
784
        if ( (yy_init) )
 
785
                {
 
786
                (yy_init) = 0;
 
787
 
 
788
#ifdef YY_USER_INIT
 
789
                YY_USER_INIT;
 
790
#endif
 
791
 
 
792
                if ( ! (yy_start) )
 
793
                        (yy_start) = 1; /* first start state */
 
794
 
 
795
                if ( ! Snmp_UE_file_in )
 
796
                        Snmp_UE_file_in = stdin;
 
797
 
 
798
                if ( ! Snmp_UE_file_out )
 
799
                        Snmp_UE_file_out = stdout;
 
800
 
 
801
                if ( ! YY_CURRENT_BUFFER ) {
 
802
                        Snmp_UE_file_ensure_buffer_stack ();
 
803
                        YY_CURRENT_BUFFER_LVALUE =
 
804
                                Snmp_UE_file__create_buffer(Snmp_UE_file_in,YY_BUF_SIZE );
 
805
                }
 
806
 
 
807
                Snmp_UE_file__load_buffer_state( );
 
808
                }
 
809
 
 
810
        while ( 1 )             /* loops until end-of-file is reached */
 
811
                {
 
812
                yy_cp = (yy_c_buf_p);
 
813
 
 
814
                /* Support of Snmp_UE_file_text. */
 
815
                *yy_cp = (yy_hold_char);
 
816
 
 
817
                /* yy_bp points to the position in yy_ch_buf of the start of
 
818
                 * the current run.
 
819
                 */
 
820
                yy_bp = yy_cp;
 
821
 
 
822
                yy_current_state = (yy_start);
 
823
yy_match:
 
824
                do
 
825
                        {
 
826
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
 
827
                        if ( yy_accept[yy_current_state] )
 
828
                                {
 
829
                                (yy_last_accepting_state) = yy_current_state;
 
830
                                (yy_last_accepting_cpos) = yy_cp;
 
831
                                }
 
832
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
833
                                {
 
834
                                yy_current_state = (int) yy_def[yy_current_state];
 
835
                                if ( yy_current_state >= 102 )
 
836
                                        yy_c = yy_meta[(unsigned int) yy_c];
 
837
                                }
 
838
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
839
                        ++yy_cp;
 
840
                        }
 
841
                while ( yy_current_state != 101 );
 
842
                yy_cp = (yy_last_accepting_cpos);
 
843
                yy_current_state = (yy_last_accepting_state);
 
844
 
 
845
yy_find_action:
 
846
                yy_act = yy_accept[yy_current_state];
 
847
 
 
848
                YY_DO_BEFORE_ACTION;
 
849
 
 
850
do_action:      /* This label is used only to access EOF actions. */
 
851
 
 
852
                switch ( yy_act )
 
853
        { /* beginning of action switch */
 
854
                        case 0: /* must back up */
 
855
                        /* undo the effects of YY_DO_BEFORE_ACTION */
 
856
                        *yy_cp = (yy_hold_char);
 
857
                        yy_cp = (yy_last_accepting_cpos);
 
858
                        yy_current_state = (yy_last_accepting_state);
 
859
                        goto yy_find_action;
 
860
 
 
861
case 1:
 
862
YY_RULE_SETUP
 
863
#line 121 "./load_snmp_users_file.l"
 
864
;
 
865
        YY_BREAK
 
866
case 2:
 
867
/* rule 2 can match eol */
 
868
YY_RULE_SETUP
 
869
#line 122 "./load_snmp_users_file.l"
 
870
{ START_LINE(); }
 
871
        YY_BREAK
 
872
case 3:
 
873
/* rule 3 can match eol */
 
874
YY_RULE_SETUP
 
875
#line 124 "./load_snmp_users_file.l"
 
876
{ START_LINE(); }
 
877
        YY_BREAK
 
878
case 4:
 
879
/* rule 4 can match eol */
 
880
YY_RULE_SETUP
 
881
#line 125 "./load_snmp_users_file.l"
 
882
{ START_LINE(); }
 
883
        YY_BREAK
 
884
case 5:
 
885
/* rule 5 can match eol */
 
886
YY_RULE_SETUP
 
887
#line 127 "./load_snmp_users_file.l"
 
888
{ engine = undquote(Snmp_UE_file_text, Snmp_UE_file_leng, &engine_len); BEGIN STOP_ENGINE; }
 
889
        YY_BREAK
 
890
case 6:
 
891
YY_RULE_SETUP
 
892
#line 128 "./load_snmp_users_file.l"
 
893
{ engine = unhexbytes(Snmp_UE_file_text, Snmp_UE_file_leng, &engine_len); BEGIN STOP_ENGINE; }
 
894
        YY_BREAK
 
895
case 7:
 
896
YY_RULE_SETUP
 
897
#line 129 "./load_snmp_users_file.l"
 
898
{ engine =  NULL; engine_len = 0; BEGIN STOP_ENGINE; }
 
899
        YY_BREAK
 
900
case 8:
 
901
YY_RULE_SETUP
 
902
#line 130 "./load_snmp_users_file.l"
 
903
{ ERR("Invalid engineId"); }
 
904
        YY_BREAK
 
905
case 9:
 
906
YY_RULE_SETUP
 
907
#line 132 "./load_snmp_users_file.l"
 
908
{ BEGIN START_USER; }
 
909
        YY_BREAK
 
910
case 10:
 
911
/* rule 10 can match eol */
 
912
YY_RULE_SETUP
 
913
#line 134 "./load_snmp_users_file.l"
 
914
{ user = undquote(Snmp_UE_file_text, Snmp_UE_file_leng,&user_len); BEGIN STOP_USER; }
 
915
        YY_BREAK
 
916
case 11:
 
917
YY_RULE_SETUP
 
918
#line 135 "./load_snmp_users_file.l"
 
919
{ user = unhexbytes(Snmp_UE_file_text, Snmp_UE_file_leng, &user_len); BEGIN STOP_USER; }
 
920
        YY_BREAK
 
921
case 12:
 
922
YY_RULE_SETUP
 
923
#line 136 "./load_snmp_users_file.l"
 
924
{ ERR("Invalid userName"); }
 
925
        YY_BREAK
 
926
case 13:
 
927
YY_RULE_SETUP
 
928
#line 138 "./load_snmp_users_file.l"
 
929
{ BEGIN START_AUTHPASSWORD; }
 
930
        YY_BREAK
 
931
case 14:
 
932
/* rule 14 can match eol */
 
933
YY_RULE_SETUP
 
934
#line 140 "./load_snmp_users_file.l"
 
935
{ auth_password = undquote(Snmp_UE_file_text, Snmp_UE_file_leng, &auth_password_len); BEGIN STOP_AUTHPASSWORD; }
 
936
        YY_BREAK
 
937
case 15:
 
938
YY_RULE_SETUP
 
939
#line 141 "./load_snmp_users_file.l"
 
940
{ auth_password = unhexbytes(Snmp_UE_file_text, Snmp_UE_file_leng, &auth_password_len); BEGIN STOP_AUTHPASSWORD; }
 
941
        YY_BREAK
 
942
case 16:
 
943
YY_RULE_SETUP
 
944
#line 142 "./load_snmp_users_file.l"
 
945
{ ERR("Invalid authPassword"); }
 
946
        YY_BREAK
 
947
case 17:
 
948
YY_RULE_SETUP
 
949
#line 144 "./load_snmp_users_file.l"
 
950
{ BEGIN START_PRIVPASSWORD; }
 
951
        YY_BREAK
 
952
case 18:
 
953
/* rule 18 can match eol */
 
954
YY_RULE_SETUP
 
955
#line 146 "./load_snmp_users_file.l"
 
956
{ priv_password = undquote(Snmp_UE_file_text, Snmp_UE_file_leng, &priv_password_len); BEGIN STOP_PRIVPASSWORD; }
 
957
        YY_BREAK
 
958
case 19:
 
959
YY_RULE_SETUP
 
960
#line 147 "./load_snmp_users_file.l"
 
961
{ priv_password = unhexbytes(Snmp_UE_file_text, Snmp_UE_file_leng, &priv_password_len); BEGIN STOP_PRIVPASSWORD; }
 
962
        YY_BREAK
 
963
case 20:
 
964
YY_RULE_SETUP
 
965
#line 148 "./load_snmp_users_file.l"
 
966
{ ERR("Invalid privPassword"); }
 
967
        YY_BREAK
 
968
case 21:
 
969
YY_RULE_SETUP
 
970
#line 150 "./load_snmp_users_file.l"
 
971
{ BEGIN ATTRIBUTES; }
 
972
        YY_BREAK
 
973
case 22:
 
974
/* rule 22 can match eol */
 
975
YY_RULE_SETUP
 
976
#line 151 "./load_snmp_users_file.l"
 
977
{ add_engine(); START_LINE(); }
 
978
        YY_BREAK
 
979
case 23:
 
980
YY_RULE_SETUP
 
981
#line 153 "./load_snmp_users_file.l"
 
982
;
 
983
        YY_BREAK
 
984
case 24:
 
985
YY_RULE_SETUP
 
986
#line 154 "./load_snmp_users_file.l"
 
987
{ auth = AUTH_MD5; }
 
988
        YY_BREAK
 
989
case 25:
 
990
YY_RULE_SETUP
 
991
#line 155 "./load_snmp_users_file.l"
 
992
{ auth = AUTH_SHA; }
 
993
        YY_BREAK
 
994
case 26:
 
995
YY_RULE_SETUP
 
996
#line 156 "./load_snmp_users_file.l"
 
997
{ enc = PRIV_DES; }
 
998
        YY_BREAK
 
999
case 27:
 
1000
YY_RULE_SETUP
 
1001
#line 157 "./load_snmp_users_file.l"
 
1002
{ enc = PRIV_AES; }
 
1003
        YY_BREAK
 
1004
case 28:
 
1005
/* rule 28 can match eol */
 
1006
YY_RULE_SETUP
 
1007
#line 158 "./load_snmp_users_file.l"
 
1008
{ add_engine(); START_LINE(); }
 
1009
        YY_BREAK
 
1010
case 29:
 
1011
YY_RULE_SETUP
 
1012
#line 159 "./load_snmp_users_file.l"
 
1013
{ ERR("Invalid char in attributes"); }
 
1014
        YY_BREAK
 
1015
case 30:
 
1016
YY_RULE_SETUP
 
1017
#line 161 "./load_snmp_users_file.l"
 
1018
ECHO;
 
1019
        YY_BREAK
 
1020
#line 1021 "load_snmp_users_file.c"
 
1021
case YY_STATE_EOF(INITIAL):
 
1022
case YY_STATE_EOF(START_ENGINE):
 
1023
case YY_STATE_EOF(STOP_ENGINE):
 
1024
case YY_STATE_EOF(START_USER):
 
1025
case YY_STATE_EOF(STOP_USER):
 
1026
case YY_STATE_EOF(START_AUTHPASSWORD):
 
1027
case YY_STATE_EOF(STOP_AUTHPASSWORD):
 
1028
case YY_STATE_EOF(START_PRIVPASSWORD):
 
1029
case YY_STATE_EOF(STOP_PRIVPASSWORD):
 
1030
case YY_STATE_EOF(ATTRIBUTES):
 
1031
case YY_STATE_EOF(ERRORED):
 
1032
        yyterminate();
 
1033
 
 
1034
        case YY_END_OF_BUFFER:
 
1035
                {
 
1036
                /* Amount of text matched not including the EOB char. */
 
1037
                int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
 
1038
 
 
1039
                /* Undo the effects of YY_DO_BEFORE_ACTION. */
 
1040
                *yy_cp = (yy_hold_char);
 
1041
                YY_RESTORE_YY_MORE_OFFSET
 
1042
 
 
1043
                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
 
1044
                        {
 
1045
                        /* We're scanning a new file or input source.  It's
 
1046
                         * possible that this happened because the user
 
1047
                         * just pointed Snmp_UE_file_in at a new source and called
 
1048
                         * Snmp_UE_file_lex().  If so, then we have to assure
 
1049
                         * consistency between YY_CURRENT_BUFFER and our
 
1050
                         * globals.  Here is the right place to do so, because
 
1051
                         * this is the first action (other than possibly a
 
1052
                         * back-up) that will match for the new input source.
 
1053
                         */
 
1054
                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 
1055
                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = Snmp_UE_file_in;
 
1056
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
 
1057
                        }
 
1058
 
 
1059
                /* Note that here we test for yy_c_buf_p "<=" to the position
 
1060
                 * of the first EOB in the buffer, since yy_c_buf_p will
 
1061
                 * already have been incremented past the NUL character
 
1062
                 * (since all states make transitions on EOB to the
 
1063
                 * end-of-buffer state).  Contrast this with the test
 
1064
                 * in input().
 
1065
                 */
 
1066
                if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
 
1067
                        { /* This was really a NUL. */
 
1068
                        yy_state_type yy_next_state;
 
1069
 
 
1070
                        (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
 
1071
 
 
1072
                        yy_current_state = yy_get_previous_state(  );
 
1073
 
 
1074
                        /* Okay, we're now positioned to make the NUL
 
1075
                         * transition.  We couldn't have
 
1076
                         * yy_get_previous_state() go ahead and do it
 
1077
                         * for us because it doesn't know how to deal
 
1078
                         * with the possibility of jamming (and we don't
 
1079
                         * want to build jamming into it because then it
 
1080
                         * will run more slowly).
 
1081
                         */
 
1082
 
 
1083
                        yy_next_state = yy_try_NUL_trans( yy_current_state );
 
1084
 
 
1085
                        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
1086
 
 
1087
                        if ( yy_next_state )
 
1088
                                {
 
1089
                                /* Consume the NUL. */
 
1090
                                yy_cp = ++(yy_c_buf_p);
 
1091
                                yy_current_state = yy_next_state;
 
1092
                                goto yy_match;
 
1093
                                }
 
1094
 
 
1095
                        else
 
1096
                                {
 
1097
                                yy_cp = (yy_last_accepting_cpos);
 
1098
                                yy_current_state = (yy_last_accepting_state);
 
1099
                                goto yy_find_action;
 
1100
                                }
 
1101
                        }
 
1102
 
 
1103
                else switch ( yy_get_next_buffer(  ) )
 
1104
                        {
 
1105
                        case EOB_ACT_END_OF_FILE:
 
1106
                                {
 
1107
                                (yy_did_buffer_switch_on_eof) = 0;
 
1108
 
 
1109
                                if ( Snmp_UE_file_wrap( ) )
 
1110
                                        {
 
1111
                                        /* Note: because we've taken care in
 
1112
                                         * yy_get_next_buffer() to have set up
 
1113
                                         * Snmp_UE_file_text, we can now set up
 
1114
                                         * yy_c_buf_p so that if some total
 
1115
                                         * hoser (like flex itself) wants to
 
1116
                                         * call the scanner after we return the
 
1117
                                         * YY_NULL, it'll still work - another
 
1118
                                         * YY_NULL will get returned.
 
1119
                                         */
 
1120
                                        (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
 
1121
 
 
1122
                                        yy_act = YY_STATE_EOF(YY_START);
 
1123
                                        goto do_action;
 
1124
                                        }
 
1125
 
 
1126
                                else
 
1127
                                        {
 
1128
                                        if ( ! (yy_did_buffer_switch_on_eof) )
 
1129
                                                YY_NEW_FILE;
 
1130
                                        }
 
1131
                                break;
 
1132
                                }
 
1133
 
 
1134
                        case EOB_ACT_CONTINUE_SCAN:
 
1135
                                (yy_c_buf_p) =
 
1136
                                        (yytext_ptr) + yy_amount_of_matched_text;
 
1137
 
 
1138
                                yy_current_state = yy_get_previous_state(  );
 
1139
 
 
1140
                                yy_cp = (yy_c_buf_p);
 
1141
                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
1142
                                goto yy_match;
 
1143
 
 
1144
                        case EOB_ACT_LAST_MATCH:
 
1145
                                (yy_c_buf_p) =
 
1146
                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
 
1147
 
 
1148
                                yy_current_state = yy_get_previous_state(  );
 
1149
 
 
1150
                                yy_cp = (yy_c_buf_p);
 
1151
                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
1152
                                goto yy_find_action;
 
1153
                        }
 
1154
                break;
 
1155
                }
 
1156
 
 
1157
        default:
 
1158
                YY_FATAL_ERROR(
 
1159
                        "fatal flex scanner internal error--no action found" );
 
1160
        } /* end of action switch */
 
1161
                } /* end of scanning one token */
 
1162
} /* end of Snmp_UE_file_lex */
 
1163
 
 
1164
/* yy_get_next_buffer - try to read in a new buffer
 
1165
 *
 
1166
 * Returns a code representing an action:
 
1167
 *      EOB_ACT_LAST_MATCH -
 
1168
 *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 
1169
 *      EOB_ACT_END_OF_FILE - end of file
 
1170
 */
 
1171
static int yy_get_next_buffer (void)
 
1172
{
 
1173
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 
1174
        register char *source = (yytext_ptr);
 
1175
        register int number_to_move, i;
 
1176
        int ret_val;
 
1177
 
 
1178
        if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 
1179
                YY_FATAL_ERROR(
 
1180
                "fatal flex scanner internal error--end of buffer missed" );
 
1181
 
 
1182
        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 
1183
                { /* Don't try to fill the buffer, so this is an EOF. */
 
1184
                if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 
1185
                        {
 
1186
                        /* We matched a single character, the EOB, so
 
1187
                         * treat this as a final EOF.
 
1188
                         */
 
1189
                        return EOB_ACT_END_OF_FILE;
 
1190
                        }
 
1191
 
 
1192
                else
 
1193
                        {
 
1194
                        /* We matched some text prior to the EOB, first
 
1195
                         * process it.
 
1196
                         */
 
1197
                        return EOB_ACT_LAST_MATCH;
 
1198
                        }
 
1199
                }
 
1200
 
 
1201
        /* Try to read more data. */
 
1202
 
 
1203
        /* First move last chars to start of buffer. */
 
1204
        number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 
1205
 
 
1206
        for ( i = 0; i < number_to_move; ++i )
 
1207
                *(dest++) = *(source++);
 
1208
 
 
1209
        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 
1210
                /* don't do the read, it's not guaranteed to return an EOF,
 
1211
                 * just force an EOF
 
1212
                 */
 
1213
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 
1214
 
 
1215
        else
 
1216
                {
 
1217
                        int num_to_read =
 
1218
                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
1219
 
 
1220
                while ( num_to_read <= 0 )
 
1221
                        { /* Not enough room in the buffer - grow it. */
 
1222
 
 
1223
                        /* just a shorter name for the current buffer */
 
1224
                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 
1225
 
 
1226
                        int yy_c_buf_p_offset =
 
1227
                                (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
1228
 
 
1229
                        if ( b->yy_is_our_buffer )
 
1230
                                {
 
1231
                                int new_size = b->yy_buf_size * 2;
 
1232
 
 
1233
                                if ( new_size <= 0 )
 
1234
                                        b->yy_buf_size += b->yy_buf_size / 8;
 
1235
                                else
 
1236
                                        b->yy_buf_size *= 2;
 
1237
 
 
1238
                                b->yy_ch_buf = (char *)
 
1239
                                        /* Include room in for 2 EOB chars. */
 
1240
                                        Snmp_UE_file_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
 
1241
                                }
 
1242
                        else
 
1243
                                /* Can't grow it, we don't own it. */
 
1244
                                b->yy_ch_buf = 0;
 
1245
 
 
1246
                        if ( ! b->yy_ch_buf )
 
1247
                                YY_FATAL_ERROR(
 
1248
                                "fatal error - scanner input buffer overflow" );
 
1249
 
 
1250
                        (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
 
1251
 
 
1252
                        num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
 
1253
                                                number_to_move - 1;
 
1254
 
 
1255
                        }
 
1256
 
 
1257
                if ( num_to_read > YY_READ_BUF_SIZE )
 
1258
                        num_to_read = YY_READ_BUF_SIZE;
 
1259
 
 
1260
                /* Read in more data. */
 
1261
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
 
1262
                        (yy_n_chars), num_to_read );
 
1263
 
 
1264
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
1265
                }
 
1266
 
 
1267
        if ( (yy_n_chars) == 0 )
 
1268
                {
 
1269
                if ( number_to_move == YY_MORE_ADJ )
 
1270
                        {
 
1271
                        ret_val = EOB_ACT_END_OF_FILE;
 
1272
                        Snmp_UE_file_restart(Snmp_UE_file_in  );
 
1273
                        }
 
1274
 
 
1275
                else
 
1276
                        {
 
1277
                        ret_val = EOB_ACT_LAST_MATCH;
 
1278
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
 
1279
                                YY_BUFFER_EOF_PENDING;
 
1280
                        }
 
1281
                }
 
1282
 
 
1283
        else
 
1284
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
1285
 
 
1286
        (yy_n_chars) += number_to_move;
 
1287
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
 
1288
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
 
1289
 
 
1290
        (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
 
1291
 
 
1292
        return ret_val;
 
1293
}
 
1294
 
 
1295
/* yy_get_previous_state - get the state just before the EOB char was reached */
 
1296
 
 
1297
    static yy_state_type yy_get_previous_state (void)
 
1298
{
 
1299
        register yy_state_type yy_current_state;
 
1300
        register char *yy_cp;
 
1301
    
 
1302
        yy_current_state = (yy_start);
 
1303
 
 
1304
        for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
 
1305
                {
 
1306
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
 
1307
                if ( yy_accept[yy_current_state] )
 
1308
                        {
 
1309
                        (yy_last_accepting_state) = yy_current_state;
 
1310
                        (yy_last_accepting_cpos) = yy_cp;
 
1311
                        }
 
1312
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
1313
                        {
 
1314
                        yy_current_state = (int) yy_def[yy_current_state];
 
1315
                        if ( yy_current_state >= 102 )
 
1316
                                yy_c = yy_meta[(unsigned int) yy_c];
 
1317
                        }
 
1318
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1319
                }
 
1320
 
 
1321
        return yy_current_state;
 
1322
}
 
1323
 
 
1324
/* yy_try_NUL_trans - try to make a transition on the NUL character
 
1325
 *
 
1326
 * synopsis
 
1327
 *      next_state = yy_try_NUL_trans( current_state );
 
1328
 */
 
1329
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 
1330
{
 
1331
        register int yy_is_jam;
 
1332
        register char *yy_cp = (yy_c_buf_p);
 
1333
 
 
1334
        register YY_CHAR yy_c = 1;
 
1335
        if ( yy_accept[yy_current_state] )
 
1336
                {
 
1337
                (yy_last_accepting_state) = yy_current_state;
 
1338
                (yy_last_accepting_cpos) = yy_cp;
 
1339
                }
 
1340
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
1341
                {
 
1342
                yy_current_state = (int) yy_def[yy_current_state];
 
1343
                if ( yy_current_state >= 102 )
 
1344
                        yy_c = yy_meta[(unsigned int) yy_c];
 
1345
                }
 
1346
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1347
        yy_is_jam = (yy_current_state == 101);
 
1348
 
 
1349
        return yy_is_jam ? 0 : yy_current_state;
 
1350
}
 
1351
 
 
1352
#ifndef YY_NO_INPUT
 
1353
#ifdef __cplusplus
 
1354
    static int yyinput (void)
 
1355
#else
 
1356
    static int input  (void)
 
1357
#endif
 
1358
 
 
1359
{
 
1360
        int c;
 
1361
    
 
1362
        *(yy_c_buf_p) = (yy_hold_char);
 
1363
 
 
1364
        if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
 
1365
                {
 
1366
                /* yy_c_buf_p now points to the character we want to return.
 
1367
                 * If this occurs *before* the EOB characters, then it's a
 
1368
                 * valid NUL; if not, then we've hit the end of the buffer.
 
1369
                 */
 
1370
                if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
 
1371
                        /* This was really a NUL. */
 
1372
                        *(yy_c_buf_p) = '\0';
 
1373
 
 
1374
                else
 
1375
                        { /* need more input */
 
1376
                        int offset = (yy_c_buf_p) - (yytext_ptr);
 
1377
                        ++(yy_c_buf_p);
 
1378
 
 
1379
                        switch ( yy_get_next_buffer(  ) )
 
1380
                                {
 
1381
                                case EOB_ACT_LAST_MATCH:
 
1382
                                        /* This happens because yy_g_n_b()
 
1383
                                         * sees that we've accumulated a
 
1384
                                         * token and flags that we need to
 
1385
                                         * try matching the token before
 
1386
                                         * proceeding.  But for input(),
 
1387
                                         * there's no matching to consider.
 
1388
                                         * So convert the EOB_ACT_LAST_MATCH
 
1389
                                         * to EOB_ACT_END_OF_FILE.
 
1390
                                         */
 
1391
 
 
1392
                                        /* Reset buffer status. */
 
1393
                                        Snmp_UE_file_restart(Snmp_UE_file_in );
 
1394
 
 
1395
                                        /*FALLTHROUGH*/
 
1396
 
 
1397
                                case EOB_ACT_END_OF_FILE:
 
1398
                                        {
 
1399
                                        if ( Snmp_UE_file_wrap( ) )
 
1400
                                                return EOF;
 
1401
 
 
1402
                                        if ( ! (yy_did_buffer_switch_on_eof) )
 
1403
                                                YY_NEW_FILE;
 
1404
#ifdef __cplusplus
 
1405
                                        return yyinput();
 
1406
#else
 
1407
                                        return input();
 
1408
#endif
 
1409
                                        }
 
1410
 
 
1411
                                case EOB_ACT_CONTINUE_SCAN:
 
1412
                                        (yy_c_buf_p) = (yytext_ptr) + offset;
 
1413
                                        break;
 
1414
                                }
 
1415
                        }
 
1416
                }
 
1417
 
 
1418
        c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
 
1419
        *(yy_c_buf_p) = '\0';   /* preserve Snmp_UE_file_text */
 
1420
        (yy_hold_char) = *++(yy_c_buf_p);
 
1421
 
 
1422
        return c;
 
1423
}
 
1424
#endif  /* ifndef YY_NO_INPUT */
 
1425
 
 
1426
/** Immediately switch to a different input stream.
 
1427
 * @param input_file A readable stream.
 
1428
 * 
 
1429
 * @note This function does not reset the start condition to @c INITIAL .
 
1430
 */
 
1431
    void Snmp_UE_file_restart  (FILE * input_file )
 
1432
{
 
1433
    
 
1434
        if ( ! YY_CURRENT_BUFFER ){
 
1435
        Snmp_UE_file_ensure_buffer_stack ();
 
1436
                YY_CURRENT_BUFFER_LVALUE =
 
1437
            Snmp_UE_file__create_buffer(Snmp_UE_file_in,YY_BUF_SIZE );
 
1438
        }
 
1439
 
 
1440
        Snmp_UE_file__init_buffer(YY_CURRENT_BUFFER,input_file );
 
1441
        Snmp_UE_file__load_buffer_state( );
 
1442
}
 
1443
 
 
1444
/** Switch to a different input buffer.
 
1445
 * @param new_buffer The new input buffer.
 
1446
 * 
 
1447
 */
 
1448
    void Snmp_UE_file__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
 
1449
{
 
1450
    
 
1451
        /* TODO. We should be able to replace this entire function body
 
1452
         * with
 
1453
         *              Snmp_UE_file_pop_buffer_state();
 
1454
         *              Snmp_UE_file_push_buffer_state(new_buffer);
 
1455
     */
 
1456
        Snmp_UE_file_ensure_buffer_stack ();
 
1457
        if ( YY_CURRENT_BUFFER == new_buffer )
 
1458
                return;
 
1459
 
 
1460
        if ( YY_CURRENT_BUFFER )
 
1461
                {
 
1462
                /* Flush out information for old buffer. */
 
1463
                *(yy_c_buf_p) = (yy_hold_char);
 
1464
                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
 
1465
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
1466
                }
 
1467
 
 
1468
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
1469
        Snmp_UE_file__load_buffer_state( );
 
1470
 
 
1471
        /* We don't actually know whether we did this switch during
 
1472
         * EOF (Snmp_UE_file_wrap()) processing, but the only time this flag
 
1473
         * is looked at is after Snmp_UE_file_wrap() is called, so it's safe
 
1474
         * to go ahead and always set it.
 
1475
         */
 
1476
        (yy_did_buffer_switch_on_eof) = 1;
 
1477
}
 
1478
 
 
1479
static void Snmp_UE_file__load_buffer_state  (void)
 
1480
{
 
1481
        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 
1482
        (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
 
1483
        Snmp_UE_file_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
 
1484
        (yy_hold_char) = *(yy_c_buf_p);
 
1485
}
 
1486
 
 
1487
/** Allocate and initialize an input buffer state.
 
1488
 * @param file A readable stream.
 
1489
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 
1490
 * 
 
1491
 * @return the allocated buffer state.
 
1492
 */
 
1493
    YY_BUFFER_STATE Snmp_UE_file__create_buffer  (FILE * file, int  size )
 
1494
{
 
1495
        YY_BUFFER_STATE b;
 
1496
    
 
1497
        b = (YY_BUFFER_STATE) Snmp_UE_file_alloc(sizeof( struct yy_buffer_state )  );
 
1498
        if ( ! b )
 
1499
                YY_FATAL_ERROR( "out of dynamic memory in Snmp_UE_file__create_buffer()" );
 
1500
 
 
1501
        b->yy_buf_size = size;
 
1502
 
 
1503
        /* yy_ch_buf has to be 2 characters longer than the size given because
 
1504
         * we need to put in 2 end-of-buffer characters.
 
1505
         */
 
1506
        b->yy_ch_buf = (char *) Snmp_UE_file_alloc(b->yy_buf_size + 2  );
 
1507
        if ( ! b->yy_ch_buf )
 
1508
                YY_FATAL_ERROR( "out of dynamic memory in Snmp_UE_file__create_buffer()" );
 
1509
 
 
1510
        b->yy_is_our_buffer = 1;
 
1511
 
 
1512
        Snmp_UE_file__init_buffer(b,file );
 
1513
 
 
1514
        return b;
 
1515
}
 
1516
 
 
1517
/** Destroy the buffer.
 
1518
 * @param b a buffer created with Snmp_UE_file__create_buffer()
 
1519
 * 
 
1520
 */
 
1521
    void Snmp_UE_file__delete_buffer (YY_BUFFER_STATE  b )
 
1522
{
 
1523
    
 
1524
        if ( ! b )
 
1525
                return;
 
1526
 
 
1527
        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
 
1528
                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
1529
 
 
1530
        if ( b->yy_is_our_buffer )
 
1531
                Snmp_UE_file_free((void *) b->yy_ch_buf  );
 
1532
 
 
1533
        Snmp_UE_file_free((void *) b  );
 
1534
}
 
1535
 
 
1536
/* Initializes or reinitializes a buffer.
 
1537
 * This function is sometimes called more than once on the same buffer,
 
1538
 * such as during a Snmp_UE_file_restart() or at EOF.
 
1539
 */
 
1540
    static void Snmp_UE_file__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
1541
 
 
1542
{
 
1543
        int oerrno = errno;
 
1544
    
 
1545
        Snmp_UE_file__flush_buffer(b );
 
1546
 
 
1547
        b->yy_input_file = file;
 
1548
        b->yy_fill_buffer = 1;
 
1549
 
 
1550
    /* If b is the current buffer, then Snmp_UE_file__init_buffer was _probably_
 
1551
     * called from Snmp_UE_file_restart() or through yy_get_next_buffer.
 
1552
     * In that case, we don't want to reset the lineno or column.
 
1553
     */
 
1554
    if (b != YY_CURRENT_BUFFER){
 
1555
        b->yy_bs_lineno = 1;
 
1556
        b->yy_bs_column = 0;
 
1557
    }
 
1558
 
 
1559
        b->yy_is_interactive = 0;
 
1560
    
 
1561
        errno = oerrno;
 
1562
}
 
1563
 
 
1564
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 
1565
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 
1566
 * 
 
1567
 */
 
1568
    void Snmp_UE_file__flush_buffer (YY_BUFFER_STATE  b )
 
1569
{
 
1570
        if ( ! b )
 
1571
                return;
 
1572
 
 
1573
        b->yy_n_chars = 0;
 
1574
 
 
1575
        /* We always need two end-of-buffer characters.  The first causes
 
1576
         * a transition to the end-of-buffer state.  The second causes
 
1577
         * a jam in that state.
 
1578
         */
 
1579
        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
 
1580
        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
 
1581
 
 
1582
        b->yy_buf_pos = &b->yy_ch_buf[0];
 
1583
 
 
1584
        b->yy_at_bol = 1;
 
1585
        b->yy_buffer_status = YY_BUFFER_NEW;
 
1586
 
 
1587
        if ( b == YY_CURRENT_BUFFER )
 
1588
                Snmp_UE_file__load_buffer_state( );
 
1589
}
 
1590
 
 
1591
/** Pushes the new state onto the stack. The new state becomes
 
1592
 *  the current state. This function will allocate the stack
 
1593
 *  if necessary.
 
1594
 *  @param new_buffer The new state.
 
1595
 *  
 
1596
 */
 
1597
void Snmp_UE_file_push_buffer_state (YY_BUFFER_STATE new_buffer )
 
1598
{
 
1599
        if (new_buffer == NULL)
 
1600
                return;
 
1601
 
 
1602
        Snmp_UE_file_ensure_buffer_stack();
 
1603
 
 
1604
        /* This block is copied from Snmp_UE_file__switch_to_buffer. */
 
1605
        if ( YY_CURRENT_BUFFER )
 
1606
                {
 
1607
                /* Flush out information for old buffer. */
 
1608
                *(yy_c_buf_p) = (yy_hold_char);
 
1609
                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
 
1610
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
1611
                }
 
1612
 
 
1613
        /* Only push if top exists. Otherwise, replace top. */
 
1614
        if (YY_CURRENT_BUFFER)
 
1615
                (yy_buffer_stack_top)++;
 
1616
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
1617
 
 
1618
        /* copied from Snmp_UE_file__switch_to_buffer. */
 
1619
        Snmp_UE_file__load_buffer_state( );
 
1620
        (yy_did_buffer_switch_on_eof) = 1;
 
1621
}
 
1622
 
 
1623
/** Removes and deletes the top of the stack, if present.
 
1624
 *  The next element becomes the new top.
 
1625
 *  
 
1626
 */
 
1627
void Snmp_UE_file_pop_buffer_state (void)
 
1628
{
 
1629
        if (!YY_CURRENT_BUFFER)
 
1630
                return;
 
1631
 
 
1632
        Snmp_UE_file__delete_buffer(YY_CURRENT_BUFFER );
 
1633
        YY_CURRENT_BUFFER_LVALUE = NULL;
 
1634
        if ((yy_buffer_stack_top) > 0)
 
1635
                --(yy_buffer_stack_top);
 
1636
 
 
1637
        if (YY_CURRENT_BUFFER) {
 
1638
                Snmp_UE_file__load_buffer_state( );
 
1639
                (yy_did_buffer_switch_on_eof) = 1;
 
1640
        }
 
1641
}
 
1642
 
 
1643
/* Allocates the stack if it does not exist.
 
1644
 *  Guarantees space for at least one push.
 
1645
 */
 
1646
static void Snmp_UE_file_ensure_buffer_stack (void)
 
1647
{
 
1648
        int num_to_alloc;
 
1649
    
 
1650
        if (!(yy_buffer_stack)) {
 
1651
 
 
1652
                /* First allocation is just for 2 elements, since we don't know if this
 
1653
                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
 
1654
                 * immediate realloc on the next call.
 
1655
         */
 
1656
                num_to_alloc = 1;
 
1657
                (yy_buffer_stack) = (struct yy_buffer_state**)Snmp_UE_file_alloc
 
1658
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
 
1659
                                                                );
 
1660
                
 
1661
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 
1662
                                
 
1663
                (yy_buffer_stack_max) = num_to_alloc;
 
1664
                (yy_buffer_stack_top) = 0;
 
1665
                return;
 
1666
        }
 
1667
 
 
1668
        if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 
1669
 
 
1670
                /* Increase the buffer to prepare for a possible push. */
 
1671
                int grow_size = 8 /* arbitrary grow size */;
 
1672
 
 
1673
                num_to_alloc = (yy_buffer_stack_max) + grow_size;
 
1674
                (yy_buffer_stack) = (struct yy_buffer_state**)Snmp_UE_file_realloc
 
1675
                                                                ((yy_buffer_stack),
 
1676
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
 
1677
                                                                );
 
1678
 
 
1679
                /* zero only the new slots.*/
 
1680
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
 
1681
                (yy_buffer_stack_max) = num_to_alloc;
 
1682
        }
 
1683
}
 
1684
 
 
1685
/** Setup the input buffer state to scan directly from a user-specified character buffer.
 
1686
 * @param base the character buffer
 
1687
 * @param size the size in bytes of the character buffer
 
1688
 * 
 
1689
 * @return the newly allocated buffer state object. 
 
1690
 */
 
1691
YY_BUFFER_STATE Snmp_UE_file__scan_buffer  (char * base, yy_size_t  size )
 
1692
{
 
1693
        YY_BUFFER_STATE b;
 
1694
    
 
1695
        if ( size < 2 ||
 
1696
             base[size-2] != YY_END_OF_BUFFER_CHAR ||
 
1697
             base[size-1] != YY_END_OF_BUFFER_CHAR )
 
1698
                /* They forgot to leave room for the EOB's. */
 
1699
                return 0;
 
1700
 
 
1701
        b = (YY_BUFFER_STATE) Snmp_UE_file_alloc(sizeof( struct yy_buffer_state )  );
 
1702
        if ( ! b )
 
1703
                YY_FATAL_ERROR( "out of dynamic memory in Snmp_UE_file__scan_buffer()" );
 
1704
 
 
1705
        b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
 
1706
        b->yy_buf_pos = b->yy_ch_buf = base;
 
1707
        b->yy_is_our_buffer = 0;
 
1708
        b->yy_input_file = 0;
 
1709
        b->yy_n_chars = b->yy_buf_size;
 
1710
        b->yy_is_interactive = 0;
 
1711
        b->yy_at_bol = 1;
 
1712
        b->yy_fill_buffer = 0;
 
1713
        b->yy_buffer_status = YY_BUFFER_NEW;
 
1714
 
 
1715
        Snmp_UE_file__switch_to_buffer(b  );
 
1716
 
 
1717
        return b;
 
1718
}
 
1719
 
 
1720
/** Setup the input buffer state to scan a string. The next call to Snmp_UE_file_lex() will
 
1721
 * scan from a @e copy of @a str.
 
1722
 * @param str a NUL-terminated string to scan
 
1723
 * 
 
1724
 * @return the newly allocated buffer state object.
 
1725
 * @note If you want to scan bytes that may contain NUL values, then use
 
1726
 *       Snmp_UE_file__scan_bytes() instead.
 
1727
 */
 
1728
YY_BUFFER_STATE Snmp_UE_file__scan_string (yyconst char * yy_str )
 
1729
{
 
1730
    
 
1731
        return Snmp_UE_file__scan_bytes(yy_str,strlen(yy_str) );
 
1732
}
 
1733
 
 
1734
/** Setup the input buffer state to scan the given bytes. The next call to Snmp_UE_file_lex() will
 
1735
 * scan from a @e copy of @a bytes.
 
1736
 * @param bytes the byte buffer to scan
 
1737
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 
1738
 * 
 
1739
 * @return the newly allocated buffer state object.
 
1740
 */
 
1741
YY_BUFFER_STATE Snmp_UE_file__scan_bytes  (yyconst char * bytes, int  len )
 
1742
{
 
1743
        YY_BUFFER_STATE b;
 
1744
        char *buf;
 
1745
        yy_size_t n;
 
1746
        int i;
 
1747
    
 
1748
        /* Get memory for full buffer, including space for trailing EOB's. */
 
1749
        n = len + 2;
 
1750
        buf = (char *) Snmp_UE_file_alloc(n  );
 
1751
        if ( ! buf )
 
1752
                YY_FATAL_ERROR( "out of dynamic memory in Snmp_UE_file__scan_bytes()" );
 
1753
 
 
1754
        for ( i = 0; i < len; ++i )
 
1755
                buf[i] = bytes[i];
 
1756
 
 
1757
        buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
 
1758
 
 
1759
        b = Snmp_UE_file__scan_buffer(buf,n );
 
1760
        if ( ! b )
 
1761
                YY_FATAL_ERROR( "bad buffer in Snmp_UE_file__scan_bytes()" );
 
1762
 
 
1763
        /* It's okay to grow etc. this buffer, and we should throw it
 
1764
         * away when we're done.
 
1765
         */
 
1766
        b->yy_is_our_buffer = 1;
 
1767
 
 
1768
        return b;
 
1769
}
 
1770
 
 
1771
#ifndef YY_EXIT_FAILURE
 
1772
#define YY_EXIT_FAILURE 2
 
1773
#endif
 
1774
 
 
1775
static void yy_fatal_error (yyconst char* msg )
 
1776
{
 
1777
        (void) fprintf( stderr, "%s\n", msg );
 
1778
        exit( YY_EXIT_FAILURE );
 
1779
}
 
1780
 
 
1781
/* Redefine yyless() so it works in section 3 code. */
 
1782
 
 
1783
#undef yyless
 
1784
#define yyless(n) \
 
1785
        do \
 
1786
                { \
 
1787
                /* Undo effects of setting up Snmp_UE_file_text. */ \
 
1788
        int yyless_macro_arg = (n); \
 
1789
        YY_LESS_LINENO(yyless_macro_arg);\
 
1790
                Snmp_UE_file_text[Snmp_UE_file_leng] = (yy_hold_char); \
 
1791
                (yy_c_buf_p) = Snmp_UE_file_text + yyless_macro_arg; \
 
1792
                (yy_hold_char) = *(yy_c_buf_p); \
 
1793
                *(yy_c_buf_p) = '\0'; \
 
1794
                Snmp_UE_file_leng = yyless_macro_arg; \
 
1795
                } \
 
1796
        while ( 0 )
 
1797
 
 
1798
/* Accessor  methods (get/set functions) to struct members. */
 
1799
 
 
1800
/** Get the current line number.
 
1801
 * 
 
1802
 */
 
1803
int Snmp_UE_file_get_lineno  (void)
 
1804
{
 
1805
        
 
1806
    return Snmp_UE_file_lineno;
 
1807
}
 
1808
 
 
1809
/** Get the input stream.
 
1810
 * 
 
1811
 */
 
1812
FILE *Snmp_UE_file_get_in  (void)
 
1813
{
 
1814
        return Snmp_UE_file_in;
 
1815
}
 
1816
 
 
1817
/** Get the output stream.
 
1818
 * 
 
1819
 */
 
1820
FILE *Snmp_UE_file_get_out  (void)
 
1821
{
 
1822
        return Snmp_UE_file_out;
 
1823
}
 
1824
 
 
1825
/** Get the length of the current token.
 
1826
 * 
 
1827
 */
 
1828
int Snmp_UE_file_get_leng  (void)
 
1829
{
 
1830
        return Snmp_UE_file_leng;
 
1831
}
 
1832
 
 
1833
/** Get the current token.
 
1834
 * 
 
1835
 */
 
1836
 
 
1837
char *Snmp_UE_file_get_text  (void)
 
1838
{
 
1839
        return Snmp_UE_file_text;
 
1840
}
 
1841
 
 
1842
/** Set the current line number.
 
1843
 * @param line_number
 
1844
 * 
 
1845
 */
 
1846
void Snmp_UE_file_set_lineno (int  line_number )
 
1847
{
 
1848
    
 
1849
    Snmp_UE_file_lineno = line_number;
 
1850
}
 
1851
 
 
1852
/** Set the input stream. This does not discard the current
 
1853
 * input buffer.
 
1854
 * @param in_str A readable stream.
 
1855
 * 
 
1856
 * @see Snmp_UE_file__switch_to_buffer
 
1857
 */
 
1858
void Snmp_UE_file_set_in (FILE *  in_str )
 
1859
{
 
1860
        Snmp_UE_file_in = in_str ;
 
1861
}
 
1862
 
 
1863
void Snmp_UE_file_set_out (FILE *  out_str )
 
1864
{
 
1865
        Snmp_UE_file_out = out_str ;
 
1866
}
 
1867
 
 
1868
int Snmp_UE_file_get_debug  (void)
 
1869
{
 
1870
        return Snmp_UE_file__flex_debug;
 
1871
}
 
1872
 
 
1873
void Snmp_UE_file_set_debug (int  bdebug )
 
1874
{
 
1875
        Snmp_UE_file__flex_debug = bdebug ;
 
1876
}
 
1877
 
 
1878
/* Snmp_UE_file_lex_destroy is for both reentrant and non-reentrant scanners. */
 
1879
int Snmp_UE_file_lex_destroy  (void)
 
1880
{
 
1881
    
 
1882
    /* Pop the buffer stack, destroying each element. */
 
1883
        while(YY_CURRENT_BUFFER){
 
1884
                Snmp_UE_file__delete_buffer(YY_CURRENT_BUFFER  );
 
1885
                YY_CURRENT_BUFFER_LVALUE = NULL;
 
1886
                Snmp_UE_file_pop_buffer_state();
 
1887
        }
 
1888
 
 
1889
        /* Destroy the stack itself. */
 
1890
        Snmp_UE_file_free((yy_buffer_stack) );
 
1891
        (yy_buffer_stack) = NULL;
 
1892
 
 
1893
    return 0;
 
1894
}
 
1895
 
 
1896
/*
 
1897
 * Internal utility routines.
 
1898
 */
 
1899
 
 
1900
#ifndef yytext_ptr
 
1901
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
 
1902
{
 
1903
        register int i;
 
1904
        for ( i = 0; i < n; ++i )
 
1905
                s1[i] = s2[i];
 
1906
}
 
1907
#endif
 
1908
 
 
1909
#ifdef YY_NEED_STRLEN
 
1910
static int yy_flex_strlen (yyconst char * s )
 
1911
{
 
1912
        register int n;
 
1913
        for ( n = 0; s[n]; ++n )
 
1914
                ;
 
1915
 
 
1916
        return n;
 
1917
}
 
1918
#endif
 
1919
 
 
1920
void *Snmp_UE_file_alloc (yy_size_t  size )
 
1921
{
 
1922
        return (void *) malloc( size );
 
1923
}
 
1924
 
 
1925
void *Snmp_UE_file_realloc  (void * ptr, yy_size_t  size )
 
1926
{
 
1927
        /* The cast to (char *) in the following accommodates both
 
1928
         * implementations that use char* generic pointers, and those
 
1929
         * that use void* generic pointers.  It works with the latter
 
1930
         * because both ANSI C and C++ allow castless assignment from
 
1931
         * any pointer type to void*, and deal with argument conversions
 
1932
         * as though doing an assignment.
 
1933
         */
 
1934
        return (void *) realloc( (char *) ptr, size );
 
1935
}
 
1936
 
 
1937
void Snmp_UE_file_free (void * ptr )
 
1938
{
 
1939
        free( (char *) ptr );   /* see Snmp_UE_file_realloc() for (char *) cast */
 
1940
}
 
1941
 
 
1942
#define YYTABLES_NAME "yytables"
 
1943
 
 
1944
#undef YY_NEW_FILE
 
1945
#undef YY_FLUSH_BUFFER
 
1946
#undef yy_set_bol
 
1947
#undef yy_new_buffer
 
1948
#undef yy_set_interactive
 
1949
#undef yytext_ptr
 
1950
#undef YY_DO_BEFORE_ACTION
 
1951
 
 
1952
#ifdef YY_DECL_IS_OURS
 
1953
#undef YY_DECL_IS_OURS
 
1954
#undef YY_DECL
 
1955
#endif
 
1956
#line 161 "./load_snmp_users_file.l"
 
1957
 
 
1958
 
 
1959
 
 
1960
static guint8* unhexbytes(const char* si, guint len, guint* len_p) {
 
1961
        guint8* buf;
 
1962
        guint8* p;
 
1963
        const guint8* s = (void*)si;
 
1964
        unsigned i;
 
1965
        
 
1966
        if (len % 2) {
 
1967
                ERR("Uneven number of chars hex string");
 
1968
                return NULL;
 
1969
        }
 
1970
        
 
1971
        buf = g_malloc(len);
 
1972
        p = buf;
 
1973
        
 
1974
        for (i = 0; i<len ; i += 2) {
 
1975
                guint8 lo = s[i+1];
 
1976
                guint8 hi = s[i];
 
1977
                
 
1978
                if (hi >= '0' && hi <= '9') {
 
1979
                        hi -= '0';
 
1980
                } else if (hi >= 'a' && hi <= 'f') {
 
1981
                        hi -=  'a';
 
1982
                        hi += 0xa;
 
1983
                } else if (hi >= 'A' && hi <= 'F') {
 
1984
                        hi -=  'A';
 
1985
                        hi += 0xa;
 
1986
                } else {
 
1987
                        goto on_error;
 
1988
                }
 
1989
                
 
1990
                if (lo >= '0' && lo <= '9') {
 
1991
                        lo -= '0';
 
1992
                } else if (lo >= 'a' && lo <= 'f') {
 
1993
                        lo -=  'a';
 
1994
                        lo += 0xa;
 
1995
                } else if (lo >= 'A' && lo <= 'F') {
 
1996
                        lo -=  'A';
 
1997
                        lo += 0xa;
 
1998
                } else {
 
1999
                        goto on_error;
 
2000
                }
 
2001
                
 
2002
                *(p++) = (hi*0x10) + lo;
 
2003
        }
 
2004
        
 
2005
        len /= 2;
 
2006
 
 
2007
        if (len_p) *len_p = len;
 
2008
        
 
2009
        return buf;
 
2010
 
 
2011
on_error:
 
2012
        ERR("Error parsing hex string");
 
2013
        g_free(buf);
 
2014
        return NULL;
 
2015
}
 
2016
 
 
2017
static guint8* undquote(const char* si, guint in_len, guint* len_p) {
 
2018
        guint8* buf = g_malloc(in_len); /* wastes one byte for every '\\' in text */
 
2019
        guint8* p = buf;
 
2020
        guint len = 0;
 
2021
        guint8* end = buf+in_len;
 
2022
        const guint8* s = (void*)si;
 
2023
        
 
2024
        for (s++; p < end; s++) {
 
2025
                switch(*s) {
 
2026
                        case '\0':
 
2027
                                *(p-1) = '\0';
 
2028
                                goto done;
 
2029
                        case '\\':
 
2030
                                switch(*(++s)) {
 
2031
                                        case 'a': *(p++) = '\a'; len++; break;
 
2032
                                        case 'b': *(p++) = '\b'; len++; break;
 
2033
                                        case 'e': *(p++) = '\e'; len++; break;
 
2034
                                        case 'f': *(p++) = '\f'; len++; break;
 
2035
                                        case 'n': *(p++) = '\n'; len++; break;
 
2036
                                        case 'r': *(p++) = '\r'; len++; break;
 
2037
                                        case 't': *(p++) = '\t'; len++; break;
 
2038
                                        case 'v': *(p++) = '\v'; len++; break;
 
2039
                                        case '0':
 
2040
                                        case '1': 
 
2041
                                        case '2': 
 
2042
                                        case '3': 
 
2043
                                        case '4': 
 
2044
                                        case '5': 
 
2045
                                        case '6': 
 
2046
                                        case '7': 
 
2047
                                        {
 
2048
                                                int c0 = 0;
 
2049
                                                int c1 = 0;
 
2050
                                                int c2 = 0;
 
2051
                                                int c = 0;
 
2052
                                                
 
2053
                                                c0 = (*s) - '0';
 
2054
                                                
 
2055
                                                if ( s[1] >= '0' && s[1] <= '7' ) {
 
2056
                                                        c1 = c0;
 
2057
                                                        c0 = (*++s) - '0';
 
2058
                                                        
 
2059
                                                        if ( s[1] >= '0' && s[1] <= '7' ) {
 
2060
                                                                c2 = c1;
 
2061
                                                                c1 = c0;
 
2062
                                                                c0 = (*++s) - '0';
 
2063
                                                        }
 
2064
                                                }
 
2065
                                                c = (64 * c2) + (8 * c1) + c0;
 
2066
                                                *(p++) = (char) (c > 255 ? 255 : c);
 
2067
                                                len++;
 
2068
                                                break;
 
2069
                                        }
 
2070
                                        default:
 
2071
                                                *p++ = *s;
 
2072
                                                len++;
 
2073
                                                break;
 
2074
                                }
 
2075
                                break;
 
2076
                        default:
 
2077
                                *(p++) = *s;
 
2078
                                len++;
 
2079
                                break;
 
2080
                }
 
2081
        }
 
2082
 
 
2083
done:
 
2084
                
 
2085
        while ( p < end ) *(p++) = '\0';
 
2086
        buf[len] = '\0';
 
2087
        len--;
 
2088
        if (len_p) *len_p = len;
 
2089
        return buf;
 
2090
}
 
2091
 
 
2092
 
 
2093
 
 
2094
static void add_engine(void) {
 
2095
        snmp_ue_assoc_t a;
 
2096
        
 
2097
 
 
2098
 
 
2099
        a.user.userName.data = user;
 
2100
        a.user.userName.len = user_len;
 
2101
        
 
2102
        a.user.authPassword.data = auth_password;
 
2103
        a.user.authPassword.len = auth_password_len;
 
2104
 
 
2105
        a.user.privPassword.data = priv_password;
 
2106
        a.user.privPassword.len = priv_password_len;
 
2107
        
 
2108
        switch (auth) {
 
2109
                case AUTH_MD5:
 
2110
                        a.user.authModel = &model_md5;
 
2111
                        break;
 
2112
                case AUTH_SHA:
 
2113
                        a.user.authModel = &model_sha1;
 
2114
                        break;
 
2115
                default:
 
2116
                        g_assert_not_reached();
 
2117
                        break;
 
2118
        }
 
2119
        
 
2120
        switch(enc) {
 
2121
                case PRIV_DES:
 
2122
                        a.user.privProtocol = snmp_usm_priv_des;
 
2123
                        break;
 
2124
                case PRIV_AES:
 
2125
                        a.user.privProtocol = snmp_usm_priv_aes;
 
2126
                        break;
 
2127
                default:
 
2128
                        g_assert_not_reached();
 
2129
                        break;
 
2130
        }
 
2131
 
 
2132
        if (engine) {
 
2133
                        a.engine.data = engine;
 
2134
                        a.engine.len = engine_len;
 
2135
                        
 
2136
                        if (a.user.authModel) {
 
2137
                                a.user.authKey.data = g_malloc(a.user.authModel->key_size);
 
2138
                                a.user.authKey.len = a.user.authModel->key_size;
 
2139
                                a.user.privKey.data = g_malloc(a.user.authModel->key_size);
 
2140
                                a.user.privKey.len = a.user.authModel->key_size;
 
2141
                                a.user.authModel->pass2key( auth_password, auth_password_len, engine, engine_len, a.user.authKey.data);
 
2142
                                a.user.authModel->pass2key( priv_password, priv_password_len, engine, engine_len, a.user.privKey.data);
 
2143
                        } else {
 
2144
                                a.user.authKey.data = NULL;
 
2145
                                a.user.authKey.len = 0;
 
2146
                                a.user.privKey.data = NULL;
 
2147
                                a.user.privKey.len = 0;
 
2148
                        }
 
2149
                        
 
2150
        } else {
 
2151
                a.engine.data = NULL;
 
2152
                a.engine.len = 0;
 
2153
                a.user.authKey.data = NULL;
 
2154
                a.user.authKey.len = 0;
 
2155
                a.user.privKey.data = NULL;
 
2156
                a.user.privKey.len = 0;         
 
2157
        }
 
2158
        
 
2159
        a.next = NULL;
 
2160
        
 
2161
        g_array_append_val(assoc_arr,a);
 
2162
        loaded++;
 
2163
        
 
2164
        return;
 
2165
}
 
2166
 
 
2167
gchar* load_snmp_users_file(const char* fname, snmp_ue_assoc_t** assocs) {
 
2168
        gchar* err_str = NULL;
 
2169
        
 
2170
        *assocs = NULL;
 
2171
 
 
2172
        assoc_arr = g_array_new(TRUE,FALSE,sizeof(snmp_ue_assoc_t));
 
2173
        filename = fname;
 
2174
        
 
2175
        Snmp_UE_file_in = fopen(filename,"r");
 
2176
 
 
2177
        if (!Snmp_UE_file_in) {
 
2178
                return ep_strdup_printf("Could not open file: '%s', error: %s",filename,strerror(errno));
 
2179
        }
 
2180
        
 
2181
        error = g_string_new("");
 
2182
        loaded = 0;
 
2183
 
 
2184
        START_LINE();
 
2185
        
 
2186
        Snmp_UE_file_lex();
 
2187
        
 
2188
        fclose(Snmp_UE_file_in);
 
2189
        
 
2190
        Snmp_UE_file_restart(NULL);
 
2191
 
 
2192
        if (loaded) {
 
2193
                *assocs = (snmp_ue_assoc_t*)assoc_arr->data;
 
2194
                g_array_free(assoc_arr,FALSE);
 
2195
        } else {
 
2196
                *assocs = NULL;         
 
2197
                g_array_free(assoc_arr,TRUE);
 
2198
        }
 
2199
        
 
2200
        
 
2201
        if (error->len) {
 
2202
                err_str = error->str;
 
2203
        }
 
2204
        
 
2205
        
 
2206
        
 
2207
        return err_str;
 
2208
}
 
2209