Skip to content

Commit

Permalink
Rename to openconnect to avoid potential trademark issues
Browse files Browse the repository at this point in the history
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Oct 5, 2008
1 parent 6e47ba6 commit 5f8a741
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 69 deletions.
12 changes: 6 additions & 6 deletions Makefile
Expand Up @@ -37,17 +37,17 @@ OPENCONNECT_OBJS := main.o ssl_ui.o xml.o
CONNECTION_OBJS := dtls.o cstp.o mainloop.o tun.o
AUTH_OBJECTS := ssl.o http.o version.o

all: anyconnect nm-openconnect-auth-dialog
all: openconnect nm-openconnect-auth-dialog

version.c: $(patsubst %.o,%.c,$(OBJECTS)) anyconnect.h $(wildcard .git/index .git/refs/tags) version.sh
version.c: $(patsubst %.o,%.c,$(OBJECTS)) openconnect.h $(wildcard .git/index .git/refs/tags) version.sh
@./version.sh
@echo -en "New version.c: "
@cut -f2 -d\" version.c

libopenconnect.a: $(AUTH_OBJECTS)
$(AR) rcs $@ $^

anyconnect: $(OPENCONNECT_OBJS) $(CONNECTION_OBJS) libopenconnect.a
openconnect: $(OPENCONNECT_OBJS) $(CONNECTION_OBJS) libopenconnect.a
$(CC) -o $@ $^ $(LDFLAGS)

nm-openconnect-auth-dialog: nm-auth-dialog.o ssl_ui_gtk.o libopenconnect.a
Expand All @@ -57,11 +57,11 @@ nm-openconnect-auth-dialog: nm-auth-dialog.o ssl_ui_gtk.o libopenconnect.a
$(CC) -c -o $@ $(CFLAGS) $(CFLAGS_$@) $< -MD -MF .$@.dep

clean:
rm -f *.o anyconnect $(wildcard .*.o.dep)
rm -f *.o openconnect $(wildcard .*.o.dep)

install:
mkdir -p $(DESTDIR)/usr/bin
install -m0755 anyconnect $(DESTDIR)/usr/bin
install -m0755 openconnect $(DESTDIR)/usr/bin

include /dev/null $(wildcard .*.o.dep)

Expand All @@ -74,6 +74,6 @@ tag:
git tag v$(VERSION)

tarball:
git archive --format=tar --prefix=anyconnect-$(VERSION)/ v$(VERSION) | gzip -9 > anyconnect-$(VERSION).tar.gz
git archive --format=tar --prefix=openconnect-$(VERSION)/ v$(VERSION) | gzip -9 > openconnect-$(VERSION).tar.gz
endif

14 changes: 7 additions & 7 deletions cstp.c
Expand Up @@ -28,14 +28,14 @@
#include <openssl/ssl.h>
#include <openssl/err.h>

#include "anyconnect.h"
#include "openconnect.h"

/*
* Data packets are encapsulated in the SSL stream as follows:
*
* 0000: Magic "STF\x1"
* 0004: Big-endian 16-bit length (not including 8-byte header)
* 0006: Byte packet type (see anyconnect.h)
* 0006: Byte packet type (see openconnect.h)
* 0008: data payload
*/

Expand All @@ -59,7 +59,7 @@ static struct pkt dpd_resp_pkt = {
};


static int start_cstp_connection(struct anyconnect_info *vpninfo)
static int start_cstp_connection(struct openconnect_info *vpninfo)
{
char buf[65536];
int i;
Expand Down Expand Up @@ -259,7 +259,7 @@ static int start_cstp_connection(struct anyconnect_info *vpninfo)
}


int make_cstp_connection(struct anyconnect_info *vpninfo)
int make_cstp_connection(struct openconnect_info *vpninfo)
{
if (!vpninfo->https_ssl && openconnect_open_https(vpninfo))
exit(1);
Expand Down Expand Up @@ -294,7 +294,7 @@ int make_cstp_connection(struct anyconnect_info *vpninfo)
}


