library: Update changelog and bump minor version

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
main: Add openconnect_vpninfo_free() on a couple of exit paths

This makes it easier to check for library memory leaks.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
buildsys: Allow overriding -W flags

For any given source file, automake will apply either
"$(AM_CFLAGS) $(CFLAGS)" or "$(objname_CFLAGS) $(CFLAGS)" [1].  Move the
warning flags into the former item so that they can be disabled on a per-
object basis.

[1] http://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
acinclude: Add AX_JNI_INCLUDE_DIR macro

AX_JNI_INCLUDE_DIR is used to locate jni.h for building the Java Native
Interface to libopenconnect.  Original source:

http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html

This commit also includes two pending enhancements:

http://savannah.gnu.org/patch/?8154
http://savannah.gnu.org/patch/?8155

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
JNI: Initial commit of C wrapper functions

If the user runs "configure --with-java", a separate library is built
with Java native interface stubs and it can be loaded with:

    System.loadLibrary("openconnect-wrapper");

On a native build, it should autodetect the jni.h location by looking at
JAVA_HOME or the path to javac.  On a cross build,
--with-java=/java_home/include must be explicitly specified.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
JNI: Initial commit of Java library + example program

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Bump gmp up to version 5.1.2

binutils 2.23.2, which is part of the arm-linux-androideabi-4.8
toolchain in NDK r9, fails to compile gmp without the following
workaround from v5.1.2:

    * mpn/arm/udiv.asm: Change spacing to work around binutils bug.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Enable JNI in build

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Add libstoken to build

This was tested with NDK release r8e on ARM (on a real device) and
x86 (compile only).

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Add liboath to build

Compile-tested with NDK r9:

    make NDK=/opt/android-ndk-r9 GCCVER=4.8

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Honor $TMPDIR when writing CSD script

Android doesn't have /tmp, so honor $TMPDIR if the caller sets it to
an alternate location.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
auth: Fix comment in parse_form()

This function never actually returns 1.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Add "sources" target

Provide an easy way to download and extract the source tarballs in
anticipation of a multiplatform build.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Fix broken ARCH=mips build

The MIPS NDK doesn't seem to handle dependencies correctly.  i.e.

libopenconnect.so references symbols in libz.so (from the toolchain's
sysroot), so it has a NEEDED entry for libz.so.  It was linked with -lz.

openconnect links in libopenconnect.so, but doesn't use zlib directly so
it isn't linked with -lz.

This causes a link failure on MIPS only:

    /opt/android-ndk-r9/toolchains/mipsel-linux-android-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/mipsel-linux-android/4.8/../../../../mipsel-linux-android/bin/ld: warning: libz.so, needed by ./.libs/libopenconnect.so, not found (try using -rpath or -rpath-link)
    ./.libs/libopenconnect.so: undefined reference to `deflateEnd'
    ./.libs/libopenconnect.so: undefined reference to `inflate'
    ./.libs/libopenconnect.so: undefined reference to `inflateInit2_'
    ./.libs/libopenconnect.so: undefined reference to `deflate'
    ./.libs/libopenconnect.so: undefined reference to `adler32'
    ./.libs/libopenconnect.so: undefined reference to `inflateEnd'
    ./.libs/libopenconnect.so: undefined reference to `deflateInit2_'
    collect2: error: ld returned 1 exit status
    make[2]: *** [openconnect] Error 1

ARM/x86 are fine.  So we'll use a temporary workaround on MIPS only,
until it's resolved.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Add .gitignore file

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
android: Update Makefile to use NDK r9b

NDK gcc 4.7 is now deprecated, so let's recommend NDK r9b + gcc 4.8.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
library: Use named constants for process_auth_form() return value

Currently we have 3 valid results, and we're about to add a fourth.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
main: Move username/password/authgroup vars into main.c

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
auth: Add <group-access> node to XML POST initial request

This ensures that we get the form and <opaque> data corresponding to the
authgroup in use.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
auth: Add oc_choice->selected flag

In XML POST mode, the gateway keeps track of which authgroup is selected.
Provide this information to the UI so that the interface can be rendered
correctly.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>