.if !'po4a'hide' .BI "port " portnumber
Specifies the port number or service name where the helper should connect.
.
+.if !'po4a'hide' .TP
+.if !'po4a'hide' .BI "timeout " seconds
+Specifies the RADIUS request timeout.
+.
.SH AUTHOR
This program is written by
.if !'po4a'hide' .I Marc van Selm <selm@cistron.nl>
static int nasporttype = 0;
static uint32_t nas_ipaddr;
static uint32_t auth_ipaddr;
-static int retries = 30;
+static int retries = 10;
char progname[] = "basic_radius_auth";
sscanf(line, "service %s", svc_name);
if (!memcmp(line, "port", 4))
sscanf(line, "port %s", svc_name);
+ if (!memcmp(line, "timeout", 7))
+ sscanf(line, "timeout %d", &retries);
}
fclose(cf);
if (srv && crt)
*dst = '\0';
}
-static int
+static void
authenticate(int socket_fd, const char *username, const char *passwd)
{
AUTH_HDR *auth;
continue;
rc = result_recv(saremote.sin_addr.s_addr, saremote.sin_port, recv_buffer, len);
- if (rc == 0)
- return 1;
- if (rc == 1)
- return 0;
+ if (rc == 0) {
+ SEND_OK("");
+ return;
+ }
+ if (rc == 1) {
+ SEND_ERR("");
+ return;
+ }
}
}
fprintf(stderr, "%s: No response from RADIUS server\n", progname);
-
- return 0;
+ SEND_ERR("No response from RADIUS server");
+ return;
}
int
++ptr;
urldecode(passwd, ptr, MAXPASS);
- if (authenticate(sockfd, username, passwd))
- SEND_OK("");
- else
- SEND_ERR("");
+ authenticate(sockfd, username, passwd);
}
close(sockfd);
exit(1);