OSDN Git Service
(root)
/
android-x86
/
external-koush-Superuser.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
android: fix 64-bit targets building errors
[android-x86/external-koush-Superuser.git]
/
Superuser
/
jni
/
su
/
su.c
diff --git
a/Superuser/jni/su/su.c
b/Superuser/jni/su/su.c
index
55e54a6
..
da7b84f
100644
(file)
--- a/
Superuser/jni/su/su.c
+++ b/
Superuser/jni/su/su.c
@@
-33,6
+33,7
@@
#include <sys/stat.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <sys/types.h>
+#include <sys/endian.h>
#include "su.h"
#include "utils.h"
#include "su.h"
#include "utils.h"
@@
-76,7
+77,7
@@
int fork_zero_fucks() {
return pid;
}
else {
return pid;
}
else {
- if (
pid = fork(
))
+ if (
(pid = fork()
))
exit(0);
return 0;
}
exit(0);
return 0;
}
@@
-120,6
+121,11
@@
static int from_init(struct su_initiator *from) {
from->uid = getuid();
from->pid = getppid();
from->uid = getuid();
from->pid = getppid();
+ if (is_daemon) {
+ from->uid = daemon_from_uid;
+ from->pid = daemon_from_pid;
+ }
+
/* Get the command line */
snprintf(path, sizeof(path), "/proc/%u/cmdline", from->pid);
fd = open(path, O_RDONLY);
/* Get the command line */
snprintf(path, sizeof(path), "/proc/%u/cmdline", from->pid);
fd = open(path, O_RDONLY);
@@
-176,11
+182,6
@@
static int from_init(struct su_initiator *from) {
strncpy(from->name, pw->pw_name, sizeof(from->name));
}
strncpy(from->name, pw->pw_name, sizeof(from->name));
}
- if (is_daemon) {
- from->uid = daemon_from_uid;
- from->pid = daemon_from_pid;
- }
-
return 0;
}
return 0;
}
@@
-367,7
+368,7
@@
static int socket_accept(int serv_fd) {
static int socket_send_request(int fd, const struct su_context *ctx) {
#define write_data(fd, data, data_len) \
do { \
static int socket_send_request(int fd, const struct su_context *ctx) {
#define write_data(fd, data, data_len) \
do { \
-
size_t __len = htonl(data_len);
\
+
uint32_t __len = htonl(data_len);
\
__len = write((fd), &__len, sizeof(__len)); \
if (__len != sizeof(__len)) { \
PLOGE("write(" #data ")"); \
__len = write((fd), &__len, sizeof(__len)); \
if (__len != sizeof(__len)) { \
PLOGE("write(" #data ")"); \
@@
-569,12
+570,12
@@
int access_disabled(const struct su_initiator *from) {
if (data != NULL) {
len = strlen(data);
if (len >= PROPERTY_VALUE_MAX)
if (data != NULL) {
len = strlen(data);
if (len >= PROPERTY_VALUE_MAX)
- memcpy(enabled, "
1
", 2);
+ memcpy(enabled, "
0
", 2);
else
memcpy(enabled, data, len + 1);
free(data);
} else
else
memcpy(enabled, data, len + 1);
free(data);
} else
- memcpy(enabled, "
1
", 2);
+ memcpy(enabled, "
0
", 2);
/* enforce persist.sys.root_access on non-eng builds for apps */
if (strcmp("eng", build_type) != 0 &&
/* enforce persist.sys.root_access on non-eng builds for apps */
if (strcmp("eng", build_type) != 0 &&
@@
-639,6
+640,7
@@
int su_main(int argc, char *argv[], int need_client) {
return run_daemon();
}
return run_daemon();
}
+ int ppid = getppid();
fork_for_samsung();
// Sanitize all secure environment variables (from linker_environ.c in AOSP linker).
fork_for_samsung();
// Sanitize all secure environment variables (from linker_environ.c in AOSP linker).
@@
-679,12
+681,6
@@
int su_main(int argc, char *argv[], int need_client) {
cp++;
}
cp++;
}
- /*
- * set LD_LIBRARY_PATH if the linker has wiped out it due to we're suid.
- * This occurs on Android 4.0+
- */
- setenv("LD_LIBRARY_PATH", "/vendor/lib:/system/lib", 0);
-
LOGD("su invoked.");
struct su_context ctx = {
LOGD("su invoked.");
struct su_context ctx = {
@@
-784,7
+780,7
@@
int su_main(int argc, char *argv[], int need_client) {
get_api_version() >= 19) {
// attempt to connect to daemon...
LOGD("starting daemon client %d %d", getuid(), geteuid());
get_api_version() >= 19) {
// attempt to connect to daemon...
LOGD("starting daemon client %d %d", getuid(), geteuid());
- return connect_daemon(argc, argv);
+ return connect_daemon(argc, argv
, ppid
);
}
}
}
}