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 f33355c..41a1468 100644 (file)
@@ -376,6 +376,16 @@ bool execute_script(const char *name, char **envp) {
                free(scriptname);
                return true;
        }
                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);
 #endif
 
        ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name);
index 4f03db6..7b74cd6 100644 (file)
@@ -467,8 +467,9 @@ static bool drop_privs() {
                               "initgroups", strerror(errno));
                        return false;
                }
                               "initgroups", strerror(errno));
                        return false;
                }
-               endgrent();
-               endpwent();
+        // Not supported in android NDK
+               //endgrent();
+               //endpwent();
        }
        if (do_chroot) {
                tzset();        /* for proper timestamps in logs */
        }
        if (do_chroot) {
                tzset();        /* for proper timestamps in logs */