compat: Add stoken__strcasestr()

Introduce a new src/compat.c to add functions that are unavailable on
non-Linux-glibc platforms.  The first addition is strcasestr(), which
is missing on MinGW.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
autoconf: check for mkstemps

mkstemps is missing on uClibc, and until recently was also missing with
musl-libc. Add an explicit check for this function.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
compat: Add stoken__mkstemps()

mkstemps() is missing on uClibc, so add a local copy (borrowed from
the Bionic / FreeBSD libc).

fixes #18

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
buildsys: Add linker and libtool flags for building Win32 DLLs

This is currently targeted for MinGW only.  References:

http://stackoverflow.com/questions/17487891/libtool-undefined-symbols-not-allowedin-i686-pc-mingw32-shared
http://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
library: Use STOKEN_EXPORT to implement Win32 __declspec requirement

On Windows, DLL imports/exports need to be explicitly declared.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
buildsys: Link with -lgmp if using nettle

stc-nettle.c uses gmp functions like mpz_init(), so we should link with
libgmp explicitly.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
compat: Add stoken__gmtime_r() for Windows

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
compat: Disable _gettemp() features that don't compile on Windows

MinGW seems to dislike our calls to mkdir() and lstat(), so omit them
for now.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
common: Don't #include <sys/mman.h> if we don't use mlockall()

Windows systems do not have this header file, so it will generate
a compile error.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
cli: Split out platform-specific tty code for Windows/Linux

Use common entry point names for the Linux and Win32 implementations;
add Win32 stubs.  Avoid including <termios.h> on Windows, as it breaks
the build.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
cli: Move fork_and_wait() into platform-specific sections

Windows doesn't have a <sys/wait.h>, and subprocess handling is likely
to differ quite a bit from Linux.  So let's move this out of the way
for now, so we can build the CLI for Linux (sans QR encoding support).

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
gui: Look for *.ui files in current dir on Windows

We do not yet have a good place to install these files, so just look
for them in the working directory.  This allows stoken-gui to start
up and display tokencodes.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
gui: Look for icon file in current dir on Windows

Similar to the previous change for *.ui.  This makes the app's icon show
up on the taskbar and on the window menu (alt-space).

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
buildsys: Add "make winpkg" target

This creates a zip file with all EXEs and DLLs needed to run stoken and
stoken-gui on Windows.  Experimental.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
README: Change to markdown format; update with GTK+3 and Windows info

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
securid: Avoid time_t overflows

The 14-bit time field in V2 tokens can represent dates beyond Jan 2038,
when 32-bit UNIX times (time_t) overflow.  Tokens that encode such a
date will erroneously show an expiration date in 1908, so we need to
add an explicit cap.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
tests: Use a token that expires in 2038

The original test token expires in Sept 2015, which will cause
"make check" to start failing on its own.  Generate a new test token
with an expiration date in 2038 so this will not be a concern.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
README: Add "stoken-gui --small" screenshot

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
m4: Create m4/ and update .gitignore files

We want to put third-party m4 scripts in this directory, but ignore the
autogenerated libtool scripts that show up after running autoreconf.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
m4: Split acinclude.m4 back into separate files under m4/

Autotools Mythbuster recommends using discrete files under m4/ instead
of combining everything into acinclude.m4.

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