Lines Matching defs:ld
70 ldap_build_search_req(LDAP *ld, char *base, int scope, char *filter,
104 ld->ld_errno = LDAP_PARAM_ERROR;
109 if ((ber = alloc_ber_with_options(ld)) == NULLBER) {
127 theTimeLimit = ld->ld_timelimit;
131 if (ld->ld_sb.sb_naddr > 0) {
132 err = ber_printf(ber, "{ist{seeiib", ++ld->ld_msgid,
133 ld->ld_cldapdn, LDAP_REQ_SEARCH, base, scope, ld->ld_deref,
134 sizelimit == -1 ? ld->ld_sizelimit : sizelimit, theTimeLimit,
138 err = ber_printf(ber, "{it{seeiib", ++ld->ld_msgid,
139 LDAP_REQ_SEARCH, base, scope, ld->ld_deref,
140 sizelimit == -1 ? ld->ld_sizelimit : sizelimit,
147 ld->ld_errno = LDAP_ENCODING_ERROR;
165 ld->ld_errno = LDAP_FILTER_ERROR;
171 ld->ld_errno = LDAP_ENCODING_ERROR;
180 ld->ld_errno = LDAP_ENCODING_ERROR;
184 } else if (ld->ld_srvctrls && ld->ld_srvctrls[0]) {
186 if (ldap_controls_code(ber, ld->ld_srvctrls) != LDAP_SUCCESS) {
187 ld->ld_errno = LDAP_ENCODING_ERROR;
194 ld->ld_errno = LDAP_ENCODING_ERROR;
205 * ld LDAP descriptor
216 * msgid = ldap_search( ld, "c=us@o=UM", LDAP_SCOPE_SUBTREE, "cn~=bob",
220 ldap_search(LDAP *ld, char *base, int scope, char *filter,
228 LOCK_LDAP(ld);
233 if ((ber = ldap_build_search_req(ld, base, scope, filter, attrs,
236 UNLOCK_LDAP(ld);
242 if (ld->ld_cache != NULL) {
243 if (check_cache(ld, LDAP_REQ_SEARCH, ber) == 0) {
245 ld->ld_errno = LDAP_SUCCESS;
246 rv = ld->ld_msgid;
248 UNLOCK_LDAP(ld);
252 add_request_to_cache(ld, LDAP_REQ_SEARCH, ber);
257 rv = send_initial_request(ld, LDAP_REQ_SEARCH, base, ber);
259 UNLOCK_LDAP(ld);
722 ldap_search_st(LDAP *ld, char *base, int scope, char *filter, char **attrs,
727 if ((msgid = ldap_search(ld, base, scope, filter, attrs, attrsonly))
729 return (ld->ld_errno);
731 if (ldap_result(ld, msgid, 1, timeout, res) == -1)
732 return (ld->ld_errno);
734 if (ld->ld_errno == LDAP_TIMEOUT) {
735 (void) ldap_abandon(ld, msgid);
736 ld->ld_errno = LDAP_TIMEOUT;
737 return (ld->ld_errno);
740 return (ldap_result2error(ld, *res, 0));
744 ldap_search_s(LDAP *ld, char *base, int scope, char *filter, char **attrs,
749 if ((msgid = ldap_search(ld, base, scope, filter, attrs, attrsonly))
751 return (ld->ld_errno);
753 if (ldap_result(ld, msgid, 1, (struct timeval *)NULL, res) == -1)
754 return (ld->ld_errno);
756 return (ldap_result2error(ld, *res, 0));
760 int ldap_search_ext(LDAP *ld, char *base, int scope, char *filter,
774 LOCK_LDAP(ld);
779 if ((ber = ldap_build_search_req(ld, base, scope, filter, attrs,
781 rv = ld->ld_errno;
785 UNLOCK_LDAP(ld);
791 if (ld->ld_cache != NULL) {
792 if (check_cache(ld, LDAP_REQ_SEARCH, ber) == 0) {
794 ld->ld_errno = LDAP_SUCCESS;
795 *msgidp = ld->ld_msgid;
797 UNLOCK_LDAP(ld);
801 add_request_to_cache(ld, LDAP_REQ_SEARCH, ber);
806 rv = send_initial_request(ld, LDAP_REQ_SEARCH, base, ber);
808 rv = ld->ld_errno;
813 UNLOCK_LDAP(ld);
820 UNLOCK_LDAP(ld);
826 int ldap_search_ext_s(LDAP *ld, char *base, int scope, char *filter,
834 if ((retcode = ldap_search_ext(ld, base, scope, filter, attrs,
838 if (ldap_result(ld, msgid, 1, timeoutp, res) == -1)
839 return (ld->ld_errno);
843 LOCK_LDAP(ld);
845 retcode = ldap_parse_result(ld, *res, &ld->ld_errno, &ld->ld_matched,
846 &ld->ld_error, &ld->ld_referrals, &ld->ld_ret_ctrls, 0);
848 retcode = ld->ld_errno;
850 UNLOCK_LDAP(ld);