static int totalapp = 0;
static int totaldeny = 0;
static char filesecret[256];
-const char *radius_dir = RADDBDIR;
+char *radius_dir = NULL;
const char *progname = "radeapclient";
/* fr_randctx randctx; */
+#ifdef WITH_TLS
+#include <freeradius-devel/tls.h>
+#endif
radlog_dest_t radlog_dest = RADLOG_STDERR;
const char *radlog_dir = NULL;
fprintf(stderr, " -f file Read packets from file, not stdin.\n");
fprintf(stderr, " -r retries If timeout, retry sending the packet 'retries' times.\n");
fprintf(stderr, " -t timeout Wait 'timeout' seconds before retrying (may be a floating point number).\n");
+ fprintf(stderr, " -h Print usage help information.\n");
fprintf(stderr, " -i id Set request id to 'id'. Values may be 0..255\n");
fprintf(stderr, " -S file read secret from file, not command line.\n");
fprintf(stderr, " -q Do not print anything out.\n");
printf("%s %s packet %s host %s port %d, id=%d, length=%d\n",
received, fr_packet_codes[packet->code], from,
inet_ntop(ip->af, &ip->ipaddr, buffer, sizeof(buffer)),
- port, packet->id, packet->data_len);
+ port, packet->id, (int) packet->data_len);
} else {
printf("%s packet %s host %s port %d code=%d, id=%d, length=%d\n",
received, from,
inet_ntop(ip->af, &ip->ipaddr, buffer, sizeof(buffer)),
port,
- packet->code, packet->id, packet->data_len);
+ packet->code, packet->id, (int) packet->data_len);
}
for (vp = packet->vps; vp != NULL; vp = vp->next) {
for (i = 0; i < retries; i++) {
fd_set rdfdesc;
+ debug_packet(req, R_SENT);
+
rad_send(req, NULL, secret);
/* And wait for reply, timing out as necessary */
*/
unmap_eapsim_types(req);
- debug_packet(req, R_SENT);
-
if((vp = pairfind(req->vps, ATTRIBUTE_EAP_SIM_SUBTYPE, 0)) == NULL)
{
return 0;
again:
rep->id++;
- debug_packet(rep, R_SENT);
-
/*
* if there are EAP types, encode them into an EAP-Message
*
count = atoi(optarg);
break;
case 'd':
- radius_dir = optarg;
+ radius_dir = strdup(optarg);
break;
case 'f':
filename = optarg;
usage();
}
+ if (!radius_dir) radius_dir = strdup(RADDBDIR);
+
if (dict_init(radius_dir, RADIUS_DICTIONARY) < 0) {
fr_perror("radclient");
return 1;
sendrecv_eap(req);
}
+ free(radius_dir);
if(do_summary) {
printf("\n\t Total approved auths: %d\n", totalapp);
printf("\t Total denied auths: %d\n", totaldeny);
}
vp = pairfind(req2->vps,
- ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_MAC);
- vpkey = pairfind(req->vps, ATTRIBUTE_EAP_SIM_KEY);
- vpextra = pairfind(req->vps, ATTRIBUTE_EAP_SIM_EXTRA);
+ ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_MAC, 0);
+ vpkey = pairfind(req->vps, ATTRIBUTE_EAP_SIM_KEY, 0);
+ vpextra = pairfind(req->vps, ATTRIBUTE_EAP_SIM_EXTRA, 0);
if(vp != NULL && vpkey != NULL && vpextra!=NULL) {
uint8_t calcmac[16];