2 * $Id: radstatus.c,v 1.1 2002/01/22 16:03:05 dfs Exp $
4 * Copyright (C) 1995,1996 Lars Fenneberg
6 * See the file COPYRIGHT for the respective terms and conditions.
7 * If the file is missing contact me at lf@elemental.net
8 * and I'll send you a copy.
13 "$Id: radstatus.c,v 1.1 2002/01/22 16:03:05 dfs Exp $";
17 #include <radiusclient.h>
18 #include <pathnames.h>
25 fprintf(stderr,"Usage: %s [-Vh] [-f <config_file>] [server[:port]]...\n\n", pname);
26 fprintf(stderr," -V output version information\n");
27 fprintf(stderr," -h output this text\n");
28 fprintf(stderr," -f filename of alternate config file\n");
34 fprintf(stderr,"%s: %s\n", pname ,rcsid);
38 int main (int argc, char **argv)
40 int result = ERROR_RC;
44 char *path_radiusclient_conf = RC_CONFIG_FILE;
48 pname = (pname = strrchr(argv[0],'/'))?pname+1:argv[0];
52 while ((c = getopt(argc,argv,"hVf:")) > 0)
56 path_radiusclient_conf = optarg;
73 if (rc_read_config(path_radiusclient_conf) != 0)
76 if (rc_read_dictionary(rc_conf_str("dictionary")) != 0)
80 for (i = 0; i < argc; i++) {
81 if ((p = strchr(argv[i], ':')) == NULL) {
82 result = rc_check(argv[i],rc_getport(AUTH), msg);
83 } else if (!strcmp(p+1, "auth")) {
85 result = rc_check(argv[i],rc_getport(AUTH), msg);
86 } else if (!strcmp(p+1, "acct")) {
88 result = rc_check(argv[i],rc_getport(ACCT), msg);
91 result = rc_check(argv[i], atoi(p+1), msg);
96 printf(SC_STATUS_FAILED);
99 srv = rc_conf_srv("authserver");
100 for(i=0; i<srv->max ; i++)
102 result = rc_check(srv->name[i], srv->port[i], msg);
106 srv = rc_conf_srv("acctserver");
107 for(i=0; i<srv->max ; i++)
109 result = rc_check(srv->name[i], srv->port[i], msg);