Merge branch 'master' into 1.1

Conflicts:
	lib/utils.c
	src/net_setup.c
	src/process.c
	src/protocol_auth.c
	src/protocol_key.c
	src/utils.h
This commit is contained in:
Guus Sliepen 2012-09-30 15:00:47 +02:00
commit 6dfdb32361
9 changed files with 69 additions and 7 deletions

17
.gitignore vendored Normal file
View file

@ -0,0 +1,17 @@
Makefile
Makefile.in
*.o
*.a
/config.*
/src/tincd
/autom4te.cache
/aclocal.m4
/compile
/configure
/depcomp
/install-sh
/missing
INSTALL
.deps
stamp-h1
/src/device.c

20
README.android Normal file
View file

@ -0,0 +1,20 @@
Quick how-o cross compile tinc for android (done from $HOME/android/):
- Download android NDK and setup local ARM toolchain:
wget http://dl.google.com/android/ndk/android-ndk-r8b-linux-x86.tar.bz2
tar xfj android-ndk-r8b-linux-x86.tar.bz2
./android-ndk-r8b/build/tools/make-standalone-toolchain.sh --platform=android-5 --install-dir=/tmp/my-android-toolchain
- Download and cross-compile openSSL for ARM:
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar xfz openssl-1.0.1c.tar.gz
cd openssl-1.0.1c
./Configure dist
make CC=/tmp/my-android-toolchain/bin/arm-linux-androideabi-gcc AR="/tmp/my-android-toolchain/bin/arm-linux-androideabi-ar r" RANLIB=/tmp/my-android-toolchain/bin/arm-linux-androideabi-ranlib
- Clone and cross-compile tinc:
git clone git://tinc-vpn.org/tinc
cd tinc
autoreconf -fsi
CC=/tmp/my-android-toolchain/bin/arm-linux-androideabi-gcc ./configure --host=arm-linux --disable-lzo --with-openssl-lib=$HOME/android/openssl-1.0.1c --with-openssl-include=$HOME/android/openssl-1.0.1c/include/
make -j5

2
THANKS
View file

@ -28,6 +28,7 @@ We would like to thank the following people for their contributions to tinc:
* Mark Glines
* Markus Goetz
* Martin Kihlgren
* Martin Schürrer
* Matias Carrasco
* Max Rijevski
* Menno Smits
@ -45,6 +46,7 @@ We would like to thank the following people for their contributions to tinc:
* Teemu Kiviniemi
* Timothy Redaelli
* Tonnerre Lombard
* Vil Brekin
* Wessel Dankers
* Wouter van Heyst

View file

@ -229,7 +229,7 @@ static bool read_rsa_private_key(void) {
result = rsa_set_hex_private_key(&myself->connection->rsa, n, "FFFF", d);
free(n);
free(d);
return true;
return result;
}
/* Else, check for PrivateKeyFile statement and read it */

View file

@ -29,16 +29,21 @@
bool rsa_set_hex_public_key(rsa_t *rsa, char *n, char *e) {
*rsa = RSA_new();
BN_hex2bn(&(*rsa)->n, n);
BN_hex2bn(&(*rsa)->e, e);
if(BN_hex2bn(&(*rsa)->n, n) != strlen(n))
return false;
if(BN_hex2bn(&(*rsa)->e, e) != strlen(e))
return false;
return true;
}
bool rsa_set_hex_private_key(rsa_t *rsa, char *n, char *e, char *d) {
*rsa = RSA_new();
BN_hex2bn(&(*rsa)->n, n);
BN_hex2bn(&(*rsa)->e, e);
BN_hex2bn(&(*rsa)->d, d);
if(BN_hex2bn(&(*rsa)->n, n) != strlen(n))
return false;
if(BN_hex2bn(&(*rsa)->e, e) != strlen(e))
return false;
if(BN_hex2bn(&(*rsa)->d, d) != strlen(d))
return false;
return true;
}

View file

@ -229,6 +229,7 @@ bool execute_script(const char *name, char **envp) {
int status, len;
char *scriptname;
int i;
char *interpreter = NULL;
#ifndef HAVE_MINGW
len = xasprintf(&scriptname, "\"%s" SLASH "%s\"", confbase, name);
@ -249,8 +250,19 @@ bool execute_script(const char *name, char **envp) {
}
#endif
// Custom scripts interpreter
if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &interpreter)) {
// Force custom scripts interpreter allowing execution of scripts on android without execution flag (such as on /sdcard)
free(scriptname);
len = xasprintf(&scriptname, "%s \"%s/%s\"", interpreter, confbase, name);
free(interpreter);
if(len < 0)
return false;
}
logger(DEBUG_STATUS, LOG_INFO, "Executing script %s", name);
#ifdef HAVE_PUTENV
/* Set environment */

View file

@ -334,6 +334,9 @@ bool ans_key_h(connection_t *c, const char *request) {
return send_request(to->nexthop->connection, "%s", request);
}
/* Don't use key material until every check has passed. */
from->status.validkey = false;
if(compression < 0 || compression > 11) {
logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses bogus compression level!", from->name, from->hostname);
return true;

View file

@ -329,8 +329,11 @@ static bool drop_privs(void) {
"initgroups", strerror(errno));
return false;
}
#ifndef __ANDROID__
// Not supported in android NDK
endgrent();
endpwent();
#endif
}
if (do_chroot) {
tzset(); /* for proper timestamps in logs */

View file

@ -48,7 +48,7 @@ static int charb64decode(char c) {
int hex2bin(const char *src, char *dst, int length) {
int i;
for(i = 0; i < length && src[i * 2] && src[i * 2 + 1]; i++)
for(i = 0; i < length && isxdigit(src[i * 2]) && isxdigit(src[i * 2 + 1]); i++)
dst[i] = charhex2bin(src[i * 2]) * 16 + charhex2bin(src[i * 2 + 1]);
return i;
}