hate these ads?, log in or register to hide them
Results 1 to 13 of 13

Thread: LDAP query help

  1. #1
    JForce's Avatar
    Join Date
    April 12, 2011
    Location
    All up in your momma's ass
    Posts
    633

    LDAP query help

    Need help with an LDAP query.

    Scenario is a system will query at login to see if a user is a member of various groups that match an internal config to give various access rights.

    So, am trying to get a query that will return all the groups a specified user is a member of, within a specified OU. The OU has 100 or so groups, but each user should only be a member of a few.

    Will the following query work?

    (&(objectcategory=group)(member=cn=XXX,ou=groups,o u=stores,ou=something else,ou=businessunits,dc=XXX,dc=net))

    Don't have access to test/run it to see what it would return unfortunately :/
    "He will come in one of the pre-chosen forms. During the rectification of the Vuldrini, the traveler came as a large and moving Tor. Then, during the third reconciliation of the last of the McKetrick supplicants, they chose a new form for him: that of a giant Slor! Many Shuvs and Zuuls knew what it was to be roasted in the depths of the Slor that day, I can tell you!"

  2. #2

    Join Date
    April 9, 2011
    Location
    Denmark
    Posts
    3,647
    do yourself a favor and capitalize the object type.

    also, this part looks strange. "member=cn=XXX" is member a variable you are stuffing something into ?
    your query is wrong anyway, since LDAP does not have support for spaces, depending on what specific LDAP implementation you are talking to it may or may not support it with "" around it, but that is entirely dependent on the implementation itself, see below for the "correct" syntax that at least most of Microsoft's products will accept.

    CN=xxx,OU=groups,OU=stores,OU="something else",OU=BuisnessUnits,DC=xxx,DC=net

    a virtualized DC takes 30 minutes to configure, you should have access to MSDN licences if you do any serious work on Microsoft products, do yourself a favor and set one up, its incredibly useful.

  3. #3
    Lana Torrin's Avatar
    Join Date
    April 13, 2011
    Location
    Bonding around
    Posts
    9,063
    Just posting to say I have to look up LDAP queries every fucking time I have to use them.. I can never remember how to do them.. Google however, is awesome at shit like this.
    Quote Originally Posted by lubica
    And her name was Limul Azgoden, a lowly peasant girl.
    < Jolin> you're prety too LanaTorrin
    Clearly mafia.

  4. #4

    Join Date
    April 10, 2011
    Posts
    7,003
    FWIW this forum has a shit bug/feature with long unbroken strings. The space in "...groups,o u=stores..." probably isn't really there in the query.

  5. #5

    Join Date
    April 9, 2011
    Location
    Denmark
    Posts
    3,647
    Quote Originally Posted by Lana Torrin View Post
    Just posting to say I have to look up LDAP queries every fucking time I have to use them.. I can never remember how to do them.. Google however, is awesome at shit like this.
    LDAP is pretty shit in the first place to be honest.

    what's amazing is that nobody has done anything that's even marginally better, there's gotta be a better way to represent information than a digitalized telephone book.

  6. #6

    Join Date
    September 13, 2011
    Location
    Norway
    Posts
    573
    What are you using? Any scripting or programming language or ADUC?

  7. #7

    Join Date
    May 31, 2011
    Posts
    611
    Quote Originally Posted by Daneel Trevize View Post
    FWIW this forum has a shit bug/feature with long unbroken strings. The space in "...groups,o u=stores..." probably isn't really there in the query.
    ... which can be circumvented using [ code ] tags:
    Code:
    Pellentesquepulvinarloremacfelisimperdietindapibusduiinterdum.Curabiturlaoreetnislinnullaornaresollicitudin.Duisfringillacommodometus,quislaciniaodioconsequatquis!Nunceuismod,lectusetviverratincidunt,tellusfelisbibendumelit,eulobortisnislarcuegetdui.Duistellusdui,bibendum

  8. #8

    Join Date
    April 10, 2011
    Posts
    7,003
    Quote Originally Posted by Liare View Post
    LDAP is pretty shit in the first place to be honest.

    what's amazing is that nobody has done anything that's even marginally better, there's gotta be a better way to represent information than a digitalized telephone book.
    Yeah, real shame databases (e.g. SQL-based ones) don't exist.

  9. #9

    Join Date
    April 9, 2011
    Location
    Denmark
    Posts
    3,647
    Quote Originally Posted by Daneel Trevize View Post
    Quote Originally Posted by Liare View Post
    LDAP is pretty shit in the first place to be honest.

    what's amazing is that nobody has done anything that's even marginally better, there's gotta be a better way to represent information than a digitalized telephone book.
    Yeah, real shame databases (e.g. SQL-based ones) don't exist.
    ironically a structured database is not really the answer to everything either.

    LDAP assumes everything can be broken down into containers and stuffed together like that, a structured database (say a SQL one) assumes everything can be broken down into tables and interconnected like that.

    neither really provides the best solution for the problem, the reason LDAP is so hilariously popular is because it's so fucking vague that you can build a inventory management system on it.

  10. #10

    Join Date
    May 31, 2011
    Posts
    611
    Quote Originally Posted by Daneel Trevize View Post
    Yeah, real shame databases (e.g. SQL-based ones) don't exist.
    But you can use ADO to "speak in" SQL to LDAP, see for example http://www.rlmueller.net/SQLSyntax.htm

  11. #11
    JForce's Avatar
    Join Date
    April 12, 2011
    Location
    All up in your momma's ass
    Posts
    633
    Thanks for the responses. Yes, there's no spaces in the actual query.

    There's no language as such, it's a direct LDAP query that this external system uses, so it's not a scripted thing (unfortunately).

    I think we're going to end up with a query that returns ALL groups a user is a member of, but unfortunately our AD structure has users segmented by departments, and I don't think I can just query the top level and have it locate the user in the sub-ou structure - meaning I have to run a different query for each possible OU the user's account is in.
    "He will come in one of the pre-chosen forms. During the rectification of the Vuldrini, the traveler came as a large and moving Tor. Then, during the third reconciliation of the last of the McKetrick supplicants, they chose a new form for him: that of a giant Slor! Many Shuvs and Zuuls knew what it was to be roasted in the depths of the Slor that day, I can tell you!"

  12. #12

    Join Date
    September 13, 2011
    Location
    Norway
    Posts
    573
    Direct LDAP query is a complete brainfuck and a messed up term that brings up a shitload of other irrelevant shit when searching for it. :\

  13. #13

    Join Date
    April 9, 2011
    Location
    Denmark
    Posts
    3,647
    LDAP is like PBX's, it makes perfect sense if you have worked with it the last 40 years, otherwise you are fucked.

    honestly, the only way to get it working is to experiment with it, unless you know the brainfuck nature of the syntax by heart.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •