~ubuntu-branches/ubuntu/natty/freeradius/natty-updates

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2009-11-23 03:57:37 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20091123035737-zsgtzhfych8hir68
Tags: 2.1.7+dfsg-1
* Adopting the package, closes: #536623.
* New upstream version, closes: #513484.
  + Fixes the blooper in unlang evaluation logic, closes: #526175.
* Used quilt (and added README.source), and moved upstream file patching
  into debian/patches/. The source is no longer in collab-maint git
  (to make it simpler for me to finally get this out the door), but
  kept the .gitignore should we need that again.
* Dropped the dialup_admin/bin/backup_radacct patch (integrated upstream).
* Dropped the raddb/Makefile patch (problem no longer exists upstream).
* Dropped the lib/packet.c lib/radius.c main/listen.c patches (was from
  upstream 2.0.5 anyway).
* Dropped references to otp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Dropped references to snmp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Ship /etc/freeradius/modules/* in the freeradius package.
* Stop shipping sites-enabled symlinks in the package and instead create
  them only on initial install, thanks to Matej Vela, closes: #533396.
* Add export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" to the init script
  at the request of John Morrissey, closes: #550143.
* Stop installing /var/run/freeradius in the package to silence Lintian.
  The init script already recreates it at will.
* Remove executable bit from example.pl to silence Lintian.

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.35 2008/01/01 17:29:12 aland Exp $
 
4
 * Version:     $Id$
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
23
23
 */
24
24
 
25
25
#include <freeradius-devel/ident.h>
26
 
RCSID("$Id: radeapclient.c,v 1.35 2008/01/01 17:29:12 aland Exp $")
 
26
RCSID("$Id$")
27
27
 
28
28
#include <freeradius-devel/libradius.h>
29
29
 
68
68
static int map_eapsim_types(RADIUS_PACKET *r);
69
69
static int unmap_eapsim_types(RADIUS_PACKET *r);
70
70
 
 
71
void debug_pair_list(UNUSED VALUE_PAIR *vp)
 
72
{
 
73
        return;
 
74
}
 
75
 
71
76
static void NEVER_RETURNS usage(void)
72
77
{
73
78
        fprintf(stderr, "Usage: radeapclient [options] server[:port] <command> [<secret>]\n");
116
121
        return r;
117
122
}
118
123
 
 
124
void radlog_request(UNUSED int lvl, UNUSED int priority,
 
125
                    UNUSED REQUEST *request, const char *msg, ...)
 
126
{
 
127
        va_list ap;
 
128
 
 
129
        va_start(ap, msg);
 
130
        vfprintf(stderr, msg, ap);
 
131
        va_end(ap);
 
132
        fputc('\n', stderr);
 
133
}
 
134
 
119
135
static int getport(const char *name)
120
136
{
121
137
        struct  servent         *svp;
175
191
                        }
176
192
                        break;
177
193
                } else {        /* NULL: couldn't receive the packet */
178
 
                        librad_perror("radclient:");
 
194
                        fr_perror("radclient:");
179
195
                        exit(1);
180
196
                }
181
197
        }
193
209
         *      a lot more than radeapclient.
194
210
         */
195
211
        if (rad_verify(*rep, req, secret) != 0) {
196
 
                librad_perror("rad_verify");
 
212
                fr_perror("rad_verify");
197
213
                exit(1);
198
214
        }
199
215
 
200
216
        if (rad_decode(*rep, req, secret) != 0) {
201
 
                librad_perror("rad_decode");
 
217
                fr_perror("rad_decode");
202
218
                exit(1);
203
219
        }
204
220
 
205
221
        /* libradius debug already prints out the value pairs for us */
