jdk/src/java.base/share/classes/java/net/SocksSocketImpl.java
changeset 37593 824750ada3d6
parent 31529 31d7d82b39ff
child 37781 71ed5645f17c
equal deleted inserted replaced
37592:c80f098887f4 37593:824750ada3d6
    31 import java.security.PrivilegedAction;
    31 import java.security.PrivilegedAction;
    32 import java.security.PrivilegedExceptionAction;
    32 import java.security.PrivilegedExceptionAction;
    33 import sun.net.SocksProxy;
    33 import sun.net.SocksProxy;
    34 import sun.net.spi.DefaultProxySelector;
    34 import sun.net.spi.DefaultProxySelector;
    35 import sun.net.www.ParseUtil;
    35 import sun.net.www.ParseUtil;
       
    36 import sun.security.action.GetPropertyAction;
    36 /* import org.ietf.jgss.*; */
    37 /* import org.ietf.jgss.*; */
    37 
    38 
    38 /**
    39 /**
    39  * SOCKS (V4 & V5) TCP socket implementation (RFC 1928).
    40  * SOCKS (V4 & V5) TCP socket implementation (RFC 1928).
    40  * This is a subclass of PlainSocketImpl.
    41  * This is a subclass of PlainSocketImpl.
   175                         });
   176                         });
   176             if (pw != null) {
   177             if (pw != null) {
   177                 userName = pw.getUserName();
   178                 userName = pw.getUserName();
   178                 password = new String(pw.getPassword());
   179                 password = new String(pw.getPassword());
   179             } else {
   180             } else {
   180                 userName = java.security.AccessController.doPrivileged(
   181                 userName = GetPropertyAction.getProperty("user.name");
   181                         new sun.security.action.GetPropertyAction("user.name"));
       
   182             }
   182             }
   183             if (userName == null)
   183             if (userName == null)
   184                 return false;
   184                 return false;
   185             out.write(1);
   185             out.write(1);
   186             out.write(userName.length());
   186             out.write(userName.length());
  1086         if (applicationSetProxy) {
  1086         if (applicationSetProxy) {
  1087             try {
  1087             try {
  1088                 userName = System.getProperty("user.name");
  1088                 userName = System.getProperty("user.name");
  1089             } catch (SecurityException se) { /* swallow Exception */ }
  1089             } catch (SecurityException se) { /* swallow Exception */ }
  1090         } else {
  1090         } else {
  1091             userName = java.security.AccessController.doPrivileged(
  1091             userName = GetPropertyAction.getProperty("user.name");
  1092                 new sun.security.action.GetPropertyAction("user.name"));
       
  1093         }
  1092         }
  1094         return userName;
  1093         return userName;
  1095     }
  1094     }
  1096 }
  1095 }