summaryrefslogtreecommitdiff
path: root/accel-pptpd
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-11-30 16:48:00 +0300
committerKozlov Dmitry <dima@server>2010-11-30 16:48:00 +0300
commit2f29e750be84ffc69d2063d7e8e2224927f8af4f (patch)
tree3890be5fb49b0abb36f45de4665aed7cf07283b6 /accel-pptpd
parent575d140f9f67ce0ae6b93b9c6b47f6c7098864bb (diff)
downloadaccel-ppp-2f29e750be84ffc69d2063d7e8e2224927f8af4f.tar.gz
accel-ppp-2f29e750be84ffc69d2063d7e8e2224927f8af4f.zip
print version number on startup
Diffstat (limited to 'accel-pptpd')
-rw-r--r--accel-pptpd/CMakeLists.txt18
-rw-r--r--accel-pptpd/cli/telnet.c3
-rw-r--r--accel-pptpd/log.c4
-rw-r--r--accel-pptpd/main.c2
4 files changed, 22 insertions, 5 deletions
diff --git a/accel-pptpd/CMakeLists.txt b/accel-pptpd/CMakeLists.txt
index 1222085..12faecb 100644
--- a/accel-pptpd/CMakeLists.txt
+++ b/accel-pptpd/CMakeLists.txt
@@ -12,7 +12,21 @@ IF (NOT HAVE_SSL)
ENDIF (NOT HAVE_SSL)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fvisibility=hidden -D_GNU_SOURCE -DPTHREAD_SPINLOCK -DMEMDEBUG -fPIC")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fvisibility=hidden -D_GNU_SOURCE -DFUTEX_SPINLOCK -DMEMDEBUG -fPIC")
+
+IF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git)
+ EXECUTE_PROCESS(
+ COMMAND git log
+ COMMAND head -n1
+ COMMAND awk "{print $2}"
+ WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
+ OUTPUT_VARIABLE ACCEL_PPTP_VERSION
+ )
+ STRING(STRIP ${ACCEL_PPTP_VERSION} ACCEL_PPTP_VERSION)
+ELSE (EXISTS ${CMAKE_HOME_DIRECTORY}/.git)
+ SET (ACCEL_PPTP_VERSION ${CMAKE_HOME_DIRECTORY}/"1.3-rc")
+ENDIF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git)
+
+ADD_DEFINITIONS(-DACCEL_PPTP_VERSION="${ACCEL_PPTP_VERSION}")
INCLUDE_DIRECTORIES(include)
@@ -21,7 +35,7 @@ IF (NOT DEFINED RADIUS)
ENDIF (NOT DEFINED RADIUS)
IF (RADIUS)
- ADD_DEFINITIONS("-DRADIUS")
+ ADD_DEFINITIONS(-DRADIUS)
ADD_SUBDIRECTORY(radius)
ENDIF (RADIUS)
diff --git a/accel-pptpd/cli/telnet.c b/accel-pptpd/cli/telnet.c
index a4cee6b..4a2b93f 100644
--- a/accel-pptpd/cli/telnet.c
+++ b/accel-pptpd/cli/telnet.c
@@ -20,7 +20,6 @@
#include "cli_p.h"
#define RECV_BUF_SIZE 1024
-#define BANNER "accel-pptp-1.3-rc1\r\n"
#define AUTH_FAILED "\r\nAuthentication failed\r\n"
#define ESC_LEFT "[D"
@@ -167,7 +166,7 @@ static int cli_client_sendv(struct cli_client_t *tcln, const char *fmt, va_list
static int send_banner(struct telnet_client_t *cln)
{
- return telnet_send(cln, BANNER, sizeof(BANNER));
+ return telnet_send(cln, "accel-pptp version " ACCEL_PPTP_VERSION "\r\n", sizeof("accel-pptp version " ACCEL_PPTP_VERSION "\r\n"));
}
static int send_config(struct telnet_client_t *cln)
diff --git a/accel-pptpd/log.c b/accel-pptpd/log.c
index 7d0b485..7381427 100644
--- a/accel-pptpd/log.c
+++ b/accel-pptpd/log.c
@@ -34,7 +34,7 @@ struct _log_msg_t
uint8_t refs;
};
-static int log_level=10;
+static int log_level;
static LIST_HEAD(targets);
static mempool_t msg_pool;
@@ -454,6 +454,7 @@ static void __init log_init(void)
.sa_handler = sighup,
};
+
opt = conf_get_opt("log", "level");
if (opt && atoi(opt) >= 0)
log_level = atoi(opt);
@@ -477,5 +478,6 @@ static void __init log_init(void)
chunk_pool = mempool_create(sizeof(struct log_chunk_t) + LOG_CHUNK_SIZE + 1);
sigaction(SIGHUP, &sa, NULL);
+
}
diff --git a/accel-pptpd/main.c b/accel-pptpd/main.c
index 81537b0..71083a2 100644
--- a/accel-pptpd/main.c
+++ b/accel-pptpd/main.c
@@ -145,6 +145,8 @@ int main(int argc, char **argv)
if (triton_load_modules("modules"))
return EXIT_FAILURE;
+ log_msg("accel-pptp version %s\n", ACCEL_PPTP_VERSION);
+
triton_run();
sigfillset(&set);