206
 
        if (!librad_debug && do_output) {
 
222
        if (!fr_debug_flag && do_output) {
207
223
                printf("Received response ID %d, code %d, length = %d\n",
208
224
                                (*rep)->id, (*rep)->code, (*rep)->data_len);
209
225
                vp_printlist(stdout, (*rep)->vps);
273
289
        /* verify that the attribute length is big enough for a length field */
274
290
        if(vp->length < 4)
275
291
        {
276
 
                fprintf(stderr, "start message has illegal VERSION_LIST. Too short: %d\n", vp->length);
 
292
                fprintf(stderr, "start message has illegal VERSION_LIST. Too short: %u\n", (unsigned int) vp->length);
277
293
                return 0;
278
294
        }
279
295
 
283
299
         */
284
300
        if((unsigned)vp->length <= (versioncount*2 + 2))
285
301
        {
286
 
                fprintf(stderr, "start message is too short. Claimed %d versions does not fit in %d bytes\n", versioncount, vp->length);
 
302
                fprintf(stderr, "start message is too short. Claimed %d versions does not fit in %u bytes\n", versioncount, (unsigned int) vp->length);
287
303
                return 0;
288
304
        }
289
305
 
739
755
        /* sanitize items */
740
756
        if(valuesize > vp->length)
741
757
        {
742
 
                fprintf(stderr, "radeapclient: md5 valuesize if too big (%d > %d)\n",
743
 
                        valuesize, vp->length);
 
758
                fprintf(stderr, "radeapclient: md5 valuesize if too big (%u > %u)\n",
 
759
                        (unsigned int) valuesize, (unsigned int) vp->length);
744
760
                return 0;
745
761
        }
746
762
 
915
931
        int id;
916
932
 
917
933
        id = ((int)getpid() & 0xff);
918
 
        librad_debug = 0;
 
934
        fr_debug_flag = 0;
919
935
 
920
936
        radlog_dest = RADLOG_STDERR;
921
937
 
938
954
                        break;
939
955
                case 'x':
940
956
                        debug_flag++;
941
 
                        librad_debug++;
 
957
                        fr_debug_flag++;
942
958
                        break;
943
959
 
944
960
                case 'X':
971
987
                        timeout = atof(optarg);
972
988
                        break;
973
989
                case 'v':
974
 
                        printf("radclient: $Id: radeapclient.c,v 1.35 2008/01/01 17:29:12 aland Exp $ built on " __DATE__ " at " __TIME__ "\n");
 
990
                        printf("radclient: $Id$ built on " __DATE__ " at " __TIME__ "\n");
975
991
                        exit(0);
976
992
                        break;
977
993
               case 'S':
1017
1033
        }
1018
1034
 
1019
1035
        if (dict_init(radius_dir, RADIUS_DICTIONARY) < 0) {
1020
 
                librad_perror("radclient");
 
1036
                fr_perror("radclient");
1021
1037
                return 1;
1022
1038
        }
1023
1039
 
1024
1040
        if ((req = rad_alloc(1)) == NULL) {
1025
 
                librad_perror("radclient");
 
1041
                fr_perror("radclient");
1026
1042
                exit(1);
1027
1043
        }
1028
1044
 
1267
1283
                /* verify the length is big enough to hold type */
1268
1284
                if(len < 5)
1269
1285
                {
 
1286
                        free(e);
1270
1287
                        return;
1271
1288
                }
1272
1289
 
1286
1303
                break;
1287
1304
        }
1288
1305
 
 
1306
        free(e);
1289
1307
        return;
1290
1308
}
1291
1309
 
1352
1370
        }
1353
1371
 
1354
1372
        if (dict_init(radius_dir, RADIUS_DICTIONARY) < 0) {
1355
 
                librad_perror("radclient");
 
1373
                fr_perror("radclient");
1356
1374
                return 1;
1357
1375
        }
1358
1376
 
1359
1377
        if ((req = rad_alloc(1)) == NULL) {
1360
 
                librad_perror("radclient");
 
1378
                fr_perror("radclient");
1361
1379
                exit(1);
1362
1380
        }
1363
1381
 
1364
1382
        if ((req2 = rad_alloc(1)) == NULL) {
1365
 
                librad_perror("radclient");
 
1383
                fr_perror("radclient");
1366
1384
                exit(1);
1367
1385
        }
1368
1386