Basic patch for android cross-compilation.
authorVilbrekin <vilbrekin@gmail.com>
Wed, 22 Aug 2012 08:46:24 +0000 (10:46 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 24 Sep 2012 11:53:11 +0000 (13:53 +0200)
Commented non-existing functions in android NDK.
Prefix scripts execution with shell binary to allow execution on no-exec mount points.
Everyything is currently hard coded, while it should use pre-compiler variables...

src/process.c
src/tincd.c

index f33355ce1e739ff2837f8df919b3234f98fd37ca..41a1468d952d8c08b31ec3fd360741aa6e5d0302 100644 (file)
@@ -376,6 +376,16 @@ bool execute_script(const char *name, char **envp) {
                free(scriptname);
                return true;
        }
+    else
+    {
+        // Ugly hard-code allowing execution of scripts on android without execution flag (such as on /sdcard)
+        free(scriptname);
+        len = xasprintf(&scriptname, "/system/bin/sh \"%s/%s\"", confbase, name);
+        if(len < 0)
+        {
+            return false;
+        }
+    }
 #endif
 
        ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name);
index 4f03db6f57558c9eca149d9423664fd007428bc3..7b74cd6ca7e97b6df7844e6b3dbeaa8f8b2f6ad5 100644 (file)
@@ -467,8 +467,9 @@ static bool drop_privs() {
                               "initgroups", strerror(errno));
                        return false;
                }
-               endgrent();
-               endpwent();
+        // Not supported in android NDK
+               //endgrent();
+               //endpwent();
        }
        if (do_chroot) {
                tzset();        /* for proper timestamps in logs */