~ubuntu-branches/ubuntu/hardy/freeradius/hardy-proposed

« back to all changes in this revision

Viewing changes to src/modules/rlm_eap/radeapclient.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-12-16 20:45:11 UTC
  • mfrom: (3.1.10 feisty)
  • Revision ID: james.westby@ubuntu.com-20061216204511-3pbbsu4s8jtehsor
Tags: 1.1.3-3
Fix POSIX compliance problem in init script.  Closes: #403384. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * radeapclient.c       EAP specific radius packet debug tool.
3
3
 *
4
 
 * Version:     $Id: radeapclient.c,v 1.7 2004/02/26 19:04:29 aland Exp $
 
4
 * Version:     $Id: radeapclient.c,v 1.7.4.5 2006/05/19 14:22:23 nbk Exp $
5
5
 *
6
6
 *   This program is free software; you can redistribute it and/or modify
7
7
 *   it under the terms of the GNU General Public License as published by
21
21
 * Copyright 2000  Miquel van Smoorenburg <miquels@cistron.nl>
22
22
 * Copyright 2000  Alan DeKok <aland@ox.org>
23
23
 */
24
 
static const char rcsid[] = "$Id: radeapclient.c,v 1.7 2004/02/26 19:04:29 aland Exp $";
 
24
static const char rcsid[] = "$Id: radeapclient.c,v 1.7.4.5 2006/05/19 14:22:23 nbk Exp $";
25
25
 
26
26
#include "autoconf.h"
27
 
#include "libradius.h"
28
27
 
29
28
#include <stdio.h>
30
29
#include <stdlib.h>
53
52
#include "conf.h"
54
53
#include "radpaths.h"
55
54
#include "missing.h"
56
 
#include "../include/md5.h"
 
55
#include "../../include/md5.h"
57
56
 
58
57
#include "eap_types.h"
59
58
#include "eap_sim.h"
82
81
 
83
82
struct eapsim_keys eapsim_mk;
84
83
 
85
 
static void usage(void)
 
84
static void NEVER_RETURNS usage(void)
86
85
{
87
86
        fprintf(stderr, "Usage: radeapclient [options] server[:port] <command> [<secret>]\n");
88
87
 
117
116
        return r;
118
117
}
119
118
 
 
119
int log_debug(const char *msg, ...)
 
120
{
 
121
        va_list ap;
 
122
        int r;
 
123
 
 
124
        va_start(ap, msg);
 
125
        r = vfprintf(stderr, msg, ap);
 
126
        va_end(ap);
 
127
        fputc('\n', stderr);
 
128
 
 
129
        return r;
 
130
}
 
131
 
120
132
static int getport(const char *name)
121
133
{
122
134
        struct  servent         *svp;
164
176
 
165
177
                                ip_ntoa(src, (*rep)->src_ipaddr);
166
178
                                ip_ntoa(dst, req->dst_ipaddr);
167
 
                                fprintf(stderr, "radclient: ERROR: Sent request to host %s:%d, got response from host %s:%d\n!",
 
179
                                fprintf(stderr, "radclient: ERROR: Sent request to host %s port %d, got response from host %s port %d\n!",
168
180
                                        dst, req->dst_port,
169
181
                                        src, (*rep)->src_port);
170
182
                                exit(1);
182
194
                exit(1);
183
195
        }
184
196
 
 
197
        /*
 
198
         *      FIXME: Discard the packet & listen for another.
 
199
         *
 
200
         *      Hmm... we should really be using eapol_test, which does
 
201
         *      a lot more than radeapclient.
 
202
         */
 
203
        if (rad_verify(*rep, req, secret) != 0) {
 
204
                librad_perror("rad_verify");
 
205
                exit(1);
 
206
        }
 
207
 
185
208
        if (rad_decode(*rep, req, secret) != 0) {
186
209
                librad_perror("rad_decode");
187
210
                exit(1);
923
946
                        break;
924
947
 
925
948
                case 'X':
926
 
                  sha1_data_problems = 1;
 
949
#if 0
 
950
                  sha1_data_problems = 1; /* for debugging only */
 
951
#endif
927
952
                  break;
928
953
 
929
954
 
950
975
                        timeout = atof(optarg);
951
976
                        break;
952
977
                case 'v':
953
 
                        printf("radclient: $Id: radeapclient.c,v 1.7 2004/02/26 19:04:29 aland Exp $ built on " __DATE__ " at " __TIME__ "\n");
 
978
                        printf("radclient: $Id: radeapclient.c,v 1.7.4.5 2006/05/19 14:22:23 nbk Exp $ built on " __DATE__ " at " __TIME__ "\n");
954
979
                        exit(0);
955
980
                        break;
956
981
               case 'S':