static int inflate_and_queue_packet(struct anyconnect_info *vpninfo, int type, void *buf, int len)
static int inflate_and_queue_packet(struct openconnect_info *vpninfo, int type, void *buf, int len)
{
struct pkt *new = malloc(sizeof(struct pkt) + vpninfo->mtu);

Expand Down Expand Up @@ -335,7 +335,7 @@ static int inflate_and_queue_packet(struct anyconnect_info *vpninfo, int type, v
return 0;
}

int cstp_mainloop(struct anyconnect_info *vpninfo, int *timeout)
int cstp_mainloop(struct openconnect_info *vpninfo, int *timeout)
{
unsigned char buf[16384];
int len, ret;
Expand Down Expand Up @@ -578,7 +578,7 @@ int cstp_mainloop(struct anyconnect_info *vpninfo, int *timeout)
return work_done;
}

int cstp_bye(struct anyconnect_info *vpninfo, char *reason)
int cstp_bye(struct openconnect_info *vpninfo, char *reason)
{
unsigned char *bye_pkt;
int reason_len = strlen(reason);
Expand Down
12 changes: 6 additions & 6 deletions dtls.c
Expand Up @@ -29,7 +29,7 @@
#include <openssl/err.h>
#include <fcntl.h>

#include "anyconnect.h"
#include "openconnect.h"

/*
* The master-secret is generated randomly by the client. The server
Expand Down Expand Up @@ -70,7 +70,7 @@ static unsigned char hex(const char *data)
return (nybble(data[0]) << 4) | nybble(data[1]);
}

int connect_dtls_socket(struct anyconnect_info *vpninfo)
int connect_dtls_socket(struct openconnect_info *vpninfo)
{
SSL_METHOD *dtls_method;
SSL_CIPHER *https_cipher;
Expand Down Expand Up @@ -169,7 +169,7 @@ int connect_dtls_socket(struct anyconnect_info *vpninfo)
return dtls_try_handshake(vpninfo);
}

int dtls_try_handshake(struct anyconnect_info *vpninfo)
int dtls_try_handshake(struct openconnect_info *vpninfo)
{
int ret = SSL_do_handshake(vpninfo->new_dtls_ssl);

Expand Down Expand Up @@ -230,7 +230,7 @@ int dtls_try_handshake(struct anyconnect_info *vpninfo)
return -EINVAL;
}

static int dtls_restart(struct anyconnect_info *vpninfo)
static int dtls_restart(struct openconnect_info *vpninfo)
{
if (vpninfo->dtls_ssl) {
SSL_free(vpninfo->dtls_ssl);
Expand All @@ -244,7 +244,7 @@ static int dtls_restart(struct anyconnect_info *vpninfo)
}


int setup_dtls(struct anyconnect_info *vpninfo)
int setup_dtls(struct openconnect_info *vpninfo)
{
struct vpn_option *dtls_opt = vpninfo->dtls_options;
int sessid_found = 0;
Expand Down Expand Up @@ -306,7 +306,7 @@ int setup_dtls(struct anyconnect_info *vpninfo)
return 0;
}

int dtls_mainloop(struct anyconnect_info *vpninfo, int *timeout)
int dtls_mainloop(struct openconnect_info *vpninfo, int *timeout)
{
unsigned char buf[2000];
int len;
Expand Down
23 changes: 15 additions & 8 deletions http.c
Expand Up @@ -35,7 +35,7 @@
#include <libxml/parser.h>
#include <libxml/tree.h>

#include "anyconnect.h"
#include "openconnect.h"

/*
* We didn't really want to have to do this for ourselves -- one might have
Expand All @@ -45,8 +45,8 @@
* provided by their caller.
*/

static int process_http_response(struct anyconnect_info *vpninfo, int *result,
int (*header_cb)(struct anyconnect_info *, char *, char *),
static int process_http_response(struct openconnect_info *vpninfo, int *result,
int (*header_cb)(struct openconnect_info *, char *, char *),
char *body, int buf_len)
{
char buf[65536];
Expand Down Expand Up @@ -344,7 +344,7 @@ static int add_securid_pin(char *pin)
return 1;
}

static int parse_auth_choice(struct anyconnect_info *vpninfo,
static int parse_auth_choice(struct openconnect_info *vpninfo,
xmlNode *xml_node, char *body, int bodylen)
{
char *form_name = (char *)xmlGetProp(xml_node, (unsigned char *)"name");
Expand Down Expand Up @@ -379,7 +379,7 @@ static int parse_auth_choice(struct anyconnect_info *vpninfo,
return -EINVAL;
}

static int parse_form(struct anyconnect_info *vpninfo, char *form_message,
static int parse_form(struct openconnect_info *vpninfo, char *form_message,
char *form_error, xmlNode *xml_node, char *body,
int bodylen)
{
Expand Down Expand Up @@ -479,7 +479,7 @@ static int parse_form(struct anyconnect_info *vpninfo, char *form_message,
return 0;
}

static int parse_xml_response(struct anyconnect_info *vpninfo, char *response,
static int parse_xml_response(struct openconnect_info *vpninfo, char *response,
char *request_body, int req_len)
{
char *form_message, *form_error;
Expand Down Expand Up @@ -547,7 +547,7 @@ static int parse_xml_response(struct anyconnect_info *vpninfo, char *response,
return -EINVAL;
}

static int fetch_config(struct anyconnect_info *vpninfo, char *fu, char *bu,
static int fetch_config(struct openconnect_info *vpninfo, char *fu, char *bu,
char *server_sha1)
{
struct vpn_option *opt;
Expand Down Expand Up @@ -600,7 +600,7 @@ static int fetch_config(struct anyconnect_info *vpninfo, char *fu, char *bu,
return write_new_config(vpninfo, buf, buflen);
}

int openconnect_obtain_cookie(struct anyconnect_info *vpninfo)
int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
{
struct vpn_option *opt, *next;
char buf[65536];
Expand Down Expand Up @@ -752,3 +752,10 @@ int openconnect_obtain_cookie(struct anyconnect_info *vpninfo)
fprintf(stderr, "Server claimed successful login, but no cookie!\n");
return -1;
}

char *openconnect_create_useragent(char *base)
{
char *uagent = malloc(strlen(base) + 1 + strlen(openconnect_version));
sprintf(uagent, "%s%s", base, openconnect_version);
return uagent;
}
14 changes: 7 additions & 7 deletions main.c
Expand Up @@ -36,7 +36,7 @@
#define _GNU_SOURCE
#include <getopt.h>

#include "anyconnect.h"
#include "openconnect.h"
#include "version.h"

int verbose = 0;
Expand Down Expand Up @@ -66,8 +66,8 @@ static struct option long_options[] = {

void usage(void)
{
printf("Usage: anyconnect [options] <server>\n");
printf("Open client for Cisco AnyConnect VPN, version " ANYCONNECT_VERSION "\n\n");
printf("Usage: openconnect [options] <server>\n");
printf("Open client for Cisco AnyConnect VPN, version %s\n\n", openconnect_version);
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");
Expand All @@ -92,7 +92,7 @@ void usage(void)

int main(int argc, char **argv)
{
struct anyconnect_info *vpninfo;
struct openconnect_info *vpninfo;
struct utsname utsbuf;
int cookieonly = 0;
int opt;
Expand All @@ -108,7 +108,7 @@ int main(int argc, char **argv)

/* Set up some defaults */
vpninfo->tun_fd = vpninfo->ssl_fd = vpninfo->dtls_fd = vpninfo->new_dtls_fd = -1;
vpninfo->useragent = "Open AnyConnect VPN Agent " ANYCONNECT_VERSION;
vpninfo->useragent = openconnect_create_useragent("Open AnyConnect VPN Agent %s");
vpninfo->mtu = 1406;
vpninfo->deflate = 1;
vpninfo->dtls_attempt_period = 60;
Expand Down Expand Up @@ -183,7 +183,7 @@ int main(int argc, char **argv)
verbose = 1;
break;
case 'V':
printf("Open AnyConnect version " ANYCONNECT_VERSION "\n");
printf("OpenConnect version " ANYCONNECT_VERSION "\n");
exit(0);
case 'x':
vpninfo->xmlconfig = optarg;
Expand Down Expand Up @@ -240,7 +240,7 @@ int main(int argc, char **argv)
exit(1);
}

int write_new_config(struct anyconnect_info *vpninfo, char *buf, int buflen)
int write_new_config(struct openconnect_info *vpninfo, char *buf, int buflen)
{
int config_fd;

Expand Down
6 changes: 3 additions & 3 deletions mainloop.c
Expand Up @@ -28,7 +28,7 @@
#include <signal.h>
#include <arpa/inet.h>

#include "anyconnect.h"
#include "openconnect.h"

void queue_packet(struct pkt **q, struct pkt *new)
{
Expand All @@ -53,7 +53,7 @@ int queue_new_packet(struct pkt **q, int type, void *buf, int len)
return 0;
}

int vpn_add_pollfd(struct anyconnect_info *vpninfo, int fd, short events)
int vpn_add_pollfd(struct openconnect_info *vpninfo, int fd, short events)
{
vpninfo->nfds++;
vpninfo->pfds = realloc(vpninfo->pfds, sizeof(struct pollfd) * vpninfo->nfds);
Expand All @@ -74,7 +74,7 @@ static void handle_sigint(int sig)
killed = sig;
}

int vpn_mainloop(struct anyconnect_info *vpninfo)
int vpn_mainloop(struct openconnect_info *vpninfo)
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
Expand Down
12 changes: 6 additions & 6 deletions nm-auth-dialog.c
Expand Up @@ -30,7 +30,7 @@

#include "auth-dlg-settings.h"
#include "version.h"
#include "anyconnect.h"
#include "openconnect.h"

static char *get_config_path(GConfClient *gcl, const char *vpn_uuid)
{
Expand Down Expand Up @@ -87,7 +87,7 @@ static char *get_gconf_setting(GConfClient *gcl, char *config_path,
static GConfClient *gcl;
static char *config_path;

static int get_config(char *vpn_uuid, struct anyconnect_info *vpninfo)
static int get_config(char *vpn_uuid, struct openconnect_info *vpninfo)
{
char *authtype;

Expand Down Expand Up @@ -139,7 +139,7 @@ static int get_config(char *vpn_uuid, struct anyconnect_info *vpninfo)
}


static int get_cookie(const char *vpn_uuid, struct anyconnect_info *vpninfo)
static int get_cookie(const char *vpn_uuid, struct openconnect_info *vpninfo)
{
openconnect_init_openssl();
openconnect_obtain_cookie(vpninfo);
Expand All @@ -148,7 +148,7 @@ static int get_cookie(const char *vpn_uuid, struct anyconnect_info *vpninfo)
return 0;
}

int write_new_config(struct anyconnect_info *vpninfo, char *buf, int buflen)
int write_new_config(struct openconnect_info *vpninfo, char *buf, int buflen)
{
char *key = g_strdup_printf("%s/vpn/%s", config_path,
NM_OPENCONNECT_KEY_XMLCONFIG);
Expand All @@ -170,7 +170,7 @@ int main (int argc, char **argv)
{
char *vpn_name = NULL, *vpn_uuid = NULL, *vpn_service = NULL;
int reprompt;
struct anyconnect_info *vpninfo;
struct openconnect_info *vpninfo;
int opt;
char read_buf;

Expand Down Expand Up @@ -222,7 +222,7 @@ int main (int argc, char **argv)

vpninfo->urlpath = strdup("/");
vpninfo->mtu = 1406;
vpninfo->useragent = "Open AnyConnect VPN Agent " ANYCONNECT_VERSION "(NetworkManager)";
vpninfo->useragent = openconnect_create_useragent("OpenConnect VPN Agent (NetworkManager)");
vpninfo->ssl_fd = -1;

set_openssl_ui();
Expand Down

0 comments on commit 5f8a741

Please sign in to comment.