/[radius]/radius/radiusd/radutil.c
ViewVC logotype

Diff of /radius/radiusd/radutil.c

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

revision 1.36 by gray, Mon Dec 16 13:37:10 2002 UTC revision 1.37 by gray, Wed Apr 30 08:44:33 2003 UTC
# Line 1  Line 1 
1  /* This file is part of GNU RADIUS.  /* This file is part of GNU Radius
2     Copyright (C) 2000, Sergey Poznyakoff     Copyright (C) 2000, 2002, 2003 Sergey Poznyakoff
3    
4     This program is free software; you can redistribute it and/or modify     GNU Radius is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.     (at your option) any later version.
8    
9     This program is distributed in the hope that it will be useful,     GNU Radius is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.     GNU General Public License for more details.
13    
14     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software Foundation,     along with GNU Radius; if not, write to the Free Software Foundation,
16     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17    
18  #define RADIUS_MODULE_RADUTIL_C  #define RADIUS_MODULE_RADUTIL_C
19    
 #ifndef lint  
 static char rcsid[] =  
 "@(#) $Id$";  
 #endif  
   
20  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
21  # include <config.h>  # include <config.h>
22  #endif  #endif
# Line 32  static char rcsid[] = Line 27  static char rcsid[] =
27  #include <radiusd.h>  #include <radiusd.h>
28  #include <obstack1.h>  #include <obstack1.h>
29    
 static void attr_to_str(struct obstack *obp,  
                         RADIUS_REQ *req,  
                         VALUE_PAIR *pairlist,  
                         DICT_ATTR  *attr, char *defval);  
 static void curtime_to_str(struct obstack *obp, VALUE_PAIR *request, int gmt);  
 static void attrno_to_str(struct obstack *obp,  
                           RADIUS_REQ *req,  
                           VALUE_PAIR *pairlist,  
                           int attr_no, char *defval);  
 static DICT_ATTR *parse_dict_attr(char *p, char **endp, char **defval);  
   
 static void obstack_grow_quoted(struct obstack *obp, char *str, int len);  
   
30  /* obstack_grow with quoting of potentially dangerous characters */  /* obstack_grow with quoting of potentially dangerous characters */
31  void  static void
32  obstack_grow_quoted(obp, str, len)  obstack_grow_quoted(struct obstack *obp, char *str, int len)
         struct obstack *obp;  
         char *str;  
         int len;  
33  {  {
34          for (; len > 0; len--, str++) {          for (; len > 0; len--, str++) {
35                  switch (*str) {                  switch (*str) {
# Line 92  obstack_grow_quoted(obp, str, len) Line 71  obstack_grow_quoted(obp, str, len)
71   * the latter is NULL, store "unknown" for string type and "0" for   * the latter is NULL, store "unknown" for string type and "0" for
72   * others.   * others.
73   */   */
74  void  static void
75  attr_to_str(obp, req, pairlist, attr, defval)  attr_to_str(struct obstack *obp, RADIUS_REQ *req, VALUE_PAIR *pairlist,
76          struct obstack *obp;              DICT_ATTR  *attr, char *defval)
         RADIUS_REQ *req;  
         VALUE_PAIR *pairlist;  
         DICT_ATTR  *attr;  
         char *defval;  
77  {  {
78          VALUE_PAIR *pair;          VALUE_PAIR *pair;
79          int len;          int len;
# Line 202  attr_to_str(obp, req, pairlist, attr, de Line 177  attr_to_str(obp, req, pairlist, attr, de
177          }          }
178  }  }
179    
180  void  static void
181  curtime_to_str(obp, request, gmt)  curtime_to_str(struct obstack *obp, VALUE_PAIR *request, int gmt)
         struct obstack *obp;  
         VALUE_PAIR *request;  
         int gmt;  
182  {  {
183          time_t curtime;          time_t curtime;
184          struct tm *tm, tms;          struct tm *tm, tms;
# Line 231  curtime_to_str(obp, request, gmt) Line 203  curtime_to_str(obp, request, gmt)
203   * If no attribute found, use provided default value (see comment to   * If no attribute found, use provided default value (see comment to
204   * attr_to_str)   * attr_to_str)
205   */   */
206  void  static void
207  attrno_to_str(obp, req, pairlist, attr_no, defval)  attrno_to_str(struct obstack *obp, RADIUS_REQ *req, VALUE_PAIR *pairlist,
208          struct obstack *obp;                int attr_no, char *defval)
         RADIUS_REQ *req;  
         VALUE_PAIR *pairlist;  
         int attr_no;  
         char *defval;  
209  {  {
210          attr_to_str(obp, req, pairlist,          attr_to_str(obp, req, pairlist,
211                      attr_number_to_dict(attr_no), defval);                      attr_number_to_dict(attr_no), defval);
212  }  }
213    
214  static DICT_ATTR *  static DICT_ATTR *
215  parse_dict_attr(p, endp, defval)  parse_dict_attr(char *p, char **endp, char **defval)
         char *p;  
         char **endp;  
         char **defval;  
216  {  {
217          char namebuf[MAX_DICTNAME];          char namebuf[MAX_DICTNAME];
218                    
# Line 294  parse_dict_attr(p, endp, defval) Line 259  parse_dict_attr(p, endp, defval)
259  }  }
260    
261  void  void
262  radius_xlate0(obp, str, req, reply)  radius_xlate0(struct obstack *obp, char *str, RADIUS_REQ *req,
263          struct obstack *obp;                VALUE_PAIR *reply)
         char *str;  
         RADIUS_REQ *req;  
         VALUE_PAIR *reply;  
264  {  {
265          int c;          int c;
266          char *p;          char *p;
# Line 424  end: Line 386  end:
386  }  }
387    
388  char *  char *
389  radius_xlate(obp, str, req, reply)  radius_xlate(struct obstack *obp, char *str, RADIUS_REQ *req, VALUE_PAIR *reply)
         struct obstack *obp;  
         char *str;  
         RADIUS_REQ *req;  
         VALUE_PAIR *reply;  
390  {  {
391          radius_xlate0(obp, str, req, reply);          radius_xlate0(obp, str, req, reply);
392          obstack_1grow(obp, 0);          obstack_1grow(obp, 0);

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

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