Package java.net

Examples of java.net.SocketPermission$EphemeralRange


      String hostname = localhost.getHostName();
      harness.check(!hostname.equals(localhost.getHostAddress()));
      byte[] hostaddr = localhost.getAddress();

      Permission[] checkConnect = new Permission[] {
  new SocketPermission(hostname, "resolve")};
     
      TestSecurityManager sm = new TestSecurityManager(harness);
      try {
  sm.install();
View Full Code Here


      harness.check(!list.isEmpty());

      Permission[] checks = new Permission[list.size()];
      for (int i = 0; i < list.size(); i++) {
  InetAddress addr = (InetAddress) list.get(i);
  checks[i] = new SocketPermission(addr.getHostAddress(), "resolve");
      }

      TestSecurityManager sm = new TestSecurityManager(harness);
      try {
  sm.install();
View Full Code Here

          String host = getCodeBase().getHost();

              if (host != null && (host.length() > 0)) {
                // add permission for downloaded jars to access host they were from
                perms.add(new SocketPermission(host, "connect,accept"));
              }
              else if ( "file".equals(codesource.getLocation().getProtocol()) ) {
                // if running locally add file permission
                String path = codesource.getLocation().getFile().replace('/', File.separatorChar);
                  perms.add(new FilePermission(path, "read"));
View Full Code Here

         *    action if isHttp flag is set.
         */
        String host = null;
        InetAddress inetAddress = InetAddress.getLocalHost();
        host = inetAddress.getHostName();
        socketPermission = new SocketPermission(host, "connect,accept,resolve");

        /*
         * 2) construct FilePermission object pointed to the qa1.jar file
         *    and construct FilePermission object pointed to
         *    the qa1-loader-pref.jar file  passing the 'read' action.
View Full Code Here

  if (System.getSecurityManager() == null) {
      System.setSecurityManager(new SecurityManager());
  }

  AccessControlContext accA = createAccWith(new Permission[] {
      new SocketPermission(NAME, "connect"),
      new SocketPermission(NAME_U1, "connect"),
  });
  AccessControlContext accB = createAccWith(new Permission[] {
      new SocketPermission(ADDR1, "connect"),
      new SocketPermission(NAME_U2, "connect"),
  });
  AccessControlContext accC = createAccWith(new Permission[] {
      new SocketPermission(ADDR2, "connect"),
  });
  AccessControlContext accD = createAccWith(new Permission[] {
      new SocketPermission(NAME, "resolve"),
      new SocketPermission(ADDR2, "connect"),
  });

  int port = 2019;    // use separate ports to control reuse
  Ping impl = new PingImpl()// hold on to impl
View Full Code Here

            ((JarURLConnection) conn).getJarFileURL();
        conn = hostURL.openConnection();
          }
          String host = hostURL.getHost();
          if (host != null &&
        p.implies(new SocketPermission(host,
                     "resolve")))
          {
        Permission p2 =
            new SocketPermission(host,
               "connect,accept");
        if (!perms.implies(p2)) {
            perms.add(p2);
        }
          }
View Full Code Here

        add(new RuntimePermission("queuePrintJob"));
        add(new RuntimePermission("getStackTrace"));
        add(new RuntimePermission("preferences"));
       
        //allow the scripts to connect via sockets
        add(new SocketPermission("*", "connect,accept"));
       
        //allow access to the server's file system. let the file perms
        //guard what is writeable and what is not.
        add(new FilePermission("<<ALL FILES>>", "read,write,execute,delete"));
       
View Full Code Here

                    // }
                    //
                    // let's cache it:

                    if (this.sp == null) {
                        this.sp = new SocketPermission(thisHost, "resolve"); //$NON-NLS-1$
                    }

                    if (cs.sp == null) {
                        cs.sp = new SocketPermission(thatHost, "resolve"); //$NON-NLS-1$
                    }

                    if (!this.sp.implies(cs.sp)) {
                        return false;
                    }
View Full Code Here

    public Permission getPermission() throws IOException {
        int port = url.getPort();
        if (port <= 0) {
            port = FTP_PORT;
        }
        return new SocketPermission(hostName + ":" + port, "connect, resolve");
    }
View Full Code Here

    }

    @Override
    public Permission getPermission() throws IOException {
        return new SocketPermission(getHostName() + ":" + getHostPort(), "connect, resolve");
    }
View Full Code Here

TOP

Related Classes of java.net.SocketPermission$EphemeralRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.