X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fslap.h;h=9a883c0b682c8f567f6ee41fab016784ca4c974d;hb=bc74d3f82f4db4868502eeb2ca1d27587d203d4f;hp=bf0c9c82970748945a2f863a25cc76ec30779b10;hpb=42e0d83cb3a1a1c5b25183f1ab74ce7edbe25de7;p=openldap diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index bf0c9c8297..9a883c0b68 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -3,20 +3,47 @@ #ifndef _SLDAPD_H_ #define _SLDAPD_H_ -#define LDAP_SYSLOG +#include + +#ifndef LDAP_SYSLOG +#define LDAP_SYSLOG 1 +#endif + +#include +#include +#include + +#undef NDEBUG +#include -#include #include "avl.h" #include "lber.h" #include "ldap.h" #include "lthread.h" +#include "lthread_rdwr.h" #include "ldif.h" +#ifdef f_next +#undef f_next /* name conflict between sys/file.h on SCO and struct filter */ +#endif #define DN_DNS 0 #define DN_X500 1 #define ON 1 #define OFF (-1) +#define UNDEFINED 0 + +#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) @@ -98,11 +125,15 @@ 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 */ /* really be private to back-ldbm */ char e_state; /* for the cache */ + + pthread_rdwr_t e_rdwr; /* reader/writer lock */ + #define ENTRY_STATE_DELETED 1 #define ENTRY_STATE_CREATING 2 int e_refcnt; /* # threads ref'ing this entry */ @@ -121,6 +152,13 @@ struct access { char *a_domainpat; char *a_dnattr; long a_access; + +#ifdef SLAPD_ACLGROUPS + char *a_group; + char *a_objectclassvalue; + char *a_groupattrname; +#endif + #define ACL_NONE 0x01 #define ACL_COMPARE 0x02 #define ACL_SEARCH 0x04 @@ -134,6 +172,7 @@ struct access { struct acl { /* "to" part: the entries this acl applies to */ Filter *acl_filter; + regex_t acl_dnre; char *acl_dnpat; char **acl_attrs; @@ -158,58 +197,90 @@ 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_rootdn; /* the magic "root" dn for this db */ - char *be_rootpw; /* the magic "root" password for this db */ + char **be_suffixAlias; /* the DN suffix aliases of data in this backend */ + 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 */ int be_timelimit; /* time limit for this backend */ struct acl *be_acl; /* access control list for this 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; + /* 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 + int (*be_group) LDAP_P((Backend *be, Entry *e, + char *bdn, char *edn, + char *objectclassValue, char *groupattrName )); +#endif +}; /* * 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_ndn; /* normalized dn bound when op was initiated */ int o_authtype; /* auth method used to bind dn */ /* values taken from ldap.h */ /* LDAP_AUTH_* */ int o_opid; /* id of this operation */ int o_connid; /* id of conn initiating this op */ -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS int o_cldap; /* != 0 if this came in via CLDAP */ 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 */ @@ -221,12 +292,13 @@ 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 COMPAT +#ifdef LDAP_COMPAT int c_version; /* for compatibility w/2.0, 3.0 */ #endif char *c_addr; /* address of client on this conn */ @@ -258,8 +330,8 @@ typedef struct conn { #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) #endif -#ifdef NEEDPROTOS #include "proto-slap.h" -#endif + +LDAP_END_DECL #endif /* _slap_h_ */