]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slap.h
Import nextid cleanup from devel.
[openldap] / servers / slapd / slap.h
index 49aaf52db53d0e5166871aa322afee25dd11d1cb..9a883c0b682c8f567f6ee41fab016784ca4c974d 100644 (file)
@@ -5,6 +5,10 @@
 
 #include <stdlib.h>
 
+#ifndef LDAP_SYSLOG
+#define LDAP_SYSLOG 1
+#endif
+
 #include <sys/types.h>
 #include <ac/syslog.h>
 #include <ac/regex.h>
 
 #define MAXREMATCHES 10
 
+#define DNSEPARATOR(c) ((c) == ',' || (c) == ';')
+#define SEPARATOR(c)   ((c) == ',' || (c) == ';' || (c) == '+')
+#define SPACE(c)       ((c) == ' ' || (c) == '\n')
+#define NEEDSESCAPE(c) ((c) == '\\' || (c) == '"')
+
 LDAP_BEGIN_DECL
 
+struct slap_op;
+struct slap_conn;
+
 /*
  * represents an attribute value assertion (i.e., attr=value)
  */
@@ -113,6 +125,7 @@ typedef unsigned long       ID;
  */
 typedef struct entry {
        char            *e_dn;          /* DN of this entry               */
+       char            *e_ndn;         /* normalized DN of this entry    */
        Attribute       *e_attrs;       /* list of attributes + values    */
 
        ID              e_id;           /* id of this entry - this should */
@@ -184,11 +197,13 @@ struct objclass {
  * represents a "database"
  */
 
-typedef struct backend {
+typedef struct backend Backend;
+struct backend {
        char    **be_suffix;    /* the DN suffixes of data in this backend */
         char    **be_suffixAlias;       /* the DN suffix aliases of data in this backend */
-       char    *be_rootdn;     /* the magic "root" dn for this db         */
-       char    *be_rootpw;     /* the magic "root" password for this db   */
+       char    *be_root_dn;    /* the magic "root" dn for this db      */
+       char    *be_root_ndn;   /* the magic "root" normalized dn for this db   */
+       char    *be_root_pw;    /* the magic "root" password for this db        */
        int     be_readonly;    /* 1 => db is in "read only" mode          */
         int     be_maxDerefDepth;       /* limit for depth of an alias deref  */
        int     be_sizelimit;   /* size limit for this backend             */
@@ -197,42 +212,64 @@ typedef struct backend {
        int     be_dfltaccess;  /* access given if no acl matches          */
        char    **be_replica;   /* replicas of this backend (in master)    */
        char    *be_replogfile; /* replication log file (in master)        */
-       char    *be_updatedn;   /* allowed to make changes (in replicas)   */
+       char    *be_update_ndn; /* allowed to make changes (in replicas)   */
        int     be_lastmod;     /* keep track of lastmodified{by,time}     */
        char    *be_type;       /* type of database                        */
 
        void    *be_private;    /* anything the backend needs              */
 
-       IFP     be_bind;        /* backend bind routine                    */
-       IFP     be_unbind;      /* backend unbind routine                  */
-       IFP     be_search;      /* backend search routine                  */
-       IFP     be_compare;     /* backend compare routine                 */
-       IFP     be_modify;      /* backend modify routine                  */
-       IFP     be_modrdn;      /* backend modrdn routine                  */
-       IFP     be_add;         /* backend add routine                     */
-       IFP     be_delete;      /* backend delete routine                  */
-       IFP     be_abandon;     /* backend abandon routine                 */
-       IFP     be_config;      /* backend config routine                  */
-       IFP     be_init;        /* backend init routine                    */
-       IFP     be_close;       /* backend close routine                   */
+       /* backend routines */
+       int     (*be_bind)   LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o,
+               char *dn, int method, struct berval *cred, char** edn ));
+       void    (*be_unbind) LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o ));
+       int     (*be_search) LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o,
+               char *base, int scope, int deref, int slimit, int tlimit,
+               Filter *f, char *filterstr, char **attrs, int attrsonly));
+       int     (*be_compare)LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o,
+               char *dn, Ava *ava));
+       int     (*be_modify) LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o,
+               char *dn, LDAPMod *m));
+       int     (*be_modrdn) LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o,
+               char *dn, char *newrdn, int deleteoldrdn ));
+       int     (*be_add)    LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o,
+               Entry *e));
+       int     (*be_delete) LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o,
+               char *dn));
+       /* Bug: be_abandon in unused! */
+       void    (*be_abandon)LDAP_P((Backend *be,
+               struct slap_conn *c, struct slap_op *o,
+               int msgid));
+       void    (*be_config) LDAP_P((Backend *be,
+               char *fname, int lineno, int argc, char **argv ));
+       void    (*be_init)   LDAP_P((Backend *be));
+       void    (*be_close)  LDAP_P((Backend *be));
 
 #ifdef SLAPD_ACLGROUPS
-       IFP     be_group;       /* backend group member test               */
+       int     (*be_group)  LDAP_P((Backend *be, Entry *e,
+               char *bdn, char *edn,
+               char *objectclassValue, char *groupattrName ));
 #endif
-} Backend;
+};
 
 /*
  * represents an operation pending from an ldap client
  */
 
-typedef struct op {
+typedef struct slap_op {
        BerElement      *o_ber;         /* ber of the request             */
        long            o_msgid;        /* msgid of the request           */
        unsigned long   o_tag;          /* tag of the request             */
        time_t          o_time;         /* time op was initiated          */
        char            *o_dn;          /* dn bound when op was initiated */
-        char            *o_suffix;      /* suffix if aliased              */
-        char            *o_suffixAliased;       /* pending suffix translation     */
+       char            *o_ndn;         /* normalized dn bound when op was initiated */
        int             o_authtype;     /* auth method used to bind dn    */
                                        /* values taken from ldap.h       */
                                        /* LDAP_AUTH_*                    */
@@ -243,7 +280,7 @@ typedef struct op {
        struct sockaddr o_clientaddr;   /* client address if via CLDAP    */
        char            o_searchbase;   /* search base if via CLDAP       */
 #endif
-       struct op       *o_next;        /* next operation pending         */
+       struct slap_op  *o_next;        /* next operation pending         */
        pthread_t       o_tid;          /* thread handling this op        */
        int             o_abandon;      /* signals op has been abandoned  */
        pthread_mutex_t o_abandonmutex; /* signals op has been abandoned  */
@@ -255,9 +292,10 @@ typedef struct op {
  * represents a connection from an ldap client
  */
 
-typedef struct conn {
+typedef struct slap_conn {
        Sockbuf         c_sb;           /* ber connection stuff           */
-       char            *c_dn;          /* current DN bound to this conn  */
+       char            *c_cdn;         /* DN provided by the client */
+       char            *c_dn;          /* DN bound to this conn  */
        pthread_mutex_t c_dnmutex;      /* mutex for c_dn field           */
        int             c_authtype;     /* auth method used to bind c_dn  */
 #ifdef LDAP_COMPAT