ldap-query

Querying Active Directory with "SQL"?

I just wonder if anyone knows or made a wrapper around Active Directory to be able to easily query it in .net? Kind of like "LINQ-to-ActiveDirectory" or some SQL Dialect, i.e. to be able to do "SELECT DISTINCT(DEPARTMENT) FROM /Users/SomeOU/AnotherOU" or "SELECT user FROM domain" or whatever. As far as I know, it is possible to query WM...

Active Directory LDAP Query by sAMAccountName and Domain

How do you do a query of an LDAP store by sAMAccountName and Domain? What is the "domain" property named in Active Directory or LDAP terms? This is what I have for the filter so far. I'd like to be able to add in the domain: (&(objectCategory=Person)(sAMAccountName=BTYNDALL)) ...

Java LDAP - Determine if user in a given group?

We logon users to Active Directory via LDAP using the Java LDAP API. We want to enhance our logon functionality to further check if the user is in a given AD group. Does anyone know how to do this? Current code: import javax.naming.*; import javax.naming.ldap.*; LdapContext ctx = null; Hashtable env = new Hashtable(); env.put(Contex...

How to escape a string in C#, for use in an LDAP query

I have an LDAP query, which I am using to perform a search in C#. It uses two string variables (username and domain) which need to be escaped for security reasons. How should I escape the strings? Is there a function available in C#.NET to do this? Example LDAP search conditions : (objectCategory=person) (userprincipalname=username@...

Generic LDAP base for search?

I'm writing some C++/Win32 code to search for a user in an LDAP directory (really I need to validate a username/password is correct, and then verify group membership). I have the username, so I'm hoping something like the following will work: (&(objectCategory=person)(objectClass=user)(uid={username})) When I call ldap_search with thi...

Find out when a user's certificate is going to expire

Does anyone know how I could go about finding out when a certificate for user is set to expire? I know I can get pull all of the certificates for a given user by usin the following code: Set objUserTemplate = _ GetObject("LDAP://cn=userTemplate,OU=Management,dc=NA,dc=fabrikam,dc=com") arrUserCertificates = objUserTemplate.GetEx("us...

How can I search for items with attributes matching a specified pattern via LDAP?

I'm trying to search an LDAP server for all items with exactly the attributes specified. The LDAP schema I'm dealing records user roles by: creating a object type that may contain any of several attributes (the roles), and setting the each role's value to be the same as its name The attributes do not share a common base type, and th...

can a user be part of multiple subtree in a (Ldap based) Directory Service instance ?

Hi, I am pretty new to the ldap based directory service programming using .net framework; hence have a basic silly question. I would like to find out the all sub trees a particular user belongs to using System.DirectoryServices.Protocol. First of all , Can a User be part of the multiple Sub Trees in “a” directory service instance? If ...

How do I retrieve a list of only those users and groups that have been added since a certain date from an LDAP directory?

My application does an LDAP query once a day and fetches all the users and groups in a given container. Once it is fetched, my app goes iterates through the list of users of groups, adding only the new ones to my application's database (it adds only username). If there are 50,000 users, my application server is busy for 45 minutes ever...

case insensitive LDAP searches

What't the syntax for performing a case-insensitive match on a 'uid' attribute? If attribute definition matters then how would that be changed? In particular I am using ApacheDS for my LDAP store. ...

How do I run range queries on LDAP

I am trying to retrieve data about groups on LDAP. As I need to paginate results, I need to run range queries. My setup uses JNDI to connect to LDAP. I am trying to run this query (&(objectclass=group)(range=1-500)) What am I doing wrong? I know there are range based queries for LDAP,how do I modify this query for get the same? ...

Coldfusion LDAP Authentication issue / domain prefix

I am currently setting up a dev environment which is an exact copy of our prod environment. The problem is when I try to authenticate a user by using CFLDAP tag in the dev environment, it won't let me authenticate the user without prefixing the username with the domain name while in the prod environment we don't have to prefix the userna...

Are Rollbacks possible with Active Directory?

I have read a few articles about how to programmatically interacting with Active Directory. One question remains though, is it possible to rollback a transaction of some sort with Active Directory? I have read that it is not possible in a context which you have several domain controllers as they seem to update each other with an update ...

Ldap query returns null result when deployed.

I'm using a very simple Ldap query in my asp.net mvc 2.0 site: String ldapPath = ConfigReader.LdapPath; String emailAddress = null; try { DirectorySearcher search = new DirectorySearcher(ConfigReader.LdapPath); search.Filter = String.Format("(&(objectClass=user)(objectCategory=perso...

How to use com.sun.security.auth.module.LdapLoginModule in J2EE, example.

I am using JDeveloper 10.1.3.4 as my IDE and OC4J 10.1.3 as AppServer. We have Novell eDirectory for LDAP. I would like to use this new API of Java 6. Can you help me provide example / usage of it for my web applicatin that requires login to the application. ...

Retrieve objects by container in LDAP

Does anyone know if it is possible in an LDAP query to filter objects according to the container they are in? For example, I would like to return all users in the OU called staff, maybe something like this: (& (objectCategory=user) (containerOU=Staff)) Obviously I just made up the containerOU bit, I'm just trying to illustrate what I...

LDAP query to return all groups in specified OU

I am trying to update my filter currently appled to the People Picker in SharePoint (WSS). I am using stsadm to set the filter. Something like... stsadm -o setproperty -url http://webserver:39770 -pn peoplepicker-searchadcustomfilter -pv "(&(userAccountControl=512)(objectCategory=person)(objectClass=user)(memberOf=cn=All Users Group,...

Delete User from AD Group

Hey, I am trying to delete a user from an Active Directory group via code. Getting the helpful error of: Exception has been thrown by the targe of an invocation" Trace: Stack Trace: at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) at Active_Directory.RemoveUserFromGroup(String sInUs...