/[radius]/radius/lib/users.y
ViewVC logotype

Diff of /radius/lib/users.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by gray, Sun Sep 28 22:16:02 2003 UTC revision 1.12 by gray, Tue Oct 14 07:10:42 2003 UTC
# Line 42  Line 42 
42    
43  #define YYMAXDEPTH 10  #define YYMAXDEPTH 10
44    
45  int old_lineno;  static LOCUS start_loc;
46    
47  static void *closure;  static void *closure;
48  static int (*add_entry)(void*, char *, int, char *, VALUE_PAIR *, VALUE_PAIR *);  static register_rule_fp add_entry;
49  static VALUE_PAIR *install_pair0(char *name, int op, char *valstr);  static VALUE_PAIR *install_pair0(char *name, int op, char *valstr);
50    
51  int yyerror(char *s);  int yyerror(char *s);
# Line 92  list     : entry Line 92  list     : entry
92    
93  entry    : user descr  entry    : user descr
94             {             {
95                     add_entry(closure,                     add_entry(closure, &start_loc, $1, $2.lhs, $2.rhs);
                              source_filename,  
                              old_lineno, $1, $2.lhs, $2.rhs);  
96             }             }
97           | user error           | user error
98             {             {
# Line 110  entry    : user descr Line 108  entry    : user descr
108    
109  user     : value  user     : value
110             {             {
111                     old_lineno = source_line_num;                     start_loc = source_locus;
112             }             }
113           ;           ;
114    
# Line 185  value    : STRING Line 183  value    : STRING
183  int  int
184  yyerror(char *s)  yyerror(char *s)
185  {  {
186          radlog(L_ERR, "%s:%d: %s", source_filename, source_line_num, s);          radlog_loc(L_ERR, &source_locus, "%s", s);
187          return 0;          return 0;
188  }  }
189    
190  VALUE_PAIR *  VALUE_PAIR *
191  install_pair0(char *name, int op, char *valstr)  install_pair0(char *name, int op, char *valstr)
192  {  {
193          return install_pair(source_filename, source_line_num,          return install_pair(&source_locus, name, op, valstr);
                             name, op, valstr);  
194  }  }
195    
196  VALUE_PAIR *  VALUE_PAIR *
197  install_pair(char *file, int line, char *name, int op, char *valstr)  install_pair(LOCUS *loc, char *name, int op, char *valstr)
198  {  {
199          DICT_ATTR       *attr = NULL;          DICT_ATTR       *attr = NULL;
200          DICT_VALUE      *dval;          DICT_VALUE      *dval;
# Line 208  install_pair(char *file, int line, char Line 205  install_pair(char *file, int line, char
205          struct tm *tm, tms;          struct tm *tm, tms;
206                    
207          if ((attr = attr_name_to_dict(name)) == (DICT_ATTR *)NULL) {          if ((attr = attr_name_to_dict(name)) == (DICT_ATTR *)NULL) {
208                  radlog(L_ERR, _("%s:%d: unknown attribute `%s'"),                  radlog_loc(L_ERR, loc, _("unknown attribute `%s'"),
209                         file, line, name);                             name);
210                  return NULL;                  return NULL;
211          }          }
212    
# Line 236  install_pair(char *file, int line, char Line 233  install_pair(char *file, int line, char
233                  if (pair->attribute == DA_EXEC_PROGRAM ||                  if (pair->attribute == DA_EXEC_PROGRAM ||
234                      pair->attribute == DA_EXEC_PROGRAM_WAIT) {                      pair->attribute == DA_EXEC_PROGRAM_WAIT) {
235                          if (valstr[0] != '/' && valstr[0] != '|') {                          if (valstr[0] != '/' && valstr[0] != '|') {
236                                  radlog(L_ERR,                                  radlog_loc(L_ERR, loc,
237                                       _("%s:%d: %s: not an absolute pathname"),                                             _("%s: not an absolute pathname"),
238                                         file, line, name);                                             name);
239                                  avp_free(pair);                                  avp_free(pair);
240                                  return NULL;                                  return NULL;
241                          }                          }
# Line 248  install_pair(char *file, int line, char Line 245  install_pair(char *file, int line, char
245                  pair->avp_strlength = strlen(pair->avp_strvalue);                  pair->avp_strlength = strlen(pair->avp_strvalue);
246                                    
247                  if (attr->parser && attr->parser(pair, &s)) {                  if (attr->parser && attr->parser(pair, &s)) {
248                          radlog(L_ERR, "%s:%d: %s %s: %s",                          radlog_loc(L_ERR, loc,
249                                 file, line,                                     "%s %s: %s",
250                                 _("attribute"),                                     _("attribute"),
251                                 pair->name, s);                                     pair->name, s);
252                          free(s);                          free(s);
253                          avp_free(pair);                          avp_free(pair);
254                          return NULL;                          return NULL;
# Line 279  install_pair(char *file, int line, char Line 276  install_pair(char *file, int line, char
276                          pair->avp_lvalue = atoi(valstr);                          pair->avp_lvalue = atoi(valstr);
277                  } else if ((dval = value_name_to_value(valstr, pair->attribute)) == NULL) {                  } else if ((dval = value_name_to_value(valstr, pair->attribute)) == NULL) {
278                          avp_free(pair);                          avp_free(pair);
279                          radlog(L_ERR,                          radlog_loc(L_ERR, loc,
280                         _("%s:%d: value %s is not declared for attribute %s"),                                  _("value %s is not declared for attribute %s"),
281                                 file, line, valstr, name);                                     valstr, name);
282                          return NULL;                          return NULL;
283                  } else {                  } else {
284                          pair->avp_lvalue = dval->value;                          pair->avp_lvalue = dval->value;
# Line 324  install_pair(char *file, int line, char Line 321  install_pair(char *file, int line, char
321                  timeval = time(0);                  timeval = time(0);
322                  tm = localtime_r(&timeval, &tms);                  tm = localtime_r(&timeval, &tms);
323                  if (user_gettime(valstr, tm)) {                  if (user_gettime(valstr, tm)) {
324                          radlog(L_ERR,                          radlog_loc(L_ERR, loc, _("%s: can't parse date"),
325                                  _("%s:%d: %s: can't parse date"),                                     name);
                                file, line, name);  
326                          avp_free(pair);                          avp_free(pair);
327                          return NULL;                          return NULL;
328                  }                  }
# Line 338  install_pair(char *file, int line, char Line 334  install_pair(char *file, int line, char
334                  break;                  break;
335    
336          default:          default:
337                  radlog(L_ERR, _("%s:%d: %s: unknown attribute type %d"),                  radlog_loc(L_ERR, loc,
338                         file, line, name, pair->type);                             _("%s: unknown attribute type %d"),
339                               name, pair->type);
340                  avp_free(pair);                  avp_free(pair);
341                  return NULL;                  return NULL;
342          }          }
# Line 350  install_pair(char *file, int line, char Line 347  install_pair(char *file, int line, char
347  extern int yydebug;  extern int yydebug;
348    
349  int  int
350  parse_file(char *file, void *c, int (*f)())  parse_file(char *file, void *c, register_rule_fp f)
351  {  {
352          int rc;          int rc;
353                    
# Line 369  void Line 366  void
366  enable_usr_dbg(int val)  enable_usr_dbg(int val)
367  {  {
368          yydebug = val;          yydebug = val;
369          if (yydebug)          radlog_loc(L_NOTICE, &source_locus,
370                  radlog(L_NOTICE, _("%s:%d: enabled userfile parser debugging"),                     yydebug ? _("enabled userfile parser debugging") :
371                         source_filename, source_line_num);                               _("disabled userfile parser debugging"));
         else  
                 radlog(L_NOTICE, _("%s:%d: disabled userfile parser debugging"),  
                        source_filename, source_line_num);  
372  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26