Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 62752 invoked from network); 20 Sep 2010 06:37:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Sep 2010 06:37:35 -0000 Received: (qmail 49501 invoked by uid 500); 20 Sep 2010 06:37:34 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 49451 invoked by uid 500); 20 Sep 2010 06:37:33 -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 49444 invoked by uid 99); 20 Sep 2010 06:37:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Sep 2010 06:37:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Sep 2010 06:37:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D518923889E3; Mon, 20 Sep 2010 06:37:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r998799 - in /directory/apacheds/trunk: kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java Date: Mon, 20 Sep 2010 06:37:08 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100920063708.D518923889E3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Mon Sep 20 06:37:08 2010 New Revision: 998799 URL: http://svn.apache.org/viewvc?rev=998799&view=rev Log: Fix GSSAPI tests on Windows 7 and Server 2008, hopefully. Modified: directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java Modified: directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java?rev=998799&r1=998798&r2=998799&view=diff ============================================================================== --- directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java (original) +++ directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java Mon Sep 20 06:37:08 2010 @@ -23,6 +23,8 @@ package org.apache.directory.server.kerb import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.security.PrivilegedAction; import java.util.Hashtable; @@ -158,6 +160,23 @@ public class SaslGssapiBindITest extends @Before public void setUp() throws Exception { + // On Windows 7 and Server 2008 the loopback address 127.0.0.1 + // isn't resolved to localhost by default. In that case we need + // to use the IP address for the service principal. + String hostName; + try + { + InetAddress loopback = InetAddress.getByName( "127.0.0.1" ); + hostName = loopback.getHostName(); + } + catch ( UnknownHostException e ) + { + System.err.println( "Can't find loopback address '127.0.0.1', using hostname 'localhost'" ); + hostName = "localhost"; + } + String servicePrincipal = "ldap/" + hostName + "@EXAMPLE.COM"; + ldapServer.setSaslPrincipal( servicePrincipal ); + Attributes attrs; setContexts( "uid=admin,ou=system", "secret" ); @@ -203,7 +222,7 @@ public class SaslGssapiBindITest extends attrs = getPrincipalAttributes( "Service", "KDC Service", "krbtgt", "secret", "krbtgt/EXAMPLE.COM@EXAMPLE.COM" ); users.createSubcontext( "uid=krbtgt", attrs ); - attrs = getPrincipalAttributes( "Service", "LDAP Service", "ldap", "randall", "ldap/localhost@EXAMPLE.COM" ); + attrs = getPrincipalAttributes( "Service", "LDAP Service", "ldap", "randall", servicePrincipal ); users.createSubcontext( "uid=ldap", attrs ); } Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java?rev=998799&r1=998798&r2=998799&view=diff ============================================================================== --- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java (original) +++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java Mon Sep 20 06:37:08 2010 @@ -25,13 +25,13 @@ import static org.junit.Assert.assertTru import static org.junit.Assert.fail; import java.lang.reflect.Field; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.nio.ByteBuffer; import javax.naming.NamingEnumeration; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; @@ -120,8 +120,8 @@ import org.slf4j.LoggerFactory; "cn: KDC Service", "sn: Service", - // ldap - "dn: uid=ldap,ou=users,dc=example,dc=com", + // ldap per host + "dn: uid=ldap-host,ou=users,dc=example,dc=com", "objectClass: inetOrgPerson", "objectClass: organizationalPerson", "objectClass: person", @@ -133,6 +133,21 @@ import org.slf4j.LoggerFactory; "krb5PrincipalName: ldap/localhost@EXAMPLE.COM", "krb5KeyVersionNumber: 0", "cn: LDAP Service", + "sn: Service", + + // ldap per IP + "dn: uid=ldap-ip,ou=users,dc=example,dc=com", + "objectClass: inetOrgPerson", + "objectClass: organizationalPerson", + "objectClass: person", + "objectClass: krb5principal", + "objectClass: krb5kdcentry", + "objectClass: top", + "uid: ldap", + "userPassword: randall", + "krb5PrincipalName: ldap/127.0.0.1@EXAMPLE.COM", + "krb5KeyVersionNumber: 0", + "cn: LDAP Service", "sn: Service" }) @CreateDS(allowAnonAccess = false, name = "SaslBindIT-class", partitions = @@ -158,6 +173,26 @@ additionalInterceptors = { KeyDerivation }) public class SaslBindIT extends AbstractLdapTestUnit { + public SaslBindIT() + { + // On Windows 7 and Server 2008 the loopback address 127.0.0.1 + // isn't resolved to localhost by default. In that case we need + // to use the IP address for the service principal. + String hostName; + try + { + InetAddress loopback = InetAddress.getByName( "127.0.0.1" ); + hostName = loopback.getHostName(); + } + catch ( UnknownHostException e ) + { + System.err.println( "Can't find loopback address '127.0.0.1', using hostname 'localhost'" ); + hostName = "localhost"; + } + String servicePrincipal = "ldap/" + hostName + "@EXAMPLE.COM"; + ldapServer.setSaslPrincipal( servicePrincipal ); + } + /** * Tests to make sure the server properly returns the supportedSASLMechanisms.