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

Diff of /radius/radiusd/checkrad.c

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

revision 1.24 by gray, Tue Apr 29 13:57:59 2003 UTC revision 1.25 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,2001, Sergey Poznyakoff     Copyright (C) 2000,2001,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    
 #ifndef lint  
 static char rcsid[] =  
 "$Id$";  
 #endif  
   
18  #define RADIUS_MODULE_CHECKRAD_C  #define RADIUS_MODULE_CHECKRAD_C
19    
20  #if defined(HAVE_CONFIG_H)  #if defined(HAVE_CONFIG_H)
# Line 65  struct check_instance { Line 60  struct check_instance {
60          char      *hostname;          char      *hostname;
61  };  };
62    
63  struct check_instance * create_instance(struct check_instance *cptr,  char *
64                                          NAS *nas, struct radutmp *up);  slookup(struct check_instance *checkp, char *name, char *defval)
65  void free_instance(struct check_instance *cptr);  {
66  char * slookup(struct check_instance *checkp, char *name, char *defval);          return envar_lookup_str(checkp->args, name, defval);
67  int ilookup(struct check_instance *checkp, char *name, int defval);  }
 int compare(struct check_instance *checkp, char *str);  
68    
69    int
70    ilookup(struct check_instance *checkp, char *name, int defval)
71    {
72            return envar_lookup_int(checkp->args, name, defval);
73    }
74            
75  struct check_instance *  struct check_instance *
76  create_instance(cptr, nas, up)  create_instance(struct check_instance *cptr, NAS *nas, struct radutmp *up)
         struct check_instance *cptr;  
         NAS *nas;  
         struct radutmp *up;  
77  {  {
78          RADCK_TYPE *radck_type;          RADCK_TYPE *radck_type;
79                                    
# Line 102  create_instance(cptr, nas, up) Line 99  create_instance(cptr, nas, up)
99  }  }
100    
101  void  void
102  free_instance(cptr)  free_instance(struct check_instance *cptr)
         struct check_instance *cptr;  
103  {  {
104          envar_free_list(&cptr->args);          envar_free_list(&cptr->args);
105  }  }
106    
 char *  
 slookup(checkp, name, defval)  
         struct check_instance *checkp;  
         char *name;  
         char *defval;  
 {  
         return envar_lookup_str(checkp->args, name, defval);  
 }  
   
 int  
 ilookup(checkp, name, defval)  
         struct check_instance *checkp;  
         char *name;  
         int defval;  
 {  
         return envar_lookup_int(checkp->args, name, defval);  
 }  
           
107  int  int
108  compare(checkp, str)  compare(struct check_instance *checkp, char *str)
         struct check_instance *checkp;  
         char *str;  
109  {  {
110          return va_run_init(checkp->func, NULL,          return va_run_init(checkp->func, NULL,
111                             "ssis",                             "ssis",
# Line 146  compare(checkp, str) Line 122  compare(checkp, str)
122   *          %P  -- port no + 1   *          %P  -- port no + 1
123   */   */
124  char *  char *
125  checkrad_xlat(checkp, str)  checkrad_xlat(struct check_instance *checkp, char *str)
         struct check_instance *checkp;  
         char *str;  
126  {  {
127          char *ptr;          char *ptr;
128          int len;          int len;
# Line 204  checkrad_xlat(checkp, str) Line 178  checkrad_xlat(checkp, str)
178          return str;          return str;
179  }  }
180    
 static int converse(int type, struct snmp_session *sp, struct snmp_pdu *pdu,  
                     void *closure);  
   
181  /*ARGSUSED*/  /*ARGSUSED*/
182  int  static int
183  converse(type, sp, pdu, closure)  converse(int type, struct snmp_session *sp, struct snmp_pdu *pdu, void *closure)
         int type;  
         struct snmp_session *sp;  
         struct snmp_pdu *pdu;  
         void *closure;  
184  {  {
185          int rc = 0;          int rc = 0;
186          struct snmp_var *vlist;          struct snmp_var *vlist;
# Line 257  converse(type, sp, pdu, closure) Line 224  converse(type, sp, pdu, closure)
224  }  }
225    
226  int  int
227  snmp_check(checkp, nas)  snmp_check(struct check_instance *checkp, NAS *nas)
         struct check_instance *checkp;  
         NAS *nas;  
228  {  {
229          int rc = -1;          int rc = -1;
230          struct snmp_pdu *pdu;          struct snmp_pdu *pdu;
# Line 370  alrm_handler() Line 335  alrm_handler()
335  #define MIN(a,b) ((a)<(b))?(a):(b)  #define MIN(a,b) ((a)<(b))?(a):(b)
336    
337  int  int
338  finger_check(checkp, nas)  finger_check(struct check_instance *checkp, NAS *nas)
         struct check_instance *checkp;  
         NAS *nas;  
339  {  {
340          char *arg;          char *arg;
341          char namebuf[RUT_NAMESIZE+1];          char namebuf[RUT_NAMESIZE+1];
# Line 554  finger_check(checkp, nas) Line 517  finger_check(checkp, nas)
517    
518  /*ARGSUSED*/  /*ARGSUSED*/
519  int  int
520  ext_check(checkp, nas)  ext_check(struct check_instance *checkp, NAS *nas)
         struct check_instance *checkp;  
         NAS *nas;  
521  {  {
522          radlog(L_ERR, "ext_check not implemented");          radlog(L_ERR, "ext_check not implemented");
523          return -1;          return -1;
524  }  }
525    
526  int  int
527  checkrad(nas, up)  checkrad(NAS *nas, struct radutmp *up)
         NAS *nas;  
         struct radutmp *up;  
528  {  {
529          struct check_instance checkp;          struct check_instance checkp;
530          int rc = -1;          int rc = -1;

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

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