Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/cm-10.2' into cm-11.0
Browse files Browse the repository at this point in the history
Conflicts:
	Superuser/jni/su/daemon.c

Change-Id: Ia849b63cf44d8da9e31b1fbe13b54b0b8289e75d
  • Loading branch information
koush committed Nov 29, 2013
2 parents ed55b0e + 95b77e3 commit 81a5d88
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Superuser/jni/su/activity.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ int send_result(struct su_context *ctx, policy_t policy) {
"--es",
"action",
policy == ALLOW ? "allow" : "deny",
"--user",
user[0] ? "--user" : NULL,
user,
NULL
};
Expand Down Expand Up @@ -199,7 +199,7 @@ int send_request(struct su_context *ctx) {
"--es",
"socket",
ctx->sock_path,
"--user",
user[0] ? "--user" : NULL,
user,
NULL
};
Expand Down
42 changes: 33 additions & 9 deletions Superuser/jni/su/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,13 @@ static int daemon_accept(int fd) {
}
if (mkfifo(errfile, 0660) != 0) {
PLOGE("mkfifo %s", errfile);
unlink(outfile);
exit(-1);
}
if (mkfifo(infile, 0660) != 0) {
PLOGE("mkfifo %s", infile);
unlink(errfile);
unlink(outfile);
exit(-1);
}

Expand All @@ -265,11 +268,15 @@ static int daemon_accept(int fd) {
ptm = open("/dev/ptmx", O_RDWR);
if (ptm <= 0) {
PLOGE("ptm");
exit(-1);
goto unlink_n_exit;
}
if(grantpt(ptm) || unlockpt(ptm) || ((devname = (char*) ptsname(ptm)) == 0)) {
PLOGE("ptm setup");
close(ptm);
unlink_n_exit:
unlink(infile);
unlink(errfile);
unlink(outfile);
exit(-1);
}
LOGV("devname: %s", devname);
Expand All @@ -278,19 +285,25 @@ static int daemon_accept(int fd) {
int outfd = open(outfile, O_WRONLY);
if (outfd <= 0) {
PLOGE("outfd daemon %s", outfile);
goto done;
goto unlink_n_exit;
}
int errfd = open(errfile, O_WRONLY);
if (errfd <= 0) {
PLOGE("errfd daemon %s", errfile);
goto done;
goto unlink_n_exit;
}
int infd = open(infile, O_RDONLY);
if (infd <= 0) {
PLOGE("infd daemon %s", infile);
goto done;
goto unlink_n_exit;
}

// Wait for client to open pipes, then remove
read_int(fd);
unlink(infile);
unlink(errfile);
unlink(outfile);

int code;
// now fork and run main, watch for the child pid exit, and send that
// across the control channel as the response.
Expand Down Expand Up @@ -361,7 +374,13 @@ static int daemon_accept(int fd) {
int status;
LOGV("waiting for child exit");
if (waitpid(child, &status, 0) > 0) {
code = WEXITSTATUS(status);
if (WIFEXITED(status)) {
code = WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
code = 128 + WTERMSIG(status);
} else {
code = -1;
}
}
else {
code = -1;
Expand Down Expand Up @@ -448,9 +467,6 @@ int connect_daemon(int argc, char *argv[]) {
sprintf(outfile, "%s/%d.stdout", REQUESTOR_DAEMON_PATH, getpid());
sprintf(errfile, "%s/%d.stderr", REQUESTOR_DAEMON_PATH, getpid());
sprintf(infile, "%s/%d.stdin", REQUESTOR_DAEMON_PATH, getpid());
unlink(errfile);
unlink(infile);
unlink(outfile);

struct sockaddr_un sun;

Expand Down Expand Up @@ -511,11 +527,19 @@ int connect_daemon(int argc, char *argv[]) {
exit(-1);
}

// notify daemon that the pipes are open.
write_int(socketfd, 1);

pump_async(STDIN_FILENO, infd);
pump_async(errfd, STDERR_FILENO);
pump(outfd, STDOUT_FILENO);

close(infd);
close(errfd);
close(outfd);

int code = read_int(socketfd);
LOGV("client exited %d", code);
close(socketfd);
LOGD("client exited %d", code);
return code;
}
90 changes: 90 additions & 0 deletions Superuser/res/values-lt/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="superuser">Superuser</string>
<string name="allow">Suteikti</string>
<string name="deny">Atmesti</string>
<string name="status_incoming">Superuser užklausa\u2026</string>
<string name="unknown_uid">Nežinomas UID: %s</string>
<string name="application_request">%s prašo Superuser teisių</string>
<string name="info">Įspėjimas: Jei nesuprantate, atmeskite užklausą</string>
<string name="request">Superuser užklausa</string>
<string name="package_header">Paketas:</string>
<string name="app_header">Programa:</string>
<string name="uid_header">UID:</string>
<string name="command_header">Komanda:</string>
<string name="this_time_only">Tik šį kartą</string>
<string name="remember_for">Prisiminti pasirinkimą %s minutėms</string>
<string name="remember_forever">Prisiminti pasirinkimą</string>
<string name="interactive">Interaktyvus</string>
<string name="logs">Įrašai</string>
<string name="settings">Nustatymai</string>
<string name="delete">Trinti</string>
<string name="no_logs">Nėra įrašų</string>
<string name="no_apps">Nėra Superuser užklausų įrašų</string>
<string name="logging">Įrašų vedimas</string>
<string name="logging_summary">Įjungti arba išjungti Superuser įrašų vedimą</string>
<string name="pin_protection">PIN apsauga</string>
<string name="pin_protection_summary">Reikalauti PIN Superuser užklausoms</string>
<string name="request_timeout">Užklausos laikas</string>
<string name="request_timeout_summary">Superuser užklausa bus atmesta po %s sekundžių, jei teisės nebus suteiktos</string>
<string name="notifications">Įspėjimai</string>
<string name="none">Nerodomi</string>
<string name="notifications_summary">%s bus rodomas kai programai suteiktos arba atmestos Superuser teisės</string>
<string name="enter_pin">Įveskite PIN kodą</string>
<string name="enter_new_pin">Įveskite naują PIN kodą</string>
<string name="incorrect_pin">Neteisingas PIN kodas</string>
<string name="confirm_pin">Patvirtinkite PIN kodą</string>
<string name="pin_mismatch">Nesutampa PIN kodas</string>
<string name="pin_set">Superuser PIN kodo apsauga įjungta</string>
<string name="number_seconds">%s sekundės</string>
<string name="superuser_granted">Superuser teisės suteiktos %s</string>
<string name="superuser_denied">Superuser teisės atmestos %s</string>
<string name="toast">Info langelis</string>
<string name="notification">Įspėjimas</string>
<string name="no_notification">Įspėjimas nebus rodomas</string>
<string name="developer_warning">Kūrėjo Įspėjimas:\nandroid.permission.ACCESS_SUPERUSER\nnedeklaruotas manifeste.</string>
<string name="superuser_description">visos teisės į visas įrenginio funkcijas</string>
<string name="superuser_description_more">Superuser suteikiamos visos prieigos į visas įrenginio funkcijas ir į saugyklą. Tai gali būti pavojinga.</string>
<string name="declared_permission">Ribotas leidimas</string>
<string name="declared_permission_summary">Suteikti teises tik programoms su užklausa į android.permission.ACCESS_SUPERUSER</string>
<string name="automatic_response">Automatinis atsakymas</string>
<string name="prompt">Klausti</string>
<string name="automatic_response_allow_summary">Automatiškai suteikti teises</string>
<string name="automatic_response_deny_summary">Automatiškai atmesti teises</string>
<string name="automatic_response_prompt_summary">Rodyti langą naujoms užklausoms</string>
<string name="security">Saugumas</string>
<string name="multiuser_policy">Kelių vartotojų politika</string>
<string name="multiuser_owner_only_summary">Tik prietaiso savininkui galima suteikti Superuser teises</string>
<string name="multiuser_owner_managed_summary">Savininkas bus įspėtas kai kitas vartotojas prašys Superuser teisių</string>
<string name="multiuser_user_summary">Visiems vartotojams suteikiamos Superuser teises</string>
<string name="multiuser_owner_only">Tik savininkas</string>
<string name="multiuser_owner_managed">Savininkas tvarko</string>
<string name="multiuser_user">Visi vartotojai</string>
<string name="multiuser_require_owner">Tik savininkas gali keisti kelių vartotojų valdymo veiksmus.</string>
<string name="owner_login_info">Patvirtinimui perjunkite į savininko paskyrą.</string>
<string name="all_commands">Visos komandos</string>
<string name="about">Apie</string>
<string name="apps">Programos</string>
<string name="installing">Diegimas</string>
<string name="installing_superuser">Diegiamas Superuser\u2026</string>
<string name="install_superuser">Įdiegti Superuser</string>
<string name="install_superuser_info">Superuser įskiepis (su) turi būti atnaujintas.\n\nPasirinkite įdiegimo būdą.\n</string>
<string name="recovery_install">Įdiegti per \'Recovery\' režimą</string>
<string name="install">Įdiegti</string>
<string name="checking_superuser">Tikrinamas Superuser\u2026</string>
<string name="install_error">Įvyko klaida diegiant Superuser</string>
<string name="install_success">Superuser įdiegtas</string>
<string name="su_binary_outdated">\'su\' įskiepis pasenęs.</string>
<string name="superuser_access">Superuser prieiga</string>
<string name="access_disabled">Išjungta</string>
<string name="apps_only">Tik programoms</string>
<string name="adb_only">Tik ADB</string>
<string name="apps_and_adb">Programoms ir ADB</string>
<string name="whats_new">Kas naujo</string>
<string name="rate">Įvertinti</string>
<string name="theme">Tema</string>
<string name="light">Šviesi</string>
<string name="dark">Tamsi</string>
<string name="pin_disabled">Superuser PIN kodo apsauga išjungta.</string>
</resources>

0 comments on commit 81a5d88

Please sign in to comment.