cleaned up tor control cookie file code for #5305

This commit is contained in:
Nathan Freitas 2012-04-08 23:22:54 -04:00
parent 1cb7ed5a6c
commit d11a6c6f75
3 changed files with 8 additions and 5 deletions

View File

@ -1,5 +1,7 @@
NOTE: Specific #s below correspond to Trac tickets logged and maintained at https://trac.torproject.org/projects/tor/
1.0.7.3
- fixed tor control port cookie file path lookup related to #5305
- updated strings
- adding in manual locale selection

View File

@ -869,18 +869,15 @@ public class TorService extends Service implements TorServiceConstants, TorConst
conn = TorControlConnection.getConnection(torConnSocket);
// conn.authenticate(new byte[0]); // See section 3.2
logNotice( "SUCCESS connected to control port");
String torAuthCookie = new File(appCacheHome, TOR_CONTROL_COOKIE).getAbsolutePath();
File fileCookie = new File(torAuthCookie);
File fileCookie = new File(appCacheHome, TOR_CONTROL_COOKIE);
if (fileCookie.exists())
{
byte[] cookie = new byte[(int)fileCookie.length()];
new FileInputStream(new File(torAuthCookie)).read(cookie);
new FileInputStream(fileCookie).read(cookie);
conn.authenticate(cookie);
logNotice( "SUCCESS authenticated to control port");

View File

@ -202,6 +202,7 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
apps[appIdx] = new TorifiedApp();
apps[appIdx].setEnabled(aInfo.enabled);
apps[appIdx].setUid(aInfo.uid);
apps[appIdx].setUsername(pMgr.getNameForUid(apps[appIdx].getUid()));
@ -280,5 +281,8 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
saveAppSettings(this);
}
}