diff options
author | Jason Monk <jmonk@google.com> | 2013-08-14 16:58:25 -0400 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2013-09-18 09:22:11 -0400 |
commit | fa4518f7632f0a2146a0638cf39d6d9e1d832a01 (patch) | |
tree | 1a6227ffd478e7dd61f6380a2d36345d52c869ad /packages | |
parent | c255a7113a6a6b058f1b3b5b128fba1d24bbd3d9 (diff) | |
download | frameworks_base-fa4518f7632f0a2146a0638cf39d6d9e1d832a01.zip frameworks_base-fa4518f7632f0a2146a0638cf39d6d9e1d832a01.tar.gz frameworks_base-fa4518f7632f0a2146a0638cf39d6d9e1d832a01.tar.bz2 |
PAC Local Proxy to only receive lo connections
This changes the Local Proxy used in PAC to only accept connections coming
from the device.
Bug: 10230718
Change-Id: I5fbeb3aa018df5179a403301021f452e910a517d
Diffstat (limited to 'packages')
-rw-r--r-- | packages/services/Proxy/src/com/android/proxyhandler/ProxyServer.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/services/Proxy/src/com/android/proxyhandler/ProxyServer.java b/packages/services/Proxy/src/com/android/proxyhandler/ProxyServer.java index 4bf1db8..596435a 100644 --- a/packages/services/Proxy/src/com/android/proxyhandler/ProxyServer.java +++ b/packages/services/Proxy/src/com/android/proxyhandler/ProxyServer.java @@ -25,6 +25,7 @@ import com.google.android.collect.Lists; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.ProxySelector; @@ -198,9 +199,15 @@ public class ProxyServer extends Thread { while (mIsRunning) { try { - ProxyConnection parser = new ProxyConnection(serverSocket.accept()); + Socket socket = serverSocket.accept(); + // Only receive local connections. + if (socket.getInetAddress().isLoopbackAddress()) { + ProxyConnection parser = new ProxyConnection(socket); - threadExecutor.execute(parser); + threadExecutor.execute(parser); + } else { + socket.close(); + } } catch (IOException e) { e.printStackTrace(); } |