annotate modules/ldap/eldap.h @ 4407:4ee73bbe4f8e

Always use boyer_moore in ASCII or Latin-1 buffers with ASCII search strings. 2007-12-26 Aidan Kehoe <kehoea@parhasard.net> * casetab.c: Extend and correct some case table documentation. * search.c (search_buffer): Correct a bug where only the first entry for a character in the case equivalence table was examined in determining if the Boyer-Moore search algorithm is appropriate. If there are case mappings outside of the charset and row of the characters specified in the search string, those case mappings can be safely ignored (and Boyer-Moore search can be used) if we know from the buffer statistics that the corresponding characters cannot occur. * search.c (boyer_moore): Assert that we haven't been passed a string with varying characters sets or rows within character sets. That's what simple_search is for. In the very rare event that a character in the search string has a canonical case mapping that is not in the same character set and row, don't try to search for the canonical character, search for some other character that is in the the desired character set and row. Assert that the case table isn't corrupt. Do not search for any character case mappings that cannot possibly occur in the buffer, given the buffer metadata about its contents.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 26 Dec 2007 17:30:16 +0100
parents c56a675b3b05
children e0db3c197671
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
1 /* Definitions for the LDAP client interface for XEmacs.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
2 Copyright (C) 1998 Free Software Foundation, Inc.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
3
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
4 This file is part of XEmacs.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
5
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
9 later version.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
10
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
14 for more details.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
15
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
20
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
21 #ifndef INCLUDED_eldap_h_
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
22 #define INCLUDED_eldap_h_
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
23
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
24 #include <lber.h>
4027
c56a675b3b05 [xemacs-hg @ 2007-06-22 16:58:36 by stephent]
stephent
parents: 3024
diff changeset
25 /* #### NEEDS REWRITE!
c56a675b3b05 [xemacs-hg @ 2007-06-22 16:58:36 by stephent]
stephent
parents: 3024
diff changeset
26 Thanks to Mats Lidell <matsl@xemacs.org> for the report & patch:
c56a675b3b05 [xemacs-hg @ 2007-06-22 16:58:36 by stephent]
stephent
parents: 3024
diff changeset
27 <871wgnqunm.fsf@spencer.lidell.homelinux.net>
c56a675b3b05 [xemacs-hg @ 2007-06-22 16:58:36 by stephent]
stephent
parents: 3024
diff changeset
28 "See http://www.openldap.org/faq/data/cache/1278.html.
c56a675b3b05 [xemacs-hg @ 2007-06-22 16:58:36 by stephent]
stephent
parents: 3024
diff changeset
29 Temporary workaround would be use the deprecated interface. Long term
c56a675b3b05 [xemacs-hg @ 2007-06-22 16:58:36 by stephent]
stephent
parents: 3024
diff changeset
30 solution is a rewrite." */
c56a675b3b05 [xemacs-hg @ 2007-06-22 16:58:36 by stephent]
stephent
parents: 3024
diff changeset
31 #define LDAP_DEPRECATED 1
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
32 #include <ldap.h>
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
33
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
34 /*
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
35 * The following structure records pertinent information about a
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
36 * LDAP connection.
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
37 */
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
38
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
39 struct Lisp_LDAP
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
40 {
3024
b7f26b2f78bd [xemacs-hg @ 2005-10-25 08:32:40 by ben]
ben
parents: 2720
diff changeset
41 struct LCRECORD_HEADER header;
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
42 /* The LDAP connection handle used by the LDAP API */
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
43 LDAP *ld;
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
44 /* Name of the host we connected to */
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
45 Lisp_Object host;
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
46 };
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
47 typedef struct Lisp_LDAP Lisp_LDAP;
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
48
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
49
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
50 DECLARE_LRECORD (ldap, Lisp_LDAP);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
51 #define XLDAP(x) XRECORD (x, ldap, Lisp_LDAP)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
52 #define wrap_ldap(p) wrap_record (p, ldap)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
53 #define LDAPP(x) RECORDP (x, ldap)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
54 #define CHECK_LDAP(x) CHECK_RECORD (x, ldap)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
55 #define CONCHECK_LDAP(x) CONCHECK_RECORD (x, ldap)
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
56
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
57 #define CHECK_LIVE_LDAP(ldap) do { \
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
58 CHECK_LDAP (ldap); \
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
59 if (!XLDAP (ldap)->ld) \
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
60 invalid_operation ("Attempting to access closed LDAP connection", \
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
61 ldap); \
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
62 } while (0)
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
63
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
64
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
65 Lisp_Object Fldapp (Lisp_Object object);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
66 Lisp_Object Fldap_host (Lisp_Object ldap);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
67 Lisp_Object Fldap_live_p (Lisp_Object ldap);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
68 Lisp_Object Fldap_open (Lisp_Object host,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
69 Lisp_Object ldap_plist);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
70 Lisp_Object Fldap_close (Lisp_Object ldap);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
71 Lisp_Object Fldap_search_basic (Lisp_Object ldap,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
72 Lisp_Object filter,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
73 Lisp_Object base,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
74 Lisp_Object scope,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
75 Lisp_Object attrs,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
76 Lisp_Object attrsonly,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
77 Lisp_Object withdn,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
78 Lisp_Object verbose);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
79 Lisp_Object Fldap_add (Lisp_Object ldap,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
80 Lisp_Object dn,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
81 Lisp_Object entry);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
82 Lisp_Object Fldap_modify (Lisp_Object ldap,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
83 Lisp_Object dn,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
84 Lisp_Object entry);
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
85 Lisp_Object Fldap_delete (Lisp_Object ldap,
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
86 Lisp_Object dn);
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
87
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 265
diff changeset
88 #endif /* INCLUDED_eldap_h_ */