Return-Path: Delivered-To: apmail-incubator-directory-dev-archive@www.apache.org Received: (qmail 63645 invoked from network); 13 Dec 2004 22:10:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 Dec 2004 22:10:31 -0000 Received: (qmail 18211 invoked by uid 500); 13 Dec 2004 22:10:30 -0000 Delivered-To: apmail-incubator-directory-dev-archive@incubator.apache.org Received: (qmail 18119 invoked by uid 500); 13 Dec 2004 22:10:30 -0000 Mailing-List: contact directory-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list directory-dev@incubator.apache.org Received: (qmail 18105 invoked by uid 99); 13 Dec 2004 22:10:30 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from ns1.webservicesolutions.com (HELO ns1.webservicesolutions.com) (69.44.62.208) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 13 Dec 2004 14:10:26 -0800 Received: from 10.0.2.4 ([10.0.2.4]) by ns1.webservicesolutions.com (JAMES SMTP Server 2.2.1-RC1) with SMTP ID 185 for ; Mon, 13 Dec 2004 16:10:22 -0600 (CST) From: Mark Swanson Organization: Web Service Solutions, Inc. To: "Apache Directory Developers List" Subject: Re: Q: LookupFilter doesn't receive useful info Date: Mon, 13 Dec 2004 17:10:24 -0500 User-Agent: KMail/1.6.2 References: <200412131459.17437.mark@ScheduleWorld.com> <200412131602.52635.mark@ScheduleWorld.com> <41BE083C.6000104@bellsouth.net> In-Reply-To: <41BE083C.6000104@bellsouth.net> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200412131710.24620.mark@ScheduleWorld.com> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N > >I have successfully inserted my own SWLookupFilter into eve. > > This last sentence I still don't understand. Where is this > LookupFilter code from? Is this code yours? Is this a filter you're > writing for your custom interceptors? Oh. _my own_ SWLookupFilter. Yes, I wrote it. :-) I changed EveContextFactory like this: ~line 480 FilterService filterService = new FilterServiceImpl(); SWLookupFilter swLookupFilter = new SWLookupFilter(); SWSearchResultFilter swSearchResultFilter = new SWSearchResultFilter(); filterService.addLookupFilter(swLookupFilter); filterService.addSearchResultFilter(swSearchResultFilter); interceptor = (Interceptor)filterService; So by tapping into the FilterService interceptor, I was hoping to do the dynamic rewriting the query and result here. If this is the wrong spot lemme know. > >SWLookupFilter.filter(LdapContext ctx, Name dn, Attributes entry) is > > called and I print out "dn" and "entry". I get the following: > > > >dn: empty > >entry: > >1. Apache Software Foundation > >2. ou=system > >3. dc=home2,dc=mark > >4. cn=schema,ou=system > > > >The problem/question is this: how is it possible for SWLookupFilter to do > > any sort of filtering or query rewriting when SWLookupFilter isn't > > presented with the query or baseDN? perhaps the baseDN is available in > > the LdapContext but looking at the API doesn't reveal it (to me at > > least). > > Well I'm going to presume u are trying to write an interceptor to filter > entries on a return for schedule world. There really is nothing in this > trail that says anything like that but this is the only thing I can > think of after scratching my head here for 5 minutes. Close, sorry for not giving enough info. > Also note that btw a base search on the empty string DN is valid in > LDAP. That's a search on the root DSE. Now this might come into the > server if you are hitting it with a client that reads schema info. I > recommend this...whip out ethereal and get it to show you what's being > sent by the client to be absolutely sure of what's happening. I doubt it's empty as I'm explicitly specifying it. I'll whip out ethereal in a minute... > You can send that to me too. Also if you like send the filter code. > I'll take a look at it. BTW just to be sure ... this is your custom dev > code and not any bug that needs to be fixed for 0.8.0 right? Yep. public class SWLookupFilter implements LookupFilter { public SWLookupFilter() { System.out.println("DEBUG: SWLookupFilter ctor."); } /*public void filter(LdapContext ctx, Name dn, Attributes entry) throws NamingException { filter(ctx, dn, entry); }*/ public void filter(LdapContext ctx, Name dn, Attributes entry, String[] ids) throws NamingException { filter(ctx, dn, entry); } public void filter(LdapContext ctx, Name dn, Attributes entry) throws NamingException { Name principalDn = ((EveContext)ctx).getPrincipal().getDn(); System.out.println("DEBUG: SWLookupFilter.filter() principalDn:" + principalDn); System.out.println("DEBUG: SWLookupFilter.filter() Name:" + dn.getClass().getName()); System.out.println("DEBUG: SWLookupFilter.filter() dn components:"); int count = dn.size(); for (int i=0; i < count; ++i) { String component = dn.get(i); System.out.println("DEBUG: SWLookupFilter.filter() dn component:" + component); if (component.startsWith("mozilla")) { dn.remove(i); dn.add(i, "super"); } } NamingEnumeration ne = entry.getAll(); for (; ne.hasMore(); ) { Attribute attribute = (Attribute)ne.nextElement(); System.out.println("DEBUG: SWLookupFilter.filter() attributes:"); int size = attribute.size(); for (int i=0; i < size; ++i) { Object o = attribute.get(i); System.out.println("o:" + o.toString() + ", class:" + o.getClass().getName()); } } } } -- Free SyncML-capable J2ME & J2SE replacement for Exchange and Outlook http://www.ScheduleWorld.com/ WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb