Help!  Search with no results

The problem I'm having is that users are in different domains in the company I'm working in. If the searched user is in the same domain (e.g. DC=B, DC=A) of the administrator, it returns exact one record. However, if the user is under the sub-domain (i.e. DC=C, DC=B, DC=A), and I've set the search control to scope to sub-tree, the searching returns no records. Does anybody know how to solve this?
Here is the snippet of my code:
  public String getDN(String userid) {
    String dn = "CN=admin,OU=Sharing Account,DC=ABC,Dc=com,DC=tw";
    String ldap_url = "ldap://f1soa02.cmo.com.tw:389";
    String password = "xxxx";
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put("java.naming.ldap.version", "3");
    env.put(Context.PROVIDER_URL, ldap_url);
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL, dn);
    env.put(Context.SECURITY_CREDENTIALS, password);
    DirContext ctx;
    String[] attrs = { "cn" };
    try {
      ctx = new InitialDirContext(env);
      SearchControls ctls = new SearchControls();
      ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
      ctls.setReturningAttributes(attrs);
      String filter = "(CN=" + userid + ")";
      // Search for objects with these matching attributes
      NamingEnumeration results = ctx.search("DC=cmo,Dc=com,DC=tw",filter,ctls);
      if ( results != null && results.hasMoreElements()) {
        SearchResult sr = (SearchResult)results.nextElement();
        dn = sr.getName();
      } else dn = null;
      ctx.close();
    } catch (AuthenticationException e){
      System.out.println(" getDN() Authentication Exception: " + e);
      return null;
    } catch (NamingException e) {
      System.out.println(" getDN() Naming Exception: " + e);
      return null;
    return dn;
  public static void main(String[] args) {
    UserAuthenticate ua = new UserAuthenticate();
    //boolean valid = ua.ldapAuthenticate("joy_huang", "babula52395239");
    boolean valid = ua.ldapAuthenticate("karen_fang", "karenf12");
    if (valid)
      System.out.println("Valid User");
    else
      System.out.println("Invalid User");
  }

1). Can't get connected to Global Catalog port 3268. Does this mean that I have to get the permission from the administrator to connect to that port?
No.
Not all domain controllers host a global catalog. If a DC is not listening on port 3268 (or 3269 over SSL) then it is not hosting a GC.
You can find both GC's & DC's through DNS. For example if using the DnsContextFactory, you can find a GC using the DNS Query result:String strService = "_gc._tcp";
String strQuery[]={"SRV"};
Attributes dnsQueryresult = dnsContext.getAttributes(strService,strQuery);For completeness, the query should also take into consideration sites (IP subnets), so you return a DC or GC closest to your server. You may want to look at the Win32 API DSGetDCName and provide similar functionality in your app.
(Refer to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/dsgetdcname.asp)
If you are able to connect to port 3268 (the GC) but do not return any results, then the ACL's may not give you permission to view the objects or their attributes.
2). How to find out the returning attributes? Our server seems do not have the attributes listed in the sample...
IIRC, the attributes I have listed are included in the Partial Attribute Set (PAS), which is the term used to describe which attributes are included in the GC.
Details on the default attributes contained in the GC can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/attributes_global.asp
Note that the GC abides by the exact same security controls as a DC, so if your user does not have access to the objects and their attributes in a domain, it won't have access to them in a GC.
If you want to return all available attributes, just specify null for the returned attributes.SearchControls searchCtls = new SearchControls();
String returnedAttributes[] = null;
searchCtls.setReturningAttributes(returnedAttributes);
...and to list out a returned attribute's name, use the getID method.
3). Can't have empty base DN when searching? Why? Is that system limitation?
AFAIHI (As far as I have interpreted) the LDAP RFC states that an empty BaseDN is used when querying RootDSE. It is does not state what the behaviour should be otherwise. (In RFC 2251 the search base is defined as a LDAP Distinguished Name, which in turn is defined as a LDAP String, which is finally defined as an Octet String. Doesn't specify what should happen with a null value)
From an Active Directiory perspective, for an LDAP search, you must supply a valid base distinguished name. For a Global Catalog search, the base distinguished name can be any value, including the value "NULL" (" ").
If you use a NULL base distinguished name with a scope of one level or subtree and specify port 389 (the default LDAP port), the search fails, whereas if you use a NULL base distinguished name with a scope of object level and specify port 389, it will return the RootDSE.

Similar Messages

  • Sandpit and Dev give Address search with different results using Web UI

    Using the Sandpit system I can perform a BP search on Street and enter the post code, but it still finds the right address. However, in our development sytsem it does not. The FM which performs the search is identical so I assume this would be down to some kind of address related config?. Can anyone enlighten me further as what could possible cause this?.
    Jason
    [RESOLVED]
    Edited by: Jason Stratham on Sep 8, 2009 11:35 AM

    Okay. So, I asked the admin to create a scope for the list, which they did following the steps outlined in Ben Tedders article, and then I followed the steps in the rest of the article setting up the web parts. When I ran a search, it returned the no results
    page. Not sure why, but I removed the scope from the Search Core Results web part, and the search returned usable data from the list.
    Here's my part ii question - - how do I customize the Search Core Results web part to display the data from the search in manner that makes more sense than from a list of nondescript layout of,
    Search Result
         Search Term ... dataField01 ... dataField02 ... dataField03 ... dataField04 ...
         author info
    url info
    to something a tad more informative, such as,
    You search for Search Term, with the following results:
         Search Result
              dataField01 label ... dataField01
              dataField02 label ... dataField02
              dataField03 label ... dataField03
              dataField04 label ... dataField04
    because nobody's really going to care who uploaded the list or want to link to the data pulled from the list in one of those columnar results tables.

  • NEED HELP Search with SAF/TREX

    Hello Gurus,
    I have to work on standard screen in that they are fetching database and extracting the data by using CL_CRM_EI_IIA_QUERY_UI class. In this calss they are using SET_QUERY, GET_QUERY, GET_TEXT_QUERY, SET_TEXT_QUERY,CREATE_TEXT_EDITOR methods.
    I have to add three more fields to this existing screen and ned to add these field values in the search process. I am trying to understand the code and they have not used any select statement. can you pelase help me how to use the above class and for my requirement..
    the screen which i am trying to change is CIC0 transaction in CRM win client in FAQ tab knowledge search screen.
    what is the  SAF/TREX
    Please help me on this issue.
    regards

    i purchased from a lady off Etsy..she sent it to me in PDF. EPS.
    and Adobe format.
    i was on my mobile device earlier when i wrote the first post.
    I can open the file up in adobe. BUT it has a grey and white checkered background and is very large text.
    I somehow got it to actually open like a watermark on a photo last nite but the tex was so big it only came across as 2 letters..
    I can post the files anywhere just let me kno ..im not sure if they was done wrong or I just am that computer illiterate..which I can believe..i have been robbed quite a bit on logos and blah blah..
    I mean no aggravation to anyone, i just dont have a clue where to turn to and get "LEGIT" answers and thats what I need so thats why Im here ..

  • Firefox Help Search Found 0 results for how do I remove an image from my apps toolbar area. It's not an app. it's a partial image from my desktop icons. It's like it partially opened and froze.

    <blockquote>Locking duplicate thread.<br>
    Please continue here: [[/questions/919974]]</blockquote>
    I have a partial image from one of my desktop icons stuck in the app bar of my firefox yahoo homepage and can't seem to remove it.

    Try this -
    <img src="assets/jpgs/Prodigy Logo Large 2014.jpg" width="180" height="180" alt="" style="display:block;">
    What you are seeing as whitespace is the space reserved for glyph descenders on any element that is rendered within a text box (i.e., an inline element). By making the image "display:block" you eliminate that space because a block element doesn't have descenders. If that works to your satisfaction then you can give the logo an id, and create a CSS selector containing that block style.

  • How do I filter my Help search to eliminate unrelated items?

    I'm working in Illustrator CS 5, but this question really applies to any Adobe product:
    How do I get the Help search to limit results to items related to the actual program I'm using, and to the subject I enter in the search bar?
    For example, if I type "join" in the search bar and select Illustrator from the dropdown menu, and check "Adobe Reference Only" the first 6 items I get are about javascript and SQL programming. This happens for any help search I do. I assume there's a way to get useful results from the Help search and I'm just missing it.
    Suggestions, anybody?

    Barry,
    In addition to what Monika said, if some unwanted added word(s) fill the top of the search, you may add -[unwanted word] for the/each word after the wanted part.

  • My search bar for my library no longer works. Also, the menu bar is no longer visible. Noticed this problem last Saturday. Can anyone help me with this?

    My search bar for my iTunes library no longer works. Also, the menu bar is no longer visible. Noticed this problem last Saturday. This might be an issue with my desktop, and not iTunes itself Can anyone help me with this?

    Press Ctrl-B to toggle the menu bar on and off.
    When you say that the "search bar for my iTunes library no longer works" can you be more specific?  The operation of the search function has changed in iTunes 12, essentially having two very distinct modes:
    when Search Entire Library is checked, entering a search string will generate a dropdown of all matching items within your whole library, from which multiple operations are available via context menus
    when Search Entire Library is unchecked, entering a search string creates a filtered view of whatever your current focus is (e.g., if you're looking at a playlist the filter applies only to items in that playlist) with none of the dropdown options as in the first case

  • After installing iOS6, my Maps are not working at all, anything i search it says "result not found" even after placing a pin and selecting "Direction to here" i get the same result not found. Very disappointed with the new iOS

    After installing iOS6, my Maps are not working at all, anything i search it says "result not found" even after placing a pin and selecting "Direction to here" i get the same result not found. Very disappointed with the new iOS.

    Have you run it in a debugger? That will show you exactly what is happening and why.

  • 1. Firefox Help 2. Search Refine your search Found 0 results for I have a lot of firefox downloads BUT can't find anything to click to see them - Where is the button that will show all Firefox downloads? in English in English

    1. Firefox Help
    2. Search
    Refine your search
    Found 0 results for I have a lot of firefox downloads BUT can't find anything to click to see them - Where is the button that will show all Firefox downloads? in English in English

    Tools > Downloads or {Ctrl + J} will open the Downloads window

  • When I search for something, firefox opens a new tab with the results. How can I change the settings to where it will all stay in the same tab?

    When I search something Firefox automatically opens a new tab with the results of this search. How do I change the settings to where the results will appear in the same tab as where I conducted the search?

    Whether to open search results in new window most often is a setting of the search engine you are using.

  • In your tutorial, having a problem linking the "Search the LabVIEW bookshelf" (on my D drive) help function with my Acrobat 4.0 reader(on my C drive)

    When I was using the temp system demo vi, I selected Help>>Search the LabVIEW bookshelf. I then had a pop up window display tell me that the manual file "D:\National Instruments\LabVIEW 6.1\manuals\lvlib.pdf" could not be opened. I then did a search for this file and found that the pdf file is where it should be. I also checked to see that my Acrobat 4.0 reader files were in tact and they are. I was able to open up this file in Acrobat 4.0 but only by double clicking the name of the pdf file while it is highlighted in my find files function box (It also works if I go directly to the pdf file itself in its folder location a
    nd double clicked on it). Nevertheless, for some reason when a vi is opened and when using the Help function in order to use "Search the LabVIEW bookshelf", it does not link to my Acrobat reader. Are my LabVIEW configuration settings wrong? I just recently had LabVIEW 6.1 installed. What do I need to do in order for LabVIEW to properly link up to my AcroRD32.exe file?

    In your LabVIEW 6.1\help directory, please replace the lvmanual.vi with the attached VI and try to select Help>Search the LabVIEW Bookshelf again.
    If it still does not work, please post a reply.
    Thank you,
    Kelly Holmes
    LV Documentation
    Kelly H
    LabVIEW Documentation
    National Instruments
    Attachments:
    lvmanual.vi ‏49 KB

  • I have a Mac pro (10.7.5) and two PC's(windows 7). I am unable to ping either of PC through Mac. However Both PC's reply ping to each other and to Mac as well. Help me with this. Searched Internet. Cant resolve till now

    I have a MB pro (10.7.5) and two PC's(windows 7). I am unable to ping either of PC through Mac. However, Both PC's reply ping made to each other and to Mac as well. Help me with this. Searched Internet. Cant resolve till now
    Regards
    MacIts.

    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    Request timeout for icmp_seq 2
    Request timeout for icmp_seq 3
    Request timeout for icmp_seq 4
    Request timeout for icmp_seq 5
    Request timeout for icmp_seq 6
    is the reply m getting.

  • I just installed iLife 'll but i can not find it in my applications. I've tried installing it nearly 10 times with no results. PLEASE HELP!!

    i just installed iLife 'll but i can not find it in my applications. I've tried installing it nearly 10 times with no results. PLEASE HELP!!

    i found the original demos of the iPhoto, iMovie, Garageband,
    I think you'll find those are the applications you have installed.
    Regards
    TD

  • What do you recommend to get started with Dynamics Marketing? Book, You Tube, help searches, etc.? Please advise.

    Trying to get started with marketing using dynamics and tutorials, help searches and you tube seem to be fruitless. What do you recommend to get started? Buy a book to walk thru setting up company settings and creating campaigns? Need some easy steps on
    not what the software is capable of but how to do it with easy 1-2-3 steps.  Please share you thoughts!!

    Hi cb,
    I would recommend a few articles here. There are videos, walkthroughs and ebooks that you can take a look at the have
    a better understanding of not only what the product is capable of, but how to actually configure and work with it.
    Help & Training - Videos and ebooks
    TN Articles 

  • [Help Wanted] soap1.1 webservice, filling a tree with the result of calls...

    Hi,
    I'm having trouble with filling a tree with the result to
    calls to a document/wrapped soap 1.1 webservice.
    I first declared the webservice in the mxml file as it was in
    the examples and tried to call it with no luck. The fault was it
    wasn't finding the document type for the call's unique parameter. I
    figured out the solution to this, I added a method in the
    webservice declaration having a single element named the same as
    the required parameter, and inside it, the "actual" parameters,
    bound to variables defined elsewhere.
    The reason for wanting the tree to be filled programatically,
    is the potential whole contents of the tree can be about 1.000.000
    nodes. Huge.
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" applicationComplete="initM()">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.controls.Alert;
    import mx.controls.treeClasses.TreeListData;
    [Bindable] public var aParentId:String = null;
    [Bindable] public var aLevel:Number = 0;
    ]]>
    </mx:Script>
    <mx:WebService id="lws" wsdl="
    http://myServer/myContext/myPortURI?WSDL"
    useProxy="false" makeObjectsBindable="true">
    <mx:operation name="getNodes" resultFormat="object">
    <mx:request>
    <getNodesElement>
    <parentId>{aParentId}</parentId>
    <level>{aLevel}</level>
    </getNodesElement>
    </mx:request>
    </mx:operation>
    </mx:WebService>
    <mx:Tree x="0" y="0" width="326" height="100%"
    id="layoutTree" enabled="true" labelField="nodeName">
    <mx:dataProvider>{lws.getNodes.lastResult}</mx:dataProvider>
    </mx:Tree>
    <mx:Script>
    <![CDATA[
    public function initM():void {
    lws.getNodes.send();
    return;
    ]]>
    </mx:Script>
    </mx:Application>
    So, here's the problem:
    1.- In both Java2 and .NET, I've been able to produce sets of
    proxy classes from the webservice wsdl, these include a proxy class
    for the service port and a set of classes for both the call
    parameter types and the call result types. I have not found yet a
    way to do the same with flex2, so I wonder, can I produce the
    required classes for dealing with such a webservice in an automatic
    way with flex2?
    2.- The second problem, is I haven't found a way to make a
    webservice call in sychronous mode, and I can't seem to find a way
    to set the parameters for the subsequent calls to the webservice.
    Is there a way to make a call to such webservice programatically? I
    mean, I've been able to make the first call I need programatically,
    but what if I end up making 2 or more simultaneous calls? I can't
    rely on setting the `variables defined elsewhere` before each call,
    because of possible concurrency issues (calls will be long after
    the 2nd level of the tree), so I wonder if there's a way to make a
    call to such webservice (document/wrapped, soap1.1) passing it the
    parameters programatically. If so, can I just put the parameters or
    do I have to produce the complete enclosure? If I have to produce
    also the enclosure, any hint on how to do so? I will need to pass
    different parentId, level pairs probably triggered by tree events.
    3.- the other problem, finally, is Tree looks quite different
    to me than the Java2 one. In java2, I can easily produce a changing
    model for the tree wich will even handle the calls to the
    webservice as needed (triggered by the tree itself), making it a
    `live model`. If there is a way to produce the same behaviour in
    flex2, I haven't found it yet. Sure, I've only downloaded the trial
    version yesterday, so I may have overlooked some docs or blogs.
    Any hints would be appreciated, specially on programatically
    modifying the tree, and making calls to the webservice changing the
    parameters every time.

    1. Not yet, but we're looking into supporting this in an
    upcomming release.
    2. All RPC requests must be made asynchronously... this is a
    restriction of the way the Flash Player makes network requests
    (otherwise movies, which are single threaded, would hang waiting
    for results). You should be able to use the ActionScript API to
    programmatically call web services with normal parameters.
    3. If you leave makeObjectsBindable="true" (which it is by
    default) the Objects and Arrays will be wrapped in ObjectProxies
    and ArrayCollections automatically and will report change events,
    however I don't believe that we have an example that links these
    change events up to subsequent web service calls, but it would be
    possible (but not automatic). A feature that does do this sort of
    thing automatically is the Data Service, although this does not use
    WSDL/SOAP to describe/communicate with remote services and you have
    to setup a Java assembler to work with our adapters on the
    server.

  • Help with streaming result sets and prepared statements

    hi all
    I create a callable statement that is capable of streaming.
    statement = myConn2.prepareCall("{call graphProc(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}",java.sql.ResultSet.TYPE_FORWARD_ONLY,
    java.sql.ResultSet.CONCUR_READ_ONLY);
    statementOne.setFetchSize(Integer.MIN_VALUE);
    the class that contains the query is instantiated 6 times the first class streams the results beautifully and then when the second
    rs = DatabaseConnect.statementOne.executeQuery();
    is executed I get the following error
    java.sql.SQLException: Can not use streaming results with multiple result statements
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1370)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1688)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3031)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:943)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1049)
    at com.mysql.jdbc.CallableStatement.executeQuery(CallableStatement.java:589)
    the 6 instances are not threaded and the result set is closed before the next query executes is there a solution to this problem it would be greatly appreciated
    thanks a lot
    Brian

    Database resources should have the narrowed scope
    possible. I don't think it's a good idea to use a
    ResultSet in a UI to generate a graph. Load the data
    into an object or data structure inside the method
    that's doing the query and close the ResultSet in a
    finally block. Use the data structure to generate
    the graph.
    It's an example of MVC and layering.
    Ok that is my bad for not elaborating on the finer points sorry, the results are not directly streamed into the graphs from the result set. and are processed in another object and then plotted from there.
    with regards to your statement in the beginning I would like to ask if you think it at least a viable option to create six connections. with that said would you be able to give estimated users using the six connections under full usage.
    just a few thoughts that I want to
    bounce off you if you don't mind. Closing the
    statement would defeat the object of of having a
    callable statement How so? I don't agree with that.
    %again I apologise I assumed that since callable statements inherit from prepared statements that they would have the pre compiled sql statement functionality of prepared statements,well If you consider in the example I'm about to give maybe you will see my point at least with regards to this.
    The statement that I create uses a connection and is created statically at the start of the program, every time I make a call the same statement and thus connection is used, creating a new connection each time takes up time and resources. and as you know every second counts
    thanks for your thoughts
    Brian.

Maybe you are looking for

  • Getting the path  of the java file your code is in

    Hey, How can I get the full path of where my java file is on my computer in my java code? Something like this is what I want: this.getFilePath(); Thanks! / Ellen

  • J_security_check  causing 404 Error

    <b>Hello All<BR> I am using Weblogic 8.1 SP3, I am trying to use the Active Directory as a means for Authentication via a FORM based login-module. <BR> I have followed the directions in the Weblogic Security documentation but I am getting a 404 Error

  • BT Sport with Sky Multiroom

    So the nice man I just phoned at BT tells me that BT Sport isn't available on sky multiroom. I thought he was kidding. I've got BT Broadband, (Unfortunately - Most reliable Internet connetion my left bum cheek) so the service should be free anyway. A

  • Users and Tablespaces

    Specs: OS: Win 2003 Sp1 Oracle 9i - rel2 (9.2.0.5.0) I had something like 200 users and dedicated tablespaces associated to them. Eventually, I ran into a usual very natural and obvious problem of -running low on disk space. So I took a task to free

  • Is there any complete sample with its execution steps for kerberos?

    Hi Thank you for reading my post Is there any sample (java files) with a howto that i can use as an start point? for example some complete sample which authenticate users with windows server 2003, and sample gives some details about when to use kinit