Mercurial > hg > xemacs-beta
comparison src/eldap.c @ 286:57709be46d1b r21-0b41
Import from CVS: tag r21-0b41
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:35:03 +0200 |
parents | c42ec1d1cded |
children | 6cb5e14cd98e |
comparison
equal
deleted
inserted
replaced
285:9a3756523c1b | 286:57709be46d1b |
---|---|
30 | 30 |
31 | 31 |
32 #include <config.h> | 32 #include <config.h> |
33 #include "lisp.h" | 33 #include "lisp.h" |
34 #include "opaque.h" | 34 #include "opaque.h" |
35 #include "sysdep.h" | |
35 | 36 |
36 #include <errno.h> | 37 #include <errno.h> |
37 #include <lber.h> | |
38 #include <ldap.h> | |
39 | 38 |
40 #include "eldap.h" | 39 #include "eldap.h" |
41 | 40 |
42 #ifdef HAVE_NS_LDAP | 41 #ifdef HAVE_NS_LDAP |
43 # define HAVE_LDAP_SET_OPTION 1 | 42 # define HAVE_LDAP_SET_OPTION 1 |
80 #endif | 79 #endif |
81 } | 80 } |
82 | 81 |
83 | 82 |
84 /************************************************************************/ | 83 /************************************************************************/ |
85 /* The ldap Lisp object */ | 84 /* ldap lrecord basic functions */ |
86 /************************************************************************/ | 85 /************************************************************************/ |
87 | |
88 /* | |
89 * Structure records pertinent information about an open LDAP connection. | |
90 */ | |
91 | |
92 struct Lisp_LDAP | |
93 { | |
94 /* lcrecord header */ | |
95 struct lcrecord_header header; | |
96 /* The LDAP connection handle used by the LDAP API */ | |
97 LDAP *ld; | |
98 /* Name of the host we connected to */ | |
99 Lisp_Object host; | |
100 /* Status of the LDAP connection. */ | |
101 int livep; | |
102 }; | |
103 | |
104 | 86 |
105 static Lisp_Object | 87 static Lisp_Object |
106 make_ldap (struct Lisp_LDAP *ldap) | 88 make_ldap (struct Lisp_LDAP *ldap) |
107 { | 89 { |
108 Lisp_Object lisp_ldap; | 90 Lisp_Object lisp_ldap; |
129 | 111 |
130 write_c_string ("#<ldap ", printcharfun); | 112 write_c_string ("#<ldap ", printcharfun); |
131 print_internal (ldap->host, printcharfun, 1); | 113 print_internal (ldap->host, printcharfun, 1); |
132 if (!ldap->livep) | 114 if (!ldap->livep) |
133 write_c_string ("(dead) ",printcharfun); | 115 write_c_string ("(dead) ",printcharfun); |
134 sprintf (buf, " 0x%x>", ldap); | 116 sprintf (buf, " 0x%x>", (unsigned int)ldap); |
135 write_c_string (buf, printcharfun); | 117 write_c_string (buf, printcharfun); |
136 } | 118 } |
137 | 119 |
138 static struct Lisp_LDAP * | 120 static struct Lisp_LDAP * |
139 allocate_ldap (void) | 121 allocate_ldap (void) |
385 (struct ldap_unwind_struct *) get_opaque_ptr (unwind_obj); | 367 (struct ldap_unwind_struct *) get_opaque_ptr (unwind_obj); |
386 if (unwind->res) | 368 if (unwind->res) |
387 ldap_msgfree (unwind->res); | 369 ldap_msgfree (unwind->res); |
388 if (unwind->vals) | 370 if (unwind->vals) |
389 ldap_value_free (unwind->vals); | 371 ldap_value_free (unwind->vals); |
372 return Qnil; | |
390 } | 373 } |
391 | 374 |
392 DEFUN ("ldap-search-internal", Fldap_search_internal, 2, 6, 0, /* | 375 DEFUN ("ldap-search-internal", Fldap_search_internal, 2, 6, 0, /* |
393 Perform a search on an open LDAP connection. | 376 Perform a search on an open LDAP connection. |
394 LDAP is an LDAP connection object created with `ldap-open'. | 377 LDAP is an LDAP connection object created with `ldap-open'. |
411 /* Vars for query */ | 394 /* Vars for query */ |
412 LDAP *ld; | 395 LDAP *ld; |
413 LDAPMessage *e; | 396 LDAPMessage *e; |
414 BerElement *ptr; | 397 BerElement *ptr; |
415 char *a; | 398 char *a; |
416 int i, rc, err; | 399 int i, rc; |
417 int matches; | 400 int matches; |
418 struct ldap_unwind_struct unwind; | 401 struct ldap_unwind_struct unwind; |
419 | 402 |
420 int ldap_scope = LDAP_SCOPE_SUBTREE; | 403 int ldap_scope = LDAP_SCOPE_SUBTREE; |
421 char **ldap_attributes = NULL; | 404 char **ldap_attributes = NULL; |