geronimo-mail_2.1/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/util/MailConnection.java [457:497]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void createSSLSocketFromSSLContext(boolean layer) throws IOException{
        
        debugOut("Creating "+(layer?"layered ":"non-layered ")+"SSL socket using SSL Context");

        
        try {
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            
            String sslTrust = props.getProperty(MAIL_SSL_TRUST);
            
            TrustManager trustManager = null;
            
            if(sslTrust != null) {
                if(sslTrust.equals("*")) {
                    trustManager = new SSLTrustManager(null, true); //trust all
                } else
                {
                   String[] trustedHosts = sslTrust.split("\\s+");
                   trustManager = new SSLTrustManager(trustedHosts, false); //trust some
                   
                   if(serverHost == null || serverHost.isEmpty() || !Arrays.asList(trustedHosts).contains(serverHost)) {
                       throw new IOException("Server is not trusted: " + serverHost);
                   }
                   
                }
            } else {
                trustManager = new SSLTrustManager(null, false); //default
                
            }
             
            sslcontext.init(null, new TrustManager[]{trustManager}, null);
            
            createSocketFromFactory(sslcontext.getSocketFactory(), layer);
        } catch (KeyManagementException e) {
            //cannot happen
            throw new IOException(e);
        } catch (NoSuchAlgorithmException e) {
            //cannot happen
            throw new IOException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/util/MailConnection.java [456:496]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void createSSLSocketFromSSLContext(boolean layer) throws IOException{
        
        debugOut("Creating "+(layer?"layered ":"non-layered ")+"SSL socket using SSL Context");

        
        try {
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            
            String sslTrust = props.getProperty(MAIL_SSL_TRUST);
            
            TrustManager trustManager = null;
            
            if(sslTrust != null) {
                if(sslTrust.equals("*")) {
                    trustManager = new SSLTrustManager(null, true); //trust all
                } else
                {
                   String[] trustedHosts = sslTrust.split("\\s+");
                   trustManager = new SSLTrustManager(trustedHosts, false); //trust some
                   
                   if(serverHost == null || serverHost.isEmpty() || !Arrays.asList(trustedHosts).contains(serverHost)) {
                       throw new IOException("Server is not trusted: " + serverHost);
                   }
                   
                }
            } else {
                trustManager = new SSLTrustManager(null, false); //default
                
            }
             
            sslcontext.init(null, new TrustManager[]{trustManager}, null);
            
            createSocketFromFactory(sslcontext.getSocketFactory(), layer);
        } catch (KeyManagementException e) {
            //cannot happen
            throw new IOException(e);
        } catch (NoSuchAlgorithmException e) {
            //cannot happen
            throw new IOException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.5/geronimo-javamail_1.5_provider/src/main/java/org/apache/geronimo/javamail/util/MailConnection.java [456:496]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void createSSLSocketFromSSLContext(boolean layer) throws IOException{
        
        debugOut("Creating "+(layer?"layered ":"non-layered ")+"SSL socket using SSL Context");

        
        try {
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            
            String sslTrust = props.getProperty(MAIL_SSL_TRUST);
            
            TrustManager trustManager = null;
            
            if(sslTrust != null) {
                if(sslTrust.equals("*")) {
                    trustManager = new SSLTrustManager(null, true); //trust all
                } else
                {
                   String[] trustedHosts = sslTrust.split("\\s+");
                   trustManager = new SSLTrustManager(trustedHosts, false); //trust some
                   
                   if(serverHost == null || serverHost.isEmpty() || !Arrays.asList(trustedHosts).contains(serverHost)) {
                       throw new IOException("Server is not trusted: " + serverHost);
                   }
                   
                }
            } else {
                trustManager = new SSLTrustManager(null, false); //default
                
            }
             
            sslcontext.init(null, new TrustManager[]{trustManager}, null);
            
            createSocketFromFactory(sslcontext.getSocketFactory(), layer);
        } catch (KeyManagementException e) {
            //cannot happen
            throw new IOException(e);
        } catch (NoSuchAlgorithmException e) {
            //cannot happen
            throw new IOException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.6/geronimo-javamail_1.6_provider/src/main/java/org/apache/geronimo/javamail/util/MailConnection.java [457:497]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void createSSLSocketFromSSLContext(boolean layer) throws IOException{
        
        debugOut("Creating "+(layer?"layered ":"non-layered ")+"SSL socket using SSL Context");

        
        try {
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            
            String sslTrust = props.getProperty(MAIL_SSL_TRUST);
            
            TrustManager trustManager = null;
            
            if(sslTrust != null) {
                if(sslTrust.equals("*")) {
                    trustManager = new SSLTrustManager(null, true); //trust all
                } else
                {
                   String[] trustedHosts = sslTrust.split("\\s+");
                   trustManager = new SSLTrustManager(trustedHosts, false); //trust some
                   
                   if(serverHost == null || serverHost.isEmpty() || !Arrays.asList(trustedHosts).contains(serverHost)) {
                       throw new IOException("Server is not trusted: " + serverHost);
                   }
                   
                }
            } else {
                trustManager = new SSLTrustManager(null, false); //default
                
            }
             
            sslcontext.init(null, new TrustManager[]{trustManager}, null);
            
            createSocketFromFactory(sslcontext.getSocketFactory(), layer);
        } catch (KeyManagementException e) {
            //cannot happen
            throw new IOException(e);
        } catch (NoSuchAlgorithmException e) {
            //cannot happen
            throw new IOException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



