Sorry, the files are _really_ attached now.

Boris

-------- Original Message --------
Subject:        [Mono-devel-list] Bugs on System.DirectoryServices
Date:   Tue, 15 Mar 2005 16:14:13 +0200
From:   Boris Kirzner <[EMAIL PROTECTED]>
To:     mono-devel mailing list <mono-devel-list@lists.ximian.com>



Hello all
Sorry for sending bugs to the devlist, but Bugzilla does not offer an option to open bug on DirectoryServices.
If somebody can add this component to Bugzilla, I'll just open this bug as usual.


Description of Problem:
DirectorySearcher.FindAll does not uses SizeLimit property to narrow search results


Steps to reproduce the problem:
1. Configure OpenLDAP server with the diff attached
2. Run the attached nunit sample

Actual Results:
Results contains 12 entries

Expected Results:
Results contains 3 entries

How often does this happen?
Always

Additional Information:
After changing FindAll to use SizeLimit to narrow search, the exception is thrown. Reason : ldap server returns message with error code LDAP_SIZELIMIT_EXCEEDED, this is ok, but the implementation throws an exception.



Boris

--
Boris Kirzner
Mainsoft Corporation
http://www.mainsoft.com

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


-- Boris Kirzner Mainsoft Corporation http://www.mainsoft.com

using System;
using System.DirectoryServices;
using NUnit.Framework;

namespace GH_cs_DirectoryServicesTest
{
        [TestFixture]
        public class SimpleTest
        {
                static string LDAPServerConnectionString = "LDAP://xp050/"; + 
"dc=myhosting,dc=example";
                static string LDAPServerUsername = 
"cn=Manager,dc=myhosting,dc=example";
                static string LDAPServerPassword = "secret";

                [Test]
                public void SizeLimitTest()
                {
                        DirectoryEntry de = new 
DirectoryEntry(LDAPServerConnectionString,
                                                                        
LDAPServerUsername,
                                                                        
LDAPServerPassword,
                                                                        
AuthenticationTypes.ServerBind);
                        DirectorySearcher ds = new DirectorySearcher(de);

                        Assert.AreEqual(ds.SizeLimit,0);
                        
                        ds.Filter = 
"(|(objectClass=person)(objectClass=organizationalUnit))";
                        SearchResultCollection results = ds.FindAll();
                        Assert.AreEqual(results.Count,12);

                        ds.SizeLimit = 3;
                        Assert.AreEqual(ds.SizeLimit,3);

                        ds.Filter = 
"(|(objectClass=person)(objectClass=organizationalUnit))";
                        results = ds.FindAll();
                        Assert.AreEqual(results.Count,3);

                        ds.SizeLimit = Int32.MaxValue;
                        Assert.AreEqual(ds.SizeLimit,Int32.MaxValue);

                        ds.Filter = 
"(|(objectClass=person)(objectClass=organizationalUnit))";
                        results = ds.FindAll();
                        Assert.AreEqual(results.Count,12);
                }
        }
}
version: 1
dn: dc=myhosting,dc=example
objectClass: dcObject
objectClass: organization
dc: myhosting
description: My wonderful company as much text as you want to place in this 
line up to 32Kcontinuation data for the line above must have <CR> or <CR><LF> 
i.e. ENTER works on both Windows and *nix system - new line MUST begin with ONE 
SPACE
o: Example, Inc.

dn: ou=people,dc=myhosting,dc=example
objectClass: organizationalUnit
description: All people in organisation
ou: people

dn: ou=Human Resources,ou=people,dc=myhosting,dc=example
objectClass: organizationalUnit
ou: Human Resources

dn: cn=John Smith,ou=Human Resources,ou=people,dc=myhosting,dc=example
objectClass: organizationalRole
cn: John Smith
description: Very clever person
ou: Human Resources
telephoneNumber: 1 801 555 1212

dn: cn=Barak Tsabari,ou=Human Resources,ou=people,dc=myhosting,dc=example
objectClass: person
objectClass: organizationalPerson
cn: Barak Tsabari
facsimileTelephoneNumber: +1 906 777 8853
ou: Human Resources
ou: People
sn: Tsabari
telephoneNumber: +1 906 777 8854

dn: ou=R&D,ou=people,dc=myhosting,dc=example
objectClass: organizationalUnit
ou: R&D

dn: cn=Yossi Cohen,ou=R&D,ou=people,dc=myhosting,dc=example
objectClass: person
objectClass: organizationalPerson
cn: Yossi Cohen
facsimileTelephoneNumber: +1 503 777 4498
ou: R&D
ou: People
sn: Cohen
telephoneNumber: +1 503 777 4499

dn: cn=Uzi Cohen,ou=R&D,ou=people,dc=myhosting,dc=example
objectClass: person
objectClass: organizationalPerson
cn: Uzi Cohen
facsimileTelephoneNumber: +1 602 333 1234
ou: R&D
ou: People
sn: Cohen
telephoneNumber: +1 602 333 1233

dn: cn=Daniel Cohen,ou=R&D,ou=people,dc=myhosting,dc=example
objectClass: person
objectClass: organizationalPerson
cn: Daniel Cohen
facsimileTelephoneNumber: +1 602 333 1235
ou: R&D
ou: People
sn: Cohen
telephoneNumber: +1 602 333 1236

dn: cn=Sara Cohen,ou=R&D,ou=people,dc=myhosting,dc=example
objectClass: person
objectClass: organizationalPerson
cn: Sara Cohen
facsimileTelephoneNumber: +1 602 333 1244
ou: R&D
ou: People
sn: Cohen
telephoneNumber: +1 602 333 1243

dn: ou=DevQA,ou=people,dc=myhosting,dc=example
objectClass: organizationalUnit
ou: DevQA

dn: cn=Daniel Smith,ou=DevQA,ou=people,dc=myhosting,dc=example
objectClass: person
objectClass: organizationalPerson
cn: Daniel Smith
facsimileTelephoneNumber: +1 408 555 3372
l: Santa Clara
ou: DevQA
ou: People
sn: Smith
telephoneNumber: +1 408 555 9519

dn: cn=Daniel Morgan,ou=DevQA,ou=people,dc=myhosting,dc=example
objectClass: person
objectClass: organizationalPerson
cn: Daniel Morgan
facsimileTelephoneNumber: +1 805 666 5645
ou: DevQA
ou: People
sn: Morgan
telephoneNumber: +1 805 666 5644

dn: cn=Manager,dc=myhosting,dc=example
objectClass: organizationalRole
cn: Manager

dn: cn=Uzi Cohen,cn=Manager,dc=myhosting,dc=example
objectClass: person
objectClass: organizationalPerson
cn: Uzi Cohen
facsimileTelephoneNumber: +1 602 333 1234
ou: R&D
ou: People
sn: Cohen
telephoneNumber: +1 602 333 1233

Reply via email to