ifdef RPM_OPT_FLAGS
-CFLAGS := $(RPM_OPT_FLAGS)
+OPT_FLAGS := $(RPM_OPT_FLAGS)
else
-CFLAGS := -O2 -g -Wall
+OPT_FLAGS := -O2 -g -Wall
endif
-#M32 := -m32
-#OPENSSL := /home/dwmw2/working/openssl-0.9.8f
-
+# Allow people to override OpenSSL and build it statically, if they need
+# a special build for the DTLS support
ifdef OPENSSL
-CFLAGS += -I$(OPENSSL)/include $(M32)
-LDFLAGS += -lz $(OPENSSL)/libssl.a $(OPENSSL)/libcrypto.a -ldl $(M32)
+SSL_CFLAGS += -I$(OPENSSL)/include
+SSL_LDFLAGS += -lz $(OPENSSL)/libssl.a $(OPENSSL)/libcrypto.a -ldl
else
-CFLAGS += -I/usr/include/openssl $(M32)
-LDFLAGS += -lssl $(M32)
+SSL_CFLAGS += -I/usr/include/openssl
+SSL_LDFLAGS += -lssl
endif
-CFLAGS += $(shell xml2-config --cflags)
-LDFLAGS += $(shell xml2-config --libs)
+XML2_CFLAGS += $(shell xml2-config --cflags)
+XML2_LDFLAGS += $(shell xml2-config --libs)
+
+CFLAGS := $(OPT_FLAGS) $(SSL_CFLAGS) $(XML2_CFLAGS) $(EXTRA_CFLAGS)
+LDFLAGS := $(SSL_LDFLAGS) $(XML2_LDFLAGS) $(EXTRA_LDFLAGS)
OBJECTS := main.o tun.o dtls.o ssl.o mainloop.o xml.o http.o
all: anyconnect getwebvpn
+version.h: $(patsubst %.o,%.c,$(OBJECTS)) anyconnect.h $(wildcard .git/index)
+ @./version.sh
+
anyconnect: $(OBJECTS)
$(CC) -o $@ $^ $(LDFLAGS)
clean:
rm -f $(OBJECTS) anyconnect getwebvpn $(wildcard .*.o.dep)
+install:
+ mkdir -p $(DESTDIR)/usr/bin
+ install -m0755 anyconnect $(DESTDIR)/usr/bin
+
include /dev/null $(wildcard .*.o.dep)
#include <getopt.h>
#include "anyconnect.h"
+#include "version.h"
int verbose = 0;
{"tpm-password", 1, 0, 'p'},
{"user", 1, 0, 'u'},
{"verbose", 1, 0, 'v'},
+ {"version", 1, 0, 'V'},
{"cafile", 1, 0, '0'},
{"no-dtls", 0, 0, '1'},
{"cookieonly", 0, 0, '2'},
void usage(void)
{
printf("Usage: anyconnect [options] <server>\n");
- printf("Connect to Cisco AnyConnect server.\n\n");
+ printf("Open client for Cisco AnyConnect VPN, version " ANYCONNECT_VERSION "\n\n");
printf(" -c, --certificate=CERT Use SSL client certificate CERT\n");
printf(" -k, --sslkey=KEY Use SSL private key file KEY\n");
printf(" -C, --cookie=COOKIE Use WebVPN cookie COOKIE\n");
printf(" -s, --script=SCRIPT Use vpnc-compatible config script\n");
printf(" -t, --tpm Use TPM engine for private key\n");
printf(" -u, --user=NAME Set login username\n");
+ printf(" -V, --version Report version number\n");
printf(" -v, --verbose More output\n");
printf(" -x, --xmlconfig=CONFIG XML config file\n");
- printf(" --fetchcookie Fetch webvpn cookie only; don't connect\n");
+ printf(" --cookieonly Fetch webvpn cookie only; don't connect\n");
printf(" --printcookie Print webvpn cookie before connecting\n");
printf(" --cafile=FILE Cert file for server verification\n");
printf(" --no-dtls Disable DTLS\n");
/* Set up some defaults */
vpninfo->ifname = "cisco0";
vpninfo->tun_fd = vpninfo->ssl_fd = vpninfo->dtls_fd = -1;
- vpninfo->useragent = "Open AnyConnect VPN Agent v0.01";
+ vpninfo->useragent = "Open AnyConnect VPN Agent v" ANYCONNECT_VERSION;
vpninfo->mtu = 1406;
vpninfo->deflate = 1;
vpninfo->trydtls = 1;
else
vpninfo->localname = "localhost";
- while ((opt = getopt_long(argc, argv, "C:c:hvdDu:i:tk:p:s:hx:",
+ while ((opt = getopt_long(argc, argv, "C:c:hvdDu:i:tk:p:s:hx:V",
long_options, NULL))) {
if (opt < 0)
break;
case 'v':
verbose = 1;
break;
+ case 'V':
+ printf("Open AnyConnect version " ANYCONNECT_VERSION "\n");
+ exit(0);
case 'x':
vpninfo->xmlconfig = optarg;
break;