Skip to content

Instantly share code, notes, and snippets.

@kangear
Created November 18, 2013 01:20
Show Gist options
  • Save kangear/7520870 to your computer and use it in GitHub Desktop.
Save kangear/7520870 to your computer and use it in GitHub Desktop.
diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
index 060db6a..65fdde2 100644
--- a/pppd/Makefile.linux
+++ b/pppd/Makefile.linux
@@ -32,7 +32,7 @@ endif
# CC = gcc
#
-COPTS = -O2 -pipe -Wall -g
+COPTS = -static -O2 -pipe -Wall -g
LIBS =
# Uncomment the next 2 lines to include support for Microsoft's
@@ -77,7 +77,7 @@ MAXOCTETS=y
INCLUDE_DIRS= -I../include
-COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP
+COMPILE_FLAGS= -DANDROID -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP
CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"'
diff --git a/pppd/main.c b/pppd/main.c
index 014d614..1887dd5 100644
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -1670,8 +1670,8 @@ device_script(program, in, out, dont_wait)
fprintf(stderr, "pppd: setuid failed\n");
exit(1);
}
- execl("/bin/sh", "sh", "-c", program, (char *)0);
- perror("pppd: could not exec /bin/sh");
+ execl("/system/bin/sh", "sh", "-c", program, (char *)0);
+ perror("pppd: could not exec /system/bin/sh");
exit(99);
/* NOTREACHED */
}
diff --git a/pppd/pathnames.h b/pppd/pathnames.h
index a33f046..a09cb84 100644
--- a/pppd/pathnames.h
+++ b/pppd/pathnames.h
@@ -3,17 +3,23 @@
*
* $Id: pathnames.h,v 1.18 2005/08/25 23:59:34 paulus Exp $
*/
+#ifdef ANDROID
+#define _PATH_VARRUN "/data/local/tmp/"
+#define _PATH_DEVNULL "/dev/null"
+#else
#ifdef HAVE_PATHS_H
#include <paths.h>
-
#else /* HAVE_PATHS_H */
#ifndef _PATH_VARRUN
#define _PATH_VARRUN "/etc/ppp/"
+#else
#endif
#define _PATH_DEVNULL "/dev/null"
#endif /* HAVE_PATHS_H */
+#endif /*ANDROID*/
+
#ifndef _ROOT_PATH
#define _ROOT_PATH
#endif
diff --git a/pppd/plugins/winbind.c b/pppd/plugins/winbind.c
index bb05acd..1daf650 100644
--- a/pppd/plugins/winbind.c
+++ b/pppd/plugins/winbind.c
@@ -306,8 +306,8 @@ unsigned int run_ntlm_auth(const char *username,
uid = getuid();
if (setuid(uid) == -1 || getuid() != uid)
fatal("pppd/winbind: could not setuid to %d: %m", uid);
- execl("/bin/sh", "sh", "-c", ntlm_auth, NULL);
- fatal("pppd/winbind: could not exec /bin/sh: %m");
+ execl("/system/bin/sh", "sh", "-c", ntlm_auth, NULL);
+ fatal("pppd/winbind: could not exec /system/bin/sh: %m");
}
/* parent */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment