Sponsored Content
Full Discussion: ldap search filter
Top Forums UNIX for Dummies Questions & Answers ldap search filter Post 40705 by tine on Monday 22nd of September 2003 05:41:01 AM
Old 09-22-2003
ldap search filter

Hi,
I am trying to do an ldapsearch with a filter that checks the uid and the userpassword:
$filter= "(&(uid=$user) (userpassword=$password)";
$objs = $ldap->search( base => $basedn, filter => "($filter)");

i based it on this example i found on CPAN:
$mesg = $ldap->search(
base => $base_dn,
scope => 'sub',
filter => '(|(objectclass=rfc822mailgroup)(sn=jones))'
);

My filter does not work and i cannot understand why.. if anyone has any ideas, please reply!

Tine
 

10 More Discussions You Might Find Interesting

1. Programming

problem with ldap search using c

hi all i m writin a c program to search ldap db for values. i used the following code after search result return a value >0 if (result==1) { entry=ldap_first_entry(ld,msg); for(....;....;...) { // code to store the data values } } i m gettin an error at... (1 Reply)
Discussion started by: mridula
1 Replies

2. UNIX for Dummies Questions & Answers

LDAP search query help

I would like to do an ldap search which looks for entries which do not actually have a certain attribute. Not that the attribute is Null, but where the attribute does not exist. Is this possible using ldapsearch? (3 Replies)
Discussion started by: dopple
3 Replies

3. UNIX for Advanced & Expert Users

ldap search to find dn for user

How can I do a ldapsearch to find a DN for a user when I know the exact cn for that user out of active directory. I have tried several different commands (hundreds) but need the -b with the full dn to perform the search using ldapsearch from AIX. I am trying to find the OU for a user and the... (1 Reply)
Discussion started by: cchart3
1 Replies

4. UNIX for Dummies Questions & Answers

Search and filter between two files

Hello, I have two files in this form that consist of three columns, a name (L*contig*), the length (length=**) and the sequence LT_file.txt LTcontig1 length=13 acccatgctttta LTcontig5 length=8 ggattacc LTcontig8 length=20 ccattgaccgtacctgatcg LTcontig23 length=5 accta and... (5 Replies)
Discussion started by: FelipeAd
5 Replies

5. Shell Programming and Scripting

Search and filter by TAG

Hello all, searching on a text file (log file) is quite simple: grep -i texttosearch filename | grep somethingWhat I'm trying to do is filter the result by TAG and remove the double entries. Like if the log file contains the following text (fields are separated by commas): ... (18 Replies)
Discussion started by: Lord Spectre
18 Replies

6. UNIX for Dummies Questions & Answers

ldap search problem

I am posting in this section because in this regard I am a Dummy. I know very little about ldap. We have a couple of ldap registries running on an AIX box. I can connect into those registries using an openldap browser. But I am trying to run some queries against the registry on the server itself,... (1 Reply)
Discussion started by: fwellers
1 Replies

7. UNIX for Dummies Questions & Answers

ldap , search groups that user belong

i want run query to identify witch groups that user A belong, CN=name,CN=Users,DC=mydomain ?? (1 Reply)
Discussion started by: prpkrk
1 Replies

8. Shell Programming and Scripting

Ldap search query

Hi All, I have a existing Ldap query which take a HOME as variable and gives the result where i grep for a particular line. ldapsearch -h server_domain_name -p 389 -D "uid=user,ou=appadm,o=ent" -w PaB -b "ou=roles,o=ent" "cidx=$HOME" | grep -w "ent: xyz" Now i have 330K Homes in a... (1 Reply)
Discussion started by: posner
1 Replies

9. Solaris

LDAP search without "gecos" attribute

Hi all, I have 2 users. One of them shows "gecos" attribute during ldapsearch but the other one is not showing the attribute. bash-3.00# ldapsearch -h 10.26.73.2 -D "cn=directory manager" -w xxxx -b "uid=user01,ou=people,dc=xx,dc=xx,dc=xx,dc=com,dc=xx" objectclass=* version: 1 dn:... (1 Reply)
Discussion started by: Yohanna Flores
1 Replies

10. Solaris

LDAP Client not connecting to LDAP server

I have very limited knowledge on LDAP configuration and have been trying fix one issue, but unsuccessful. The server, I am working on, is Solaris-10 zone. sudoers is configured on LDAP (its not on local server). I have access to login directly on server with root, but somehow sudo is not working... (9 Replies)
Discussion started by: solaris_1977
9 Replies
LDAP_SEARCH(3)						     Library Functions Manual						    LDAP_SEARCH(3)

NAME
ldap_search, ldap_search_s, ldap_search_st - Perform an LDAP search operation SYNOPSIS
#include <sys/time.h> /* for struct timeval definition */ #include <ldap.h> int ldap_search(ld, base, scope, filter, attrs, attrsonly) LDAP *ld; char *base; int scope; char *filter, *attrs[]; int attrsonly; int ldap_search_s(ld, base, scope, filter, attrs, attrsonly, res) LDAP *ld; char *base; int scope; char *filter, *attrs[] int attrsonly; LDAPMessage **res; int ldap_search_st(ld, base, scope, filter, attrs, attrsonly, timeout, res) LDAP *ld; char *base; int scope; char *filter, *attrs[] int attrsonly; struct timeval *timeout; LDAPMessage **res; DESCRIPTION
These routines are used to perform LDAP search operations. ldap_search_s() does the search synchronously (i.e., not returning until the operation completes). ldap_search_st() does the same, but allows a timeout to be specified. ldap_search() is the asynchronous version, initiating the search and returning the message id of the operation it initiated. Base is the DN of the entry at which to start the search. Scope is the scope of the search and should be one of LDAP_SCOPE_BASE, to search the object itself, LDAP_SCOPE_ONELEVEL, to search the object's immediate children, or LDAP_SCOPE_SUBTREE, to search the object and all its descendents. Filter is a string representation of the filter to apply in the search. Simple filters can be specified as attributetype=attributevalue. More complex filters are specified using a prefix notation according to the following BNF: <filter> ::= '(' <filtercomp> ')' <filtercomp> ::= <and> | <or> | <not> | <simple> <and> ::= '&' <filterlist> <or> ::= '|' <filterlist> <not> ::= '!' <filter> <filterlist> ::= <filter> | <filter> <filterlist> <simple> ::= <attributetype> <filtertype> <attributevalue> <filtertype> ::= '=' | '~=' | '<=' | '>=' The '~=' construct is used to specify approximate matching. The representation for <attributetype> and <attributevalue> are as described in RFC 2254. In addition, <attributevalue> can be a single * to achieve an attribute existence test, or can contain text and *'s inter- spersed to achieve substring matching. For example, the filter "mail=*" will find any entries that have a mail attribute. The filter "mail=*@terminator.rs.itd.umich.edu" will find any entries that have a mail attribute ending in the specified string. To put parentheses in a filter, escape them with a backslash '' character. See RFC 2254 for a more complete description of allowable filters. See ldap_getfilter(3) for routines to help in con- structing search filters automatically. Attrs is a null-terminated array of attribute types to return from entries that match filter. If NULL is specified, all attributes will be returned. The type "*" (LDAP_ALL_USER_ATTRIBUTES) may be used to request all user attributes to be returned. The type "+"(LDAP_ALL_OPERA- TIONAL_ATTRIBUTES) may be used to request all operational attributes to be returned. To request no attributes, the type "1.1" (LDAP_NO_ATTRS) should be listed by itself. Attrsonly should be set to 1 if only attribute types are wanted. It should be set to 0 if both attributes types and attribute values are wanted. ERRORS
ldap_search_s() and ldap_search_st() will return the LDAP error code resulting from the search operation. See ldap_error(3) for details. ldap_search() returns -1 in case of trouble. NOTES
Note that both read and list functionality are subsumed by these routines, by using a filter like "objectclass=*" and a scope of LDAP_SCOPE_BASE (to emulate read) or LDAP_SCOPE_ONELEVEL (to emulate list). These routines may dynamically allocate memory. The caller is responsible for freeing such memory using supplied deallocation routines. Return values are contained in <ldap.h>. SEE ALSO
ldap(3), ldap_result(3), ldap_getfilter(3), ldap_error(3) ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan LDAP 3.3 Release. OpenLDAP 2.0.27-Release 25 July 1999 LDAP_SEARCH(3)
All times are GMT -4. The time now is 03:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy