summaryrefslogtreecommitdiff
path: root/accel-pptpd/radius
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-10-06 16:43:14 +0400
committerKozlov Dmitry <dima@server>2010-10-06 16:43:14 +0400
commitb6a1268714671904e96a49b88680dc3ff07aaa1c (patch)
tree60424372b94312710b9f583b1bcc641de4020316 /accel-pptpd/radius
parent5cf93f33f2350ed3b92f73ead1d2829a6883810a (diff)
downloadaccel-ppp-b6a1268714671904e96a49b88680dc3ff07aaa1c.tar.gz
accel-ppp-b6a1268714671904e96a49b88680dc3ff07aaa1c.zip
project cleanup and prepare to release
Diffstat (limited to 'accel-pptpd/radius')
-rw-r--r--accel-pptpd/radius/CMakeLists.txt9
-rw-r--r--accel-pptpd/radius/dm_coa.c8
-rw-r--r--accel-pptpd/radius/radius.c17
-rw-r--r--accel-pptpd/radius/req.c2
4 files changed, 21 insertions, 15 deletions
diff --git a/accel-pptpd/radius/CMakeLists.txt b/accel-pptpd/radius/CMakeLists.txt
index c8c44f8..b82512e 100644
--- a/accel-pptpd/radius/CMakeLists.txt
+++ b/accel-pptpd/radius/CMakeLists.txt
@@ -1,4 +1,3 @@
-SET(target radius)
SET(sources
radius.c
dict.c
@@ -9,5 +8,13 @@ SET(sources
dm_coa.c
)
+ADD_DEFINITIONS(-DDICT_PATH="${CMAKE_INSTALL_PREFIX}/usr/share/accel-pptp/dictionary")
+
ADD_LIBRARY(radius SHARED ${sources})
+INSTALL(TARGETS radius
+ LIBRARY DESTINATION usr/lib/accel-pptp
+)
+FILE(GLOB dict "${CMAKE_CURRENT_SOURCE_DIR}/dict/*")
+INSTALL(FILES ${dict} DESTINATION usr/share/accel-pptp)
+
diff --git a/accel-pptpd/radius/dm_coa.c b/accel-pptpd/radius/dm_coa.c
index e034321..64fe97a 100644
--- a/accel-pptpd/radius/dm_coa.c
+++ b/accel-pptpd/radius/dm_coa.c
@@ -246,11 +246,11 @@ static struct dm_coa_serv_t serv = {
static void __init init(void)
{
- struct sockaddr_in addr;
+ struct sockaddr_in addr;
serv.hnd.fd = socket (PF_INET, SOCK_DGRAM, 0);
if (serv.hnd.fd < 0) {
- log_error("radius:dm_coa: socket: %s\n", strerror(errno));
+ log_emerg("radius:dm_coa: socket: %s\n", strerror(errno));
return;
}
addr.sin_family = AF_INET;
@@ -260,13 +260,13 @@ static void __init init(void)
else
addr.sin_addr.s_addr = htonl (INADDR_ANY);
if (bind (serv.hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
- log_error("radius:dm_coa: bind: %s\n", strerror(errno));
+ log_emerg("radius:dm_coa: bind: %s\n", strerror(errno));
close(serv.hnd.fd);
return;
}
if (fcntl(serv.hnd.fd, F_SETFL, O_NONBLOCK)) {
- log_error("radius:dm_coa: failed to set nonblocking mode: %s\n", strerror(errno));
+ log_emerg("radius:dm_coa: failed to set nonblocking mode: %s\n", strerror(errno));
close(serv.hnd.fd);
return;
}
diff --git a/accel-pptpd/radius/radius.c b/accel-pptpd/radius/radius.c
index 99d9a3e..9f5c7ff 100644
--- a/accel-pptpd/radius/radius.c
+++ b/accel-pptpd/radius/radius.c
@@ -309,6 +309,7 @@ static int parse_server(const char *opt, char **name, int *port, char **secret)
static void __init radius_init(void)
{
char *opt;
+ char *dict = DICT_PATH;
rpd_pool = mempool_create(sizeof(struct radius_pd_t));
@@ -338,16 +339,16 @@ static void __init radius_init(void)
opt = conf_get_opt("radius", "auth_server");
if (!opt) {
- log_error("radius: auth_server not specified\n");
+ log_emerg("radius: auth_server not specified\n");
_exit(EXIT_FAILURE);
} else if (parse_server(opt, &conf_auth_server, &conf_auth_server_port, &conf_auth_secret)) {
- log_error("radius: failed to parse auth_server\n");
+ log_emerg("radius: failed to parse auth_server\n");
_exit(EXIT_FAILURE);
}
opt = conf_get_opt("radius", "acct_server");
if (opt && parse_server(opt, &conf_acct_server, &conf_acct_server_port, &conf_acct_secret)) {
- log_error("radius: failed to parse acct_server\n");
+ log_emerg("radius: failed to parse acct_server\n");
_exit(EXIT_FAILURE);
}
@@ -356,11 +357,10 @@ static void __init radius_init(void)
conf_dm_coa_secret = opt;
opt = conf_get_opt("radius", "dictionary");
- if (!opt) {
- fprintf(stderr, "radius: dictionary not specified\n");
- _exit(EXIT_FAILURE);
- }
- if (rad_dict_load(opt))
+ if (opt)
+ dict = opt;
+
+ if (rad_dict_load(dict))
_exit(EXIT_FAILURE);
pwdb_register(&pwdb);
@@ -371,4 +371,3 @@ static void __init radius_init(void)
triton_event_register_handler(EV_PPP_FINISHING, (triton_event_func)ppp_finishing);
triton_event_register_handler(EV_PPP_FINISHED, (triton_event_func)ppp_finished);
}
-
diff --git a/accel-pptpd/radius/req.c b/accel-pptpd/radius/req.c
index bdd02b9..f3f4138 100644
--- a/accel-pptpd/radius/req.c
+++ b/accel-pptpd/radius/req.c
@@ -236,7 +236,7 @@ void __init req_init(void)
{
urandom_fd = open("/dev/urandom", O_RDONLY);
if (!urandom_fd) {
- perror("radius:req: open /dev/urandom");
+ log_emerg("radius:req: open /dev/urandom: %s\n", strerror(errno));
_exit(EXIT_FAILURE);
}
}