comparison modules/ldap/eldap.c @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 3742ea8250b5 3a87551bfeb5
children d877c14318b3
comparison
equal deleted inserted replaced
5117:3742ea8250b5 5118:e0db3c197671
139 } 139 }
140 140
141 static Lisp_LDAP * 141 static Lisp_LDAP *
142 allocate_ldap (void) 142 allocate_ldap (void)
143 { 143 {
144 Lisp_LDAP *ldap = ALLOC_LCRECORD_TYPE (Lisp_LDAP, &lrecord_ldap); 144 Lisp_LDAP *ldap = XLDAP (ALLOC_LISP_OBJECT (ldap));
145 145
146 ldap->ld = NULL; 146 ldap->ld = NULL;
147 ldap->host = Qnil; 147 ldap->host = Qnil;
148 return ldap; 148 return ldap;
149 } 149 }
160 if (ldap->ld) 160 if (ldap->ld)
161 ldap_unbind (ldap->ld); 161 ldap_unbind (ldap->ld);
162 ldap->ld = NULL; 162 ldap->ld = NULL;
163 } 163 }
164 164
165 #f 0 165 DEFINE_NODUMP_LISP_OBJECT ("ldap", ldap, mark_ldap,
166 DEFINE_LRECORD_IMPLEMENTATION ("ldap", ldap, 0, 166 print_ldap, finalize_ldap,
167 mark_ldap, print_ldap, finalize_ldap, 167 NULL, NULL, ldap_description,
168 NULL, NULL, ldap_description, Lisp_LDAP); 168 Lisp_LDAP);
169 #else
170 DEFINE_NONDUMPABLE_LRECORD_IMPLEMENTATION ("ldap", ldap, mark_ldap,
171 print_ldap, finalize_ldap,
172 NULL, NULL, ldap_description,
173 Lisp_LDAP);
174 #endif
175 169
176 /************************************************************************/ 170 /************************************************************************/
177 /* Basic ldap accessors */ 171 /* Basic ldap accessors */
178 /************************************************************************/ 172 /************************************************************************/
179 173
429 423
430 /* Vars for query */ 424 /* Vars for query */
431 LDAP *ld; 425 LDAP *ld;
432 LDAPMessage *e; 426 LDAPMessage *e;
433 BerElement *ptr; 427 BerElement *ptr;
434 Extbyte *a, *dn; 428 Extbyte *a, *dn, *bs, *filt;
435 int i, rc; 429 int i, rc;
436 int matches; 430 int matches;
437 struct ldap_unwind_struct unwind; 431 struct ldap_unwind_struct unwind;
438 432
439 int ldap_scope = LDAP_SCOPE_SUBTREE; 433 int ldap_scope = LDAP_SCOPE_SUBTREE;
501 495
502 /* Attributes only ? */ 496 /* Attributes only ? */
503 CHECK_SYMBOL (attrsonly); 497 CHECK_SYMBOL (attrsonly);
504 498
505 /* Perform the search */ 499 /* Perform the search */
506 if (ldap_search (ld, 500 bs = NILP (base) ? "" : NEW_LISP_STRING_TO_EXTERNAL (base, Qnative);
507 NILP (base) ? "" : 501 filt = NILP (filter) ? "" : NEW_LISP_STRING_TO_EXTERNAL (filter, Qnative);
508 NEW_LISP_STRING_TO_EXTERNAL (base, Qnative), 502 if (ldap_search (ld, bs, ldap_scope, filt, ldap_attributes,
509 ldap_scope, 503 NILP (attrsonly) ? 0 : 1)
510 NILP (filter) ? "" :
511 NEW_LISP_STRING_TO_EXTERNAL (filter, Qnative),
512 ldap_attributes,
513 NILP (attrsonly) ? 0 : 1)
514 == -1) 504 == -1)
515 { 505 {
516 signal_ldap_error (ld, NULL, 0); 506 signal_ldap_error (ld, NULL, 0);
517 } 507 }
518 508
820 } 810 }
821 811
822 void 812 void
823 syms_of_eldap (void) 813 syms_of_eldap (void)
824 { 814 {
825 INIT_LRECORD_IMPLEMENTATION (ldap); 815 INIT_LISP_OBJECT (ldap);
826 816
827 DEFSYMBOL (Qeldap); 817 DEFSYMBOL (Qeldap);
828 DEFSYMBOL (Qldapp); 818 DEFSYMBOL (Qldapp);
829 DEFSYMBOL (Qport); 819 DEFSYMBOL (Qport);
830 DEFSYMBOL (Qauth); 820 DEFSYMBOL (Qauth);