Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 34506 invoked from network); 1 Jan 2007 22:15:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jan 2007 22:15:52 -0000 Received: (qmail 12087 invoked by uid 500); 1 Jan 2007 22:15:57 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 12043 invoked by uid 500); 1 Jan 2007 22:15:56 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 11999 invoked by uid 99); 1 Jan 2007 22:15:56 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jan 2007 14:15:56 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jan 2007 14:15:49 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id AD41D1A981A; Mon, 1 Jan 2007 14:14:53 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r491658 - /directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java Date: Mon, 01 Jan 2007 22:14:53 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070101221453.AD41D1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Mon Jan 1 14:14:52 2007 New Revision: 491658 URL: http://svn.apache.org/viewvc?view=rev&rev=491658 Log: Fixed errors with ldaps and StartTLS, removed warnings Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java?view=diff&rev=491658&r1=491657&r2=491658 ============================================================================== --- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java (original) +++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java Mon Jan 1 14:14:52 2007 @@ -60,7 +60,7 @@ private String credentials; - private Hashtable environment; + private Hashtable environment; private InitialLdapContext context; @@ -78,7 +78,7 @@ ExtendedProgressMonitor monitor ) throws NamingException { - this.environment = new Hashtable(); + this.environment = new Hashtable(); this.environment.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" ); //$NON-NLS-1$ this.environment.put( "java.naming.ldap.version", "3" ); //$NON-NLS-1$ //$NON-NLS-2$ @@ -95,9 +95,7 @@ { environment.put( Context.PROVIDER_URL, "ldaps://" + host + ":" + port ); //$NON-NLS-1$ //$NON-NLS-2$ environment.put( Context.SECURITY_PROTOCOL, "ssl" ); //$NON-NLS-1$ - environment - .put( - "java.naming.ldap.factory.socket", "org.apache.directory.ldapstudio.browser.internal.model.DummySSLSocketFactory" ); //$NON-NLS-1$ //$NON-NLS-2$ + environment.put( "java.naming.ldap.factory.socket", DummySSLSocketFactory.class.getName() ); //$NON-NLS-1$ } else { @@ -533,23 +531,7 @@ return true; } } ); - // SSLSession session = tls.negotiate(new - // DummySSLSocketFactory()); - - // System.out.println("Session: " + - // session.toString()); - // System.out.println("Protocol: " + - // session.getProtocol()); - // System.out.println("PeerHost: " + - // session.getPeerHost()); - // System.out.println("CipherSuite: " + - // session.getCipherSuite()); - // System.out.println("PeerCerts: " + - // Arrays.asList(session.getPeerCertificates())); - // //System.out.println("LocalCerts: " + - // Arrays.asList(session.getLocalCertificates())); - // System.out.println("SessionContext: " + - // session.getSessionContext()); + tls.negotiate( new DummySSLSocketFactory() ); } catch ( Exception e ) @@ -618,10 +600,15 @@ { try { - environment.put( Context.SECURITY_AUTHENTICATION, authMethod ); - environment.put( Context.SECURITY_PRINCIPAL, principal ); - environment.put( Context.SECURITY_CREDENTIALS, credentials ); - context = new InitialLdapContext( environment, connCtls ); + context.removeFromEnvironment( Context.SECURITY_AUTHENTICATION ); + context.removeFromEnvironment( Context.SECURITY_PRINCIPAL ); + context.removeFromEnvironment( Context.SECURITY_CREDENTIALS ); + + context.addToEnvironment( Context.SECURITY_PRINCIPAL, principal ); + context.addToEnvironment( Context.SECURITY_CREDENTIALS, credentials ); + context.addToEnvironment( Context.SECURITY_AUTHENTICATION, authMethod ); + + context.reconnect( context.getConnectControls() ); } catch ( NamingException ne ) {