Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #68

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open

Dev #68

Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
93ce298
Check that the socket comes from the right UID to prevent forged sockets
ChainsDD Jan 2, 2012
fc6942f
Read all data regarding the request directly from the socket instead …
ChainsDD Jan 2, 2012
0efb8bf
Use Holo style for Request window when available
ChainsDD Jan 2, 2012
46b7a25
Delete backup files
ChainsDD Feb 5, 2012
793459b
Fix superuser build to be same as market version
GavChap Jan 31, 2012
172a13e
Superuser: Fix FC when checking for su binary update
pawitp Jan 27, 2012
5dc2783
Fix ANR caused by faulty date calculation in DateIndexer
ChainsDD Feb 12, 2012
1dabbda
Clean up LogAdapter
ChainsDD Feb 12, 2012
9d2fa0a
Only read request details from socket if the su binary supports it
ChainsDD Feb 12, 2012
6612fd1
Remove unnecessary version code field
ChainsDD Feb 12, 2012
261be33
Code cleanup
ChainsDD Feb 12, 2012
a97f7b3
Switch to ActionBarSherlock
ChainsDD Apr 21, 2012
0a71cba
Updated translations from crowdin.net as of 2012-04-21
ChainsDD Apr 21, 2012
31edc7e
Fix loads of Lint errors and warnings
ChainsDD Apr 22, 2012
2a14982
Fix backwards compatibility with older binaries
ChainsDD Apr 22, 2012
601a73b
Redo binary updater
ChainsDD May 29, 2012
872397b
Preferences overhaul
ChainsDD May 29, 2012
bfa2989
Minor adjustments to the ActionBar items on AppDetailsFragment
ChainsDD May 29, 2012
75ad345
Add missing import from last commit
ChainsDD May 29, 2012
224aa13
Make a couple home buttons work
ChainsDD May 29, 2012
5d5d5a7
Delete some garbage that got left behind in binary updater commit
ChainsDD May 29, 2012
4c488be
Fix wrong method in UpdaterActivity
ChainsDD Jun 10, 2012
310d1f0
Suppress lint warnings
ChainsDD Jun 10, 2012
8ca0f22
Clean up binary updater service
ChainsDD Jun 10, 2012
5c7987c
Add capability for binary updater service to run automatically update…
ChainsDD Jun 10, 2012
2f5342d
Show the proper Preferences activity based on API level
ChainsDD Jun 10, 2012
6136dd3
Add temp unroot and ota survivor capabilities
ChainsDD Jun 10, 2012
946b6c9
Add keys for temp unroot and ota survivor to Preferences class
ChainsDD Jun 10, 2012
c1f6a9d
Prevent NPE if no socket path is received
ChainsDD Jun 10, 2012
fd0204f
Add info page to the HomeActivity
ChainsDD Jun 26, 2012
ace3af4
rename sutools-x86
ChainsDD Jun 26, 2012
58cab52
Download the proper binary for the device's CPU architecture
ChainsDD Jun 26, 2012
40c197f
Add in missing string
ChainsDD Jun 28, 2012
726d2ef
Update translations from crowdin.net
ChainsDD Jun 28, 2012
7bb10cc
Hide the progress spinner properly on pre honeycomb devices
ChainsDD Jun 28, 2012
8051fba
Fix FC when opening preferences on pre-HC devices
ChainsDD Jun 30, 2012
8c7a0da
Give the binary updater a better chance of succeeding
ChainsDD Jun 30, 2012
d942300
Add button to the action bad on tablets to access the info page
ChainsDD Jun 30, 2012
919954e
Update version
ChainsDD Jun 30, 2012
c8808bd
Update changelog
ChainsDD Jun 30, 2012
e01c716
Update translations
ChainsDD Jun 30, 2012
9d3d578
Update sutools to the latest build
ChainsDD Jun 30, 2012
d915f32
Fix FC when entering preferences for elite users on pre-HC devices
ChainsDD Jun 30, 2012
aba01e4
Use the proper style for the info page
ChainsDD Jun 30, 2012
fc8dd53
Add in menu ids for log and info buttons
ChainsDD Jun 30, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only read request details from socket if the su binary supports it
ChainsDD committed Feb 12, 2012
commit 9d2fa0a1cbde450866ad5de44dc8c81c9e1e7265
83 changes: 44 additions & 39 deletions src/com/noshufou/android/su/SuRequestActivity.java
Original file line number Diff line number Diff line change
@@ -78,7 +78,6 @@ public class SuRequestActivity extends Activity implements OnClickListener {

@Override
public void onCreate(Bundle savedInstanceState) {
String socketPath;
super.onCreate(savedInstanceState);

if (this.getCallingPackage() != null) {
@@ -90,8 +89,8 @@ public void onCreate(Bundle savedInstanceState) {
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);

Intent intent = this.getIntent();
socketPath = intent.getStringExtra(SuRequestReceiver.EXTRA_SOCKET);
mSuVersionCode = intent.getIntExtra(SuRequestReceiver.EXTRA_VERSION_CODE, 0);
String socketPath = intent.getStringExtra(SuRequestReceiver.EXTRA_SOCKET);
int suVersionCode = intent.getIntExtra(SuRequestReceiver.EXTRA_VERSION_CODE, 0);

mUsePin = mPrefs.getBoolean(Preferences.PIN, false);
if (mUsePin) {
@@ -131,15 +130,15 @@ public void onCreate(Bundle savedInstanceState) {
if (creds.getUid() != appInfo.uid || creds.getGid() != appInfo.uid) {
throw new SecurityException("Potential forged socket");
}
readRequestDetails();
readRequestDetails(suVersionCode, intent);
} catch (IOException e) {
// If we can't connect to the socket, there's no point in
// being here. Log it and quit
Log.e(TAG, "Failed to connect to socket", e);
finish();
}

if (mSuVersionCode < 10) {
if (suVersionCode < 10) {
Util.showOutdatedNotification(this);
}

@@ -258,40 +257,46 @@ public void onClick(View view) {
}
};

private void readRequestDetails() throws IOException {
DataInputStream is = new DataInputStream(mSocket.getInputStream());

int protocolVersion = is.readInt();
Log.d(TAG, "INT32:PROTO VERSION = " + protocolVersion);

int exeSizeMax = is.readInt();
Log.d(TAG, "UINT32:FIELD7MAX = " + exeSizeMax);
int cmdSizeMax = is.readInt();
Log.d(TAG, "UINT32:FIELD9MAX = " + cmdSizeMax);
mCallerUid = is.readInt();
Log.d(TAG, "UINT32:CALLER = " + mCallerUid);
mDesiredUid = is.readInt();
Log.d(TAG, "UINT32:TO = " + mDesiredUid);

int exeSize = is.readInt();
Log.d(TAG, "UINT32:EXESIZE = " + exeSize);
if (exeSize > exeSizeMax) {
throw new IOException("Incomming string bigger than allowed");
}
byte[] buf = new byte[exeSize];
is.read(buf);
String callerBin = new String(buf, 0, exeSize - 1);
Log.d(TAG, "STRING:EXE = " + callerBin);

int cmdSize = is.readInt();
Log.d(TAG, "UINT32:CMDSIZE = " + cmdSize);
if (cmdSize > cmdSizeMax) {
throw new IOException("Incomming string bigger than allowed");
}
buf = new byte[cmdSize];
is.read(buf);
mDesiredCmd = new String(buf, 0, cmdSize - 1);
Log.d(TAG, "STRING:CMD = " + mDesiredCmd);
private void readRequestDetails(int suVersion, Intent intent) throws IOException {
if (suVersion > 15) {
DataInputStream is = new DataInputStream(mSocket.getInputStream());

int protocolVersion = is.readInt();
Log.d(TAG, "INT32:PROTO VERSION = " + protocolVersion);

int exeSizeMax = is.readInt();
Log.d(TAG, "UINT32:FIELD7MAX = " + exeSizeMax);
int cmdSizeMax = is.readInt();
Log.d(TAG, "UINT32:FIELD9MAX = " + cmdSizeMax);
mCallerUid = is.readInt();
Log.d(TAG, "UINT32:CALLER = " + mCallerUid);
mDesiredUid = is.readInt();
Log.d(TAG, "UINT32:TO = " + mDesiredUid);

int exeSize = is.readInt();
Log.d(TAG, "UINT32:EXESIZE = " + exeSize);
if (exeSize > exeSizeMax) {
throw new IOException("Incomming string bigger than allowed");
}
byte[] buf = new byte[exeSize];
is.read(buf);
String callerBin = new String(buf, 0, exeSize - 1);
Log.d(TAG, "STRING:EXE = " + callerBin);

int cmdSize = is.readInt();
Log.d(TAG, "UINT32:CMDSIZE = " + cmdSize);
if (cmdSize > cmdSizeMax) {
throw new IOException("Incomming string bigger than allowed");
}
buf = new byte[cmdSize];
is.read(buf);
mDesiredCmd = new String(buf, 0, cmdSize - 1);
Log.d(TAG, "STRING:CMD = " + mDesiredCmd);
} else {
mCallerUid = intent.getIntExtra(SuRequestReceiver.EXTRA_CALLERUID, 0);
mDesiredUid = intent.getIntExtra(SuRequestReceiver.EXTRA_UID, 0);
mDesiredCmd = intent.getStringExtra(SuRequestReceiver.EXTRA_CMD);
}

}