summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--radsecproxy.c30
2 files changed, 8 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 6a72e8e..8fbec05 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
CFLAGS = -g -Wall -pedantic -pthread
LDFLAGS = -lssl
-OBJ = util.o radsecproxy.o
+OBJ = util.o debug.o radsecproxy.o
all: radsecproxy
-radsecproxy: $(OBJ) radsecproxy.o
+radsecproxy: $(OBJ)
$(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o radsecproxy
clean:
rm -f $(OBJ) radsecproxy
diff --git a/radsecproxy.c b/radsecproxy.c
index adbea4a..cbf5afd 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -49,6 +49,7 @@
#include <openssl/md5.h>
#include <openssl/hmac.h>
#include "radsecproxy.h"
+#include "debug.h"
static struct options options;
static struct client *clients;
@@ -1923,32 +1924,13 @@ void getmainconfig(const char *configfile) {
fclose(f);
}
-#if 0
-void parseargs(int argc, char **argv) {
- int c;
-
- while ((c = getopt(argc, argv, "p:")) != -1) {
- switch (c) {
- case 'p':
- udp_server_port = optarg;
- break;
- default:
- goto usage;
- }
- }
-
- return;
-
- usage:
- printf("radsecproxy [ -p UDP-port ]\n");
- exit(1);
-}
-#endif
-
int main(int argc, char **argv) {
pthread_t udpserverth;
/* pthread_attr_t joinable; */
int i;
+
+ debug(DBG_INFO, "debug test info");
+ debug(DBG_WARN, "debug test warn");
/* parseargs(argc, argv); */
getmainconfig(CONFIG_MAIN);
@@ -1961,7 +1943,7 @@ int main(int argc, char **argv) {
if (client_udp_count) {
udp_server_listen = server_create('U');
if (pthread_create(&udpserverth, NULL /*&joinable*/, udpserverrd, NULL))
- errx("pthread_create failed");
+ debug(DBG_ERR, "pthread_create failed");
}
if (client_tls_count || server_tls_count)
@@ -1969,7 +1951,7 @@ int main(int argc, char **argv) {
for (i = 0; i < server_count; i++)
if (pthread_create(&servers[i].clientth, NULL, clientwr, (void *)&servers[i]))
- errx("pthread_create failed");
+ debug(DBG_ERR, "pthread_create failed");
if (client_tls_count) {
tcp_server_listen = server_create('T');