diff --git a/.gitignore b/.gitignore index 277bb26d..fcfb0b01 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ gl/unistd.h gl/fcntl.h gl/stdint.h gl/sys/types.h +src/version.def diff --git a/configure.ac b/configure.ac index 7255e8eb..41a997e1 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,7 @@ LIBOPTS_CHECK([libopts]) AC_CONFIG_FILES([ Makefile + src/version.def src/Makefile doc/Makefile gl/Makefile diff --git a/doc/ocserv.1 b/doc/ocserv.1 index 8038b513..9334f749 100644 --- a/doc/ocserv.1 +++ b/doc/ocserv.1 @@ -1,8 +1,8 @@ -.TH ocserv 1 "16 Feb 2013" "" "User Commands" +.TH ocserv 1 "16 Feb 2013" "0.0.1" "User Commands" .\" .\" DO NOT EDIT THIS FILE (ocserv-args.man) .\" -.\" It has been AutoGen-ed February 16, 2013 at 04:33:33 PM by AutoGen 5.16 +.\" It has been AutoGen-ed February 16, 2013 at 04:40:04 PM by AutoGen 5.16 .\" From the definitions ../src/ocserv-args.def.tmp .\" and the template file agman-cmd.tpl .\" @@ -49,6 +49,11 @@ Display usage information and exit. .TP .BR \-! , " \-\-more-help" Pass the extended usage information through a pager. +.TP +.BR \-v " [{\fIv|c|n\fP}]," " \-\-version" "[=\fI{v|c|n}\fP]" +Output version of program and exit. The default mode is `v', a simple +version. The `c' mode will print copyright information and `n' will +print the full copyright notice. .SH AUTHENTICATION .br \fBPassword authentication\fP diff --git a/src/Makefile.am b/src/Makefile.am index 816ca175..99301e86 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = -I$(srcdir)/../gl/ -I$(builddir)/../gl/ \ -I$(srcdir)/ -I$(builddir)/../ -I$(srcdir)/../libopts -EXTRA_DIST = ccan/licenses/BSD-MIT \ +EXTRA_DIST = ccan/licenses/BSD-MIT version.def.in \ ccan/licenses/CC0 ccan/licenses/LGPL-2.1 diff --git a/src/ocserv-args.c b/src/ocserv-args.c index b4e1bb93..959687f5 100644 --- a/src/ocserv-args.c +++ b/src/ocserv-args.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (ocserv-args.c) * - * It has been AutoGen-ed February 16, 2013 at 04:33:31 PM by AutoGen 5.16 + * It has been AutoGen-ed February 16, 2013 at 04:40:03 PM by AutoGen 5.16 * From the definitions ocserv-args.def * and the template file options * @@ -55,7 +55,7 @@ extern FILE * option_usage_fp; /* TRANSLATORS: choose the translation for option names wisely because you cannot ever change your mind. */ #define zCopyright (ocserv_opt_strs+0) -#define zLicenseDescrip (ocserv_opt_strs+248) +#define zLicenseDescrip (ocserv_opt_strs+254) #ifndef NULL @@ -65,13 +65,13 @@ extern FILE * option_usage_fp; /* * ocserv option static const strings */ -static char const ocserv_opt_strs[1970] = -/* 0 */ "ocserv\n" +static char const ocserv_opt_strs[2046] = +/* 0 */ "ocserv 0.0.1\n" "Copyright (C) 2013 Nikos Mavrogiannopoulos, all rights reserved.\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the\n" "GNU General Public License, version 2 \n\0" -/* 248 */ "ocserv is free software: you can redistribute it and/or modify it under the\n" +/* 254 */ "ocserv is free software: you can redistribute it and/or modify it under the\n" "terms of version 2 of the GNU General Public License, as published by the\n" "Free Software Foundation.\n\n" "ocserv is distributed in the hope that it will be useful, but WITHOUT ANY\n" @@ -80,28 +80,30 @@ static char const ocserv_opt_strs[1970] = "details.\n\n" "You should have received a copy of the GNU General Public License, version\n" "2, along with this program. If not, see .\n\0" -/* 803 */ "Do not fork into background\0" -/* 831 */ "FOREGROUND\0" -/* 842 */ "foreground\0" -/* 853 */ "Enable verbose TLS debugging information\0" -/* 894 */ "TLS_DEBUG\0" -/* 904 */ "tls-debug\0" -/* 914 */ "Enable verbose network debugging information\0" -/* 959 */ "DEBUG\0" -/* 965 */ "debug\0" -/* 971 */ "Configuration file for the server\0" -/* 1005 */ "CONFIG\0" -/* 1012 */ "config\0" -/* 1019 */ "Display extended usage information and exit\0" -/* 1063 */ "help\0" -/* 1068 */ "Extended usage information passed thru pager\0" -/* 1113 */ "more-help\0" -/* 1123 */ "OCSERV\0" -/* 1130 */ "ocserv - OpenConnect server\n" +/* 809 */ "Do not fork into background\0" +/* 837 */ "FOREGROUND\0" +/* 848 */ "foreground\0" +/* 859 */ "Enable verbose TLS debugging information\0" +/* 900 */ "TLS_DEBUG\0" +/* 910 */ "tls-debug\0" +/* 920 */ "Enable verbose network debugging information\0" +/* 965 */ "DEBUG\0" +/* 971 */ "debug\0" +/* 977 */ "Configuration file for the server\0" +/* 1011 */ "CONFIG\0" +/* 1018 */ "config\0" +/* 1025 */ "Display extended usage information and exit\0" +/* 1069 */ "help\0" +/* 1074 */ "Extended usage information passed thru pager\0" +/* 1119 */ "more-help\0" +/* 1129 */ "Output version information and exit\0" +/* 1165 */ "version\0" +/* 1173 */ "OCSERV\0" +/* 1180 */ "ocserv - OpenConnect server - Ver. 0.0.1\n" "USAGE: %s [ - [] | --[{=| }] ]...\n\0" -/* 1216 */ "openconnect-devel@lists.infradead.org\0" -/* 1254 */ "\n\n\0" -/* 1257 */ "\n" +/* 1279 */ "openconnect-devel@lists.infradead.org\0" +/* 1317 */ "\n\n\0" +/* 1320 */ "\n" "This program is openconnect VPN server (ocserv), a server compatible with\n" "the openconnect VPN client. It is believed to be compatible with the\n" "protocol used by CISCO's AnyConnect SSL VPN.\n\n" @@ -112,56 +114,65 @@ static char const ocserv_opt_strs[1970] = "Currently there is no tool to manipulate logged-in users. However, they\n" "can be disconnected by killing their worker process. The pid of that\n" "process can be seen with ``who -u'' if utmp logging is enabled.\n\0" -/* 1895 */ "Usage: ocserv [options] -c [config]\n" +/* 1958 */ "ocserv 0.0.1\0" +/* 1971 */ "Usage: ocserv [options] -c [config]\n" "ocserv --help for usage instructions.\n"; /* * foreground option description: */ -#define FOREGROUND_DESC (ocserv_opt_strs+803) -#define FOREGROUND_NAME (ocserv_opt_strs+831) -#define FOREGROUND_name (ocserv_opt_strs+842) +#define FOREGROUND_DESC (ocserv_opt_strs+809) +#define FOREGROUND_NAME (ocserv_opt_strs+837) +#define FOREGROUND_name (ocserv_opt_strs+848) #define FOREGROUND_FLAGS (OPTST_DISABLED) /* * tls-debug option description: */ -#define TLS_DEBUG_DESC (ocserv_opt_strs+853) -#define TLS_DEBUG_NAME (ocserv_opt_strs+894) -#define TLS_DEBUG_name (ocserv_opt_strs+904) +#define TLS_DEBUG_DESC (ocserv_opt_strs+859) +#define TLS_DEBUG_NAME (ocserv_opt_strs+900) +#define TLS_DEBUG_name (ocserv_opt_strs+910) #define TLS_DEBUG_FLAGS (OPTST_DISABLED) /* * debug option description: */ -#define DEBUG_DESC (ocserv_opt_strs+914) -#define DEBUG_NAME (ocserv_opt_strs+959) -#define DEBUG_name (ocserv_opt_strs+965) +#define DEBUG_DESC (ocserv_opt_strs+920) +#define DEBUG_NAME (ocserv_opt_strs+965) +#define DEBUG_name (ocserv_opt_strs+971) #define DEBUG_FLAGS (OPTST_DISABLED) /* * config option description: */ -#define CONFIG_DESC (ocserv_opt_strs+971) -#define CONFIG_NAME (ocserv_opt_strs+1005) -#define CONFIG_name (ocserv_opt_strs+1012) +#define CONFIG_DESC (ocserv_opt_strs+977) +#define CONFIG_NAME (ocserv_opt_strs+1011) +#define CONFIG_name (ocserv_opt_strs+1018) #define CONFIG_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE)) /* - * Help/More_Help option descriptions: + * Help/More_Help/Version option descriptions: */ -#define HELP_DESC (ocserv_opt_strs+1019) -#define HELP_name (ocserv_opt_strs+1063) +#define HELP_DESC (ocserv_opt_strs+1025) +#define HELP_name (ocserv_opt_strs+1069) #ifdef HAVE_WORKING_FORK -#define MORE_HELP_DESC (ocserv_opt_strs+1068) -#define MORE_HELP_name (ocserv_opt_strs+1113) +#define MORE_HELP_DESC (ocserv_opt_strs+1074) +#define MORE_HELP_name (ocserv_opt_strs+1119) #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) #else #define MORE_HELP_DESC NULL #define MORE_HELP_name NULL #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) #endif +#ifdef NO_OPTIONAL_OPT_ARGS +# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT) +#else +# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ + OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT) +#endif +#define VER_DESC (ocserv_opt_strs+1129) +#define VER_name (ocserv_opt_strs+1165) /* * Declare option callback procedures */ @@ -172,6 +183,7 @@ extern tOptProc optionUnstackArg, optionVendorOption; static tOptProc doOptConfig, doUsageOpt; +#define VER_PROC optionPrintVersion /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** @@ -228,6 +240,20 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ CONFIG_DESC, CONFIG_NAME, CONFIG_name, /* disablement strs */ NULL, NULL }, + { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, + /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ VER_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ VER_PROC, + /* desc, NAME, name */ VER_DESC, NULL, VER_name, + /* disablement strs */ NULL, NULL }, + + + { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP, /* equivalenced to */ NO_EQUIVALENT, @@ -258,14 +284,14 @@ static tOptDesc optDesc[OPTION_CT] = { * * Define the ocserv Option Environment */ -#define zPROGNAME (ocserv_opt_strs+1123) -#define zUsageTitle (ocserv_opt_strs+1130) +#define zPROGNAME (ocserv_opt_strs+1173) +#define zUsageTitle (ocserv_opt_strs+1180) #define zRcName NULL #define apzHomeList NULL -#define zBugsAddr (ocserv_opt_strs+1216) -#define zExplain (ocserv_opt_strs+1254) -#define zDetail (ocserv_opt_strs+1257) -#define zFullVersion (NULL) +#define zBugsAddr (ocserv_opt_strs+1279) +#define zExplain (ocserv_opt_strs+1317) +#define zDetail (ocserv_opt_strs+1320) +#define zFullVersion (ocserv_opt_strs+1958) /* extracted from optcode.tlib near line 350 */ #if defined(ENABLE_NLS) @@ -279,7 +305,7 @@ static tOptDesc optDesc[OPTION_CT] = { #define ocserv_full_usage (NULL) -#define ocserv_short_usage (ocserv_opt_strs+1895) +#define ocserv_short_usage (ocserv_opt_strs+1971) #endif /* not defined __doxygen__ */ @@ -385,7 +411,7 @@ tOptions ocservOptions = { NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 6 /* full option count */, 4 /* user option count */, + 7 /* full option count */, 4 /* user option count */, ocserv_full_usage, ocserv_short_usage, NULL, NULL, PKGDATADIR, ocserv_packager_info diff --git a/src/ocserv-args.def b/src/ocserv-args.def index f879b1e2..73f6e683 100644 --- a/src/ocserv-args.def +++ b/src/ocserv-args.def @@ -10,7 +10,7 @@ long-opts; no-misuse-usage; short-usage = "Usage: ocserv [options] -c [config]\nocserv --help for usage instructions.\n"; explain = ""; - +#include version.def detail = "This program is openconnect VPN server (ocserv), a server compatible with the openconnect VPN client. It is believed to be compatible with the protocol @@ -23,8 +23,7 @@ a networking (tun) device and IP from a configurable pool of address. Currently there is no tool to manipulate logged-in users. However, they can be disconnected by killing their worker process. The pid of that -process can be seen with @var{who -u} if utmp logging is enabled. -"; +process can be seen with @var{who -u} if utmp logging is enabled."; copyright = { diff --git a/src/ocserv-args.h b/src/ocserv-args.h index 532f07ac..93311a12 100644 --- a/src/ocserv-args.h +++ b/src/ocserv-args.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (ocserv-args.h) * - * It has been AutoGen-ed February 16, 2013 at 04:33:31 PM by AutoGen 5.16 + * It has been AutoGen-ed February 16, 2013 at 04:40:02 PM by AutoGen 5.16 * From the definitions ocserv-args.def * and the template file options * @@ -70,11 +70,14 @@ typedef enum { INDEX_OPT_TLS_DEBUG = 1, INDEX_OPT_DEBUG = 2, INDEX_OPT_CONFIG = 3, - INDEX_OPT_HELP = 4, - INDEX_OPT_MORE_HELP = 5 + INDEX_OPT_VERSION = 4, + INDEX_OPT_HELP = 5, + INDEX_OPT_MORE_HELP = 6 } teOptIndex; -#define OPTION_CT 6 +#define OPTION_CT 7 +#define OCSERV_VERSION "0.0.1" +#define OCSERV_FULL_VERSION "ocserv 0.0.1" /* * Interface defines for all options. Replace "n" with the UPPER_CASED @@ -116,6 +119,7 @@ typedef enum { #define VALUE_OPT_CONFIG 'c' #define VALUE_OPT_HELP 'h' #define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION 'v' /* * Interface defines not associated with particular options */ diff --git a/src/version.def.in b/src/version.def.in new file mode 100644 index 00000000..db6968ab --- /dev/null +++ b/src/version.def.in @@ -0,0 +1 @@ +version = "@VERSION@";