freeradius/freeradius-radeapclient-ipv6.patch
John Dennis 75432c6005 Fixing bugs in RHEL6 rebase, applying fixes here as well
resolves: bug#700870 freeradius not compiled with --with-udpfromto
resolves: bug#753764 shadow password expiration does not work
resolves: bug#712803 radtest script is not working with eap-md5 option
resolves: bug#690756 errors in raddb/sql/postgresql/admin.sql template
2012-02-28 14:06:15 -05:00

159 lines
4.1 KiB
Diff

diff -r -u freeradius-server-2.1.12.orig/man/man1/radeapclient.1 freeradius-server-2.1.12.work/man/man1/radeapclient.1
--- freeradius-server-2.1.12.orig/man/man1/radeapclient.1 2011-09-30 10:12:07.000000000 -0400
+++ freeradius-server-2.1.12.work/man/man1/radeapclient.1 2012-02-28 11:11:46.023456307 -0500
@@ -3,6 +3,8 @@
radeapclient - send EAP packets to a RADIUS server, calculate responses
.SH SYNOPSIS
.B radeapclient
+.RB [ \-4 ]
+.RB [ \-6 ]
.RB [ \-c
.IR count ]
.RB [ \-d
@@ -27,7 +29,7 @@
\fBradeapclient\fP is a radius client program. It can send arbitrary radius
packets to a radius server, then shows the reply. Radeapclient differs from
radclient in that if there is an EAP-MD5 challenge, then it will be responded
-to.
+to.
.PP
\fBradeapclient\fP is otherwise identical to \fBradclient\fP.
.PP
@@ -36,11 +38,15 @@
.PP
.PP
The \fIEAP-MD5-Password\fP attribute, if present is used to respond to an
-MD5 challenge.
+MD5 challenge.
.PP
No other EAP types are currently supported.
.SH OPTIONS
+.IP \-4
+Use IPv4 (default)
+.IP \-6
+Use IPv6
.IP \-c\ \fIcount\fP
Send each packet \fIcount\fP times.
.IP \-d\ \fIraddb\fP
@@ -82,7 +88,7 @@
echo 'EAP-Type-Identity = "bob";
echo 'Message-Authenticator = 0x00';
echo 'NAS-Port = 0' ) >req.txt
-
+
radeapclient -x localhost auth testing123 <req.txt
.fi
.sp
diff -r -u freeradius-server-2.1.12.orig/src/modules/rlm_eap/radeapclient.c freeradius-server-2.1.12.work/src/modules/rlm_eap/radeapclient.c
--- freeradius-server-2.1.12.orig/src/modules/rlm_eap/radeapclient.c 2011-09-30 10:12:07.000000000 -0400
+++ freeradius-server-2.1.12.work/src/modules/rlm_eap/radeapclient.c 2012-02-28 11:44:34.011174367 -0500
@@ -90,6 +90,8 @@
fprintf(stderr, " -s Print out summary information of auth results.\n");
fprintf(stderr, " -v Show program version information.\n");
fprintf(stderr, " -x Debugging mode.\n");
+ fprintf(stderr, " -4 Use IPv4 address of server\n");
+ fprintf(stderr, " -6 Use IPv6 address of server.\n");
exit(1);
}
@@ -169,7 +171,7 @@
ip = &packet->dst_ipaddr;
port = packet->dst_port;
}
-
+
/*
* Client-specific debugging re-prints the input
* packet into the client log.
@@ -975,15 +977,22 @@
FILE *fp;
int count = 1;
int id;
+ int force_af = AF_UNSPEC;
id = ((int)getpid() & 0xff);
fr_debug_flag = 0;
radlog_dest = RADLOG_STDERR;
- while ((c = getopt(argc, argv, "c:d:f:hi:qst:r:S:xXv")) != EOF)
+ while ((c = getopt(argc, argv, "46c:d:f:hi:qst:r:S:xXv")) != EOF)
{
switch(c) {
+ case '4':
+ force_af = AF_INET;
+ break;
+ case '6':
+ force_af = AF_INET6;
+ break;
case 'c':
if (!isdigit((int) *optarg))
usage();
@@ -1106,11 +1115,45 @@
req->id = id;
/*
- * Strip port from hostname if needed.
+ * Resolve hostname.
*/
- if ((p = strchr(argv[1], ':')) != NULL) {
- *p++ = 0;
- port = atoi(p);
+ if (force_af == AF_UNSPEC) force_af = AF_INET;
+ req->dst_ipaddr.af = force_af;
+ if (strcmp(argv[1], "-") != 0) {
+ const char *hostname = argv[1];
+ const char *portname = argv[1];
+ char buffer[256];
+
+ if (*argv[1] == '[') { /* IPv6 URL encoded */
+ p = strchr(argv[1], ']');
+ if ((size_t) (p - argv[1]) >= sizeof(buffer)) {
+ usage();
+ }
+
+ memcpy(buffer, argv[1] + 1, p - argv[1] - 1);
+ buffer[p - argv[1] - 1] = '\0';
+
+ hostname = buffer;
+ portname = p + 1;
+
+ }
+ p = strchr(portname, ':');
+ if (p && (strchr(p + 1, ':') == NULL)) {
+ *p = '\0';
+ portname = p + 1;
+ } else {
+ portname = NULL;
+ }
+
+ if (ip_hton(hostname, force_af, &req->dst_ipaddr) < 0) {
+ fprintf(stderr, "radclient: Failed to find IP address for host %s: %s\n", hostname, strerror(errno));
+ exit(1);
+ }
+
+ /*
+ * Strip port from hostname if needed.
+ */
+ if (portname) port = atoi(portname);
}
/*
@@ -1143,15 +1186,7 @@
} else {
usage();
}
-
- /*
- * Resolve hostname.
- */
req->dst_port = port;
- if (ip_hton(argv[1], AF_INET, &req->dst_ipaddr) < 0) {
- fprintf(stderr, "radclient: Failed to find IP address for host %s\n", argv[1]);
- exit(1);
- }
/*
* Add the secret.