Revision b21f68b4 nest/config.Y

View differences:

nest/config.Y
20 20
static struct iface_patt *this_ipatt;
21 21
static list *this_p_list;
22 22
static struct password_item *this_p_item;
23
static int password_id;
24

  
25
static list *
26
get_passwords(void)
27
{
28
  list *rv = this_p_list;
29
  this_p_list = NULL;
30
  return rv;
31
}
32

  
23 33

  
24 34
CF_DECLS
25 35

  
......
37 47
%type <i32> idval
38 48
%type <f> imexport
39 49
%type <r> rtable
40
%type <p> password_list password_begin password_begin_list
41 50
%type <s> optsym
42 51
%type <ra> r_args
43 52
%type <i> echo_mask echo_size debug_mask debug_list debug_flag import_or_proto
......
197 206

  
198 207
/* Password lists */
199 208

  
209
password_list:
210
   PASSWORDS '{' password_items '}'
211
 | password_item
212
;
213

  
200 214
password_items: 
201 215
    /* empty */
202 216
  | password_item ';' password_items
......
209 223

  
210 224
password_item_begin:
211 225
   PASSWORD TEXT {
212
     static int id = 1;
226
     if (!this_p_list) {
227
     	this_p_list = cfg_alloc(sizeof(list));
228
     	init_list(this_p_list);
229
        password_id = 1;
230
     }
213 231
     this_p_item = cfg_alloc(sizeof (struct password_item));
214 232
     this_p_item->password = $2;
215 233
     this_p_item->genfrom = 0;
216 234
     this_p_item->gento = TIME_INFINITY;
217 235
     this_p_item->accfrom = 0;
218 236
     this_p_item->accto = TIME_INFINITY;
219
     this_p_item->id = id++;
237
     this_p_item->id = password_id++;
220 238
     add_tail(this_p_list, &this_p_item->n);
221 239
   }
222 240
;
......
230 248
 | ID expr ';' password_item_params { this_p_item->id = $2; if ($2 <= 0) cf_error("Password ID has to be greated than zero."); }
231 249
 ;
232 250

  
233
password_list:
234
   password_begin_list '{' password_items '}' {
235
     $$ = $1;
236
   }
237
 | password_begin
238
;
239

  
240
password_begin_list:
241
  PASSWORDS {
242
     this_p_list = cfg_alloc(sizeof(list));
243
     init_list(this_p_list);
244
     $$ = (void *) this_p_list;
245
  }
246
;
247

  
248
password_begin:
249
  PASSWORD TEXT {
250
     this_p_list = cfg_alloc(sizeof(list));
251
     init_list(this_p_list);
252
     this_p_item = cfg_alloc(sizeof (struct password_item));
253
     this_p_item->password = $2;
254
     this_p_item->genfrom = 0;
255
     this_p_item->gento = TIME_INFINITY;
256
     this_p_item->accfrom = 0;
257
     this_p_item->accto = TIME_INFINITY;
258
     this_p_item->id = 1;
259
     add_tail(this_p_list, &this_p_item->n);
260
     $$ = (void *) this_p_list;
261
  }
262
;
263 251

  
264 252
/* Core commands */
265 253
CF_CLI_HELP(SHOW, ..., [[Show status information]])

Also available in: Unified diff