Skip to content

Commit

Permalink
Add sanity check that libopenconnect matches the openconnect executable
Browse files Browse the repository at this point in the history
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Nov 7, 2011
1 parent 76ab44c commit 2ed842d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -31,6 +31,7 @@ EXTRA_DIST = version.sh openconnect.html openconnect.8 COPYING.LGPL

DISTCLEANFILES = $(pkgconfig_DATA)

main.o: version.c
version.c: $(library_srcs) $(openconnect_SOURCES) Makefile.am configure.ac \
openconnect.h openconnect-internal.h version.sh @GITVERSIONDEPS@
@cd $(srcdir) && ./version.sh $@
Expand Down
12 changes: 12 additions & 0 deletions main.c
Expand Up @@ -60,6 +60,12 @@ static void syslog_progress(void *_vpninfo,
static int validate_peer_cert(void *_vpninfo,
X509 *peer_cert, const char *reason);

/* A sanity check that the openconnect executable is running against a
library of the same version */
#define openconnect_version openconnect_binary_version
#include "version.c"
#undef openconnect_version

int verbose = PRG_INFO;
int background;
int do_passphrase_from_fsid;
Expand Down Expand Up @@ -244,6 +250,12 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
#endif

if (strcmp(openconnect_version, openconnect_binary_version)) {
fprintf(stderr, _("WARNING: This version of openconnect is %s but\n"
" the libopenconnect library is %s\n"),
openconnect_binary_version, openconnect_version);
}

openconnect_init_openssl();

vpninfo = malloc(sizeof(*vpninfo));
Expand Down

0 comments on commit 2ed842d

Please sign in to comment.