ssahani / rpms / freeradius

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