From: Julio Sánchez Fernández Date: Thu, 8 Jul 1999 19:05:41 +0000 (+0000) Subject: Changes in headers needed for new schema support. These changes break X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=eb5231d3f05bb2ae100d1986f1f57cf70a5468d9;p=openldap Changes in headers needed for new schema support. These changes break lots of files in this directory. --- diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 23cd1297bd..defd589ce1 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -55,7 +55,7 @@ int at_delete_from_list LDAP_P(( int pos, AttributeType ***listp )); int at_fake_if_needed LDAP_P(( char *name )); int at_schema_info LDAP_P(( Entry *e )); int at_add LDAP_P(( LDAP_ATTRIBUTE_TYPE *at, const char **err )); -char * at_canonical_name LDAP_P(( char * a_type )); +char * at_canonical_name LDAP_P(( AttributeType * at )); /* * ava.c @@ -69,7 +69,6 @@ void ava_free LDAP_P(( Ava *ava, int freeit )); */ int backend_init LDAP_P((void)); -int backend_add LDAP_P((BackendInfo *aBackendInfo)); int backend_startup LDAP_P((int dbnum)); int backend_shutdown LDAP_P((int dbnum)); int backend_destroy LDAP_P((void)); @@ -90,9 +89,6 @@ int be_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw )); extern int backend_unbind LDAP_P((Connection *conn, Operation *op)); -extern int backend_connection_init LDAP_P((Connection *conn)); -extern int backend_connection_destroy LDAP_P((Connection *conn)); - extern int backend_group LDAP_P((Backend *be, Entry *target, char *gr_ndn, char *op_ndn, @@ -120,14 +116,6 @@ int charray_inlist LDAP_P(( char **a, char *s )); char ** charray_dup LDAP_P(( char **a )); char ** str2charray LDAP_P(( char *str, char *brkstr )); -/* - * controls.c - */ -int get_ctrls LDAP_P(( - Connection *co, - Operation *op, - int senderrors )); - /* * config.c */ @@ -148,7 +136,6 @@ long connection_init LDAP_P(( void connection_closing LDAP_P(( Connection *c )); int connection_state_closing LDAP_P(( Connection *c )); -char *connection_state2str LDAP_P(( int state )); int connection_write LDAP_P((ber_socket_t s)); int connection_read LDAP_P((ber_socket_t s)); @@ -208,20 +195,9 @@ int test_filter LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e, FILE * lock_fopen LDAP_P(( char *fname, char *type, FILE **lfp )); int lock_fclose LDAP_P(( FILE *fp, FILE *lfp )); -/* - * module.c - */ - -#ifdef SLAPD_MODULES -int load_module LDAP_P(( const char* file_name, int argc, char *argv[] )); -#endif /* SLAPD_MODULES */ - /* * monitor.c */ -extern char *supportedExtensions[]; -extern char *supportedControls[]; -extern char *supportedSASLMechanisms[]; void monitor_info LDAP_P(( Connection *conn, Operation *op )); @@ -257,32 +233,22 @@ void replog LDAP_P(( Backend *be, int optype, char *dn, void *change, int flag ) * result.c */ -void send_ldap_result LDAP_P(( - Connection *conn, Operation *op, - int err, char *matched, char *text )); - -void send_ldap_disconnect LDAP_P(( - Connection *conn, Operation *op, - int err, char *text )); - -void send_ldap_search_result LDAP_P(( - Connection *conn, Operation *op, - int err, char *matched, char *text, int nentries )); +void send_ldap_result LDAP_P(( Connection *conn, Operation *op, int err, char *matched, + char *text )); +void send_ldap_search_result LDAP_P(( Connection *conn, Operation *op, int err, + char *matched, char *text, int nentries )); /* * schema.c */ int oc_schema_check LDAP_P(( Entry *e )); -int oc_check_operational_attr LDAP_P(( char *type )); -int oc_check_usermod_attr LDAP_P(( char *type )); -int oc_check_no_usermod_attr LDAP_P(( char *type )); ObjectClass *oc_find LDAP_P((const char *ocname)); int oc_add LDAP_P((LDAP_OBJECT_CLASS *oc, const char **err)); Syntax *syn_find LDAP_P((const char *synname)); int syn_add LDAP_P((LDAP_SYNTAX *syn, slap_syntax_check_func *check, const char **err)); MatchingRule *mr_find LDAP_P((const char *mrname)); -int mr_add LDAP_P((LDAP_MATCHING_RULE *mr, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare, const char **err)); +int mr_add LDAP_P((LDAP_MATCHING_RULE *mr, slap_mr_normalize_func *normalize, slap_mr_check_func *check, slap_mr_skeys_func *skeys, slap_mr_index_func *ind, const char **err)); void schema_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly)); int schema_init LDAP_P((void)); @@ -308,10 +274,10 @@ Filter * str2filter LDAP_P(( char *str )); int value_add_fast LDAP_P(( struct berval ***vals, struct berval **addvals, int nvals, int naddvals, int *maxvals )); int value_add LDAP_P(( struct berval ***vals, struct berval **addvals )); -void value_normalize LDAP_P(( char *s, int syntax )); +void value_normalize LDAP_P(( struct berval *val, struct berval **nval, MatchingRule * mr )); int value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax, int normalize )); -int value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax, +int value_find LDAP_P(( struct berval **vals, struct berval *v, MatchingRule *mr, int normalize )); /* @@ -341,7 +307,6 @@ extern int global_default_access; extern int global_lastmod; extern int global_idletimeout; extern int global_schemacheck; -extern char *global_realm; extern int lber_debug; extern int ldap_syslog; @@ -400,22 +365,17 @@ extern void slap_do_nothing LDAP_P((int sig)); extern void config_info LDAP_P((Connection *conn, Operation *op)); extern void root_dse_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly)); - -extern int do_abandon LDAP_P((Connection *conn, Operation *op)); -extern int do_add LDAP_P((Connection *conn, Operation *op)); -extern int do_bind LDAP_P((Connection *conn, Operation *op)); -extern int do_compare LDAP_P((Connection *conn, Operation *op)); -extern int do_delete LDAP_P((Connection *conn, Operation *op)); -extern int do_modify LDAP_P((Connection *conn, Operation *op)); -extern int do_modrdn LDAP_P((Connection *conn, Operation *op)); -extern int do_search LDAP_P((Connection *conn, Operation *op)); -extern int do_unbind LDAP_P((Connection *conn, Operation *op)); -extern int do_extended LDAP_P((Connection *conn, Operation *op)); - -extern int send_search_entry LDAP_P(( - Backend *be, Connection *conn, Operation *op, - Entry *e, char **attrs, int attrsonly, int opattrs )); - +extern void do_abandon LDAP_P((Connection *conn, Operation *op)); +extern void do_add LDAP_P((Connection *conn, Operation *op)); +extern void do_bind LDAP_P((Connection *conn, Operation *op)); +extern void do_compare LDAP_P((Connection *conn, Operation *op)); +extern void do_delete LDAP_P((Connection *conn, Operation *op)); +extern void do_modify LDAP_P((Connection *conn, Operation *op)); +extern void do_modrdn LDAP_P((Connection *conn, Operation *op)); +extern void do_search LDAP_P((Connection *conn, Operation *op)); +extern void do_unbind LDAP_P((Connection *conn, Operation *op)); + +extern int send_search_entry LDAP_P((Backend *be, Connection *conn, Operation *op, Entry *e, char **attrs, int attrsonly)); extern int str2result LDAP_P(( char *s, int *code, char **matched, char **info )); extern ber_socket_t dtblsize; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 946f56aae8..57eb1f6da5 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -85,9 +85,9 @@ typedef struct ava { } Ava; typedef struct mra { - char *mra_rule; - char *mra_type; - char *mra_value; + char *mra_rule; + char *mra_type; + struct berval mra_value; int mra_dnattrs; } Mra; @@ -105,7 +105,7 @@ typedef struct filter { Ava f_un_ava; /* extensible */ - Mra f_un_fra; + Mra f_un_mra; /* and, or, not */ struct filter *f_un_complex; @@ -113,9 +113,7 @@ typedef struct filter { /* substrings */ struct sub { char *f_un_sub_type; - char *f_un_sub_initial; - char **f_un_sub_any; - char *f_un_sub_final; + struct berval f_un_sub_value; } f_un_sub; } f_un; #define f_type f_un.f_un_type @@ -123,6 +121,7 @@ typedef struct filter { #define f_avtype f_un.f_un_ava.ava_type #define f_avvalue f_un.f_un_ava.ava_value #define f_mra f_un.f_un_mra +#define f_mrrule f_un.f_un_mra.mra_rule #define f_mrtype f_un.f_un_mra.mra_type #define f_mrvalue f_un.f_un_mra.mra_value #define f_mrdnaddrs f_un.f_un_mra.mra_dnattrs @@ -132,10 +131,7 @@ typedef struct filter { #define f_list f_un.f_un_complex #define f_sub f_un.f_un_sub #define f_sub_type f_un.f_un_sub.f_un_sub_type -#define f_sub_initial f_un.f_un_sub.f_un_sub_initial -#define f_sub_any f_un.f_un_sub.f_un_sub_any -#define f_sub_final f_un.f_un_sub.f_un_sub_final - +#define f_sub_value f_un.f_un_sub.f_un_sub_value struct filter *f_next; } Filter; @@ -149,16 +145,6 @@ typedef struct attr { struct attr *a_next; } Attribute; -/* - * the attr_syntax() routine returns one of these values - * telling what kind of syntax an attribute supports. - */ -#define SYNTAX_CIS 0x01 /* case insensitive string */ -#define SYNTAX_CES 0x02 /* case sensitive string */ -#define SYNTAX_BIN 0x04 /* binary data */ -#define SYNTAX_TEL 0x08 /* telephone number string */ -#define SYNTAX_DN 0x10 /* dn string */ - /* * the id used in the indexes to refer to an entry */ @@ -190,43 +176,12 @@ typedef struct entry { /* the "by" part */ struct access { - -#define ACL_NONE 0x0001 -#define ACL_AUTH 0x0002 -#define ACL_COMPARE 0x0004 -#define ACL_SEARCH 0x0008 -#define ACL_READ 0x0010 -#define ACL_WRITE 0x0020 -#define ACL_PRIV_MASK 0x00ff - -#define ACL_SELF 0x4000 -#define ACL_INVALID (-1) - -#define ACL_IS(a,lvl) (((a) & (lvl)) == (lvl)) - -#define ACL_IS_NONE(a) ACL_IS((a),ACL_SELF) -#define ACL_IS_AUTH(a) ACL_IS((a),ACL_AUTH) -#define ACL_IS_COMPARE(a) ACL_IS((a),ACL_COMPARE) -#define ACL_IS_SEARCH(a) ACL_IS((a),ACL_SEARCH) -#define ACL_IS_READ(a) ACL_IS((a),ACL_READ) -#define ACL_IS_WRITE(a) ACL_IS((a),ACL_WRITE) -#define ACL_IS_SELF(a) ACL_IS((a),ACL_SELF) -#define ACL_IS_INVALID(a) ((a) == ACL_INVALID) - -#define ACL_CLR(a) ((a) = 0) -#define ACL_SET(a,lvl) ((a) |= (lvl)) -#define ACL_SET_NONE(a) ACL_SET((a),ACL_SELF) -#define ACL_SET_AUTH(a) ACL_SET((a),ACL_AUTH) -#define ACL_SET_COMPARE(a) ACL_SET((a),ACL_COMPARE) -#define ACL_SET_SEARCH(a) ACL_SET((a),ACL_SEARCH) -#define ACL_SET_READ(a) ACL_SET((a),ACL_READ) -#define ACL_SET_WRITE(a) ACL_SET((a),ACL_WRITE) -#define ACL_SET_SELF(a) ACL_SET((a),ACL_SELF) -#define ACL_SET_INVALID(a) ((a) = ACL_INVALID) - -#define ACL_PRIV(a) ((a) & ACL_PRIV_MASK) -#define ACL_GRANT(a,lvl) (ACL_PRIV(a) >= (lvl)) - +#define ACL_NONE 0x01 +#define ACL_COMPARE 0x02 +#define ACL_SEARCH 0x04 +#define ACL_READ 0x08 +#define ACL_WRITE 0x10 +#define ACL_SELF 0x40 int a_access; char *a_dnpat; @@ -234,11 +189,11 @@ struct access { char *a_domainpat; char *a_dnattr; - /* ACL Groups */ - char *a_group; - char *a_group_oc; - char *a_group_at; - +#ifdef SLAPD_ACLGROUPS + char *a_group; + char *a_objectclassvalue; + char *a_groupattrname; +#endif struct access *a_next; }; @@ -281,13 +236,34 @@ typedef struct slap_syntax { #define ssyn_oid ssyn_syn.syn_oid #define ssyn_desc ssyn_syn.syn_desc +/* Put a value in some normalized form */ typedef int slap_mr_normalize_func LDAP_P((struct berval * val, struct berval **normalized)); -typedef int slap_mr_compare_func LDAP_P((struct berval * val1, struct berval * val2)); + +/* Check if evals in entry match value in filter */ +typedef int slap_mr_check_func LDAP_P(( + struct berval * fval, /* Value in filter ava */ + struct berval ** evals /* Values in entry */ +)); + +/* Decompose value in an ava (necessary for substr or approx-like filters) */ +typedef int slap_mr_skeys_func LDAP_P(( + struct berval * fval, /* Value in filter */ + struct berval *** svals /* Returned search keys */ +)); + +/* Find keys to use in searching the indexes */ +typedef int slap_mr_index_func LDAP_P(( + struct berval ** svals, /* Values for search keys */ + struct berval *** ivals /* Returned values for indexes */ +)); typedef struct slap_matching_rule { LDAP_MATCHING_RULE smr_mrule; + char *smr_prefix; slap_mr_normalize_func *smr_normalize; - slap_mr_compare_func *smr_compare; + slap_mr_check_func *smr_compare; + slap_mr_skeys_func *smr_skeys; + slap_mr_index_func *smr_index; Syntax *smr_syntax; struct slap_matching_rule *smr_next; } MatchingRule; @@ -297,6 +273,10 @@ typedef struct slap_matching_rule { #define smr_obsolete smr_mrule.mr_obsolete #define smr_syntax_oid smr_mrule.mr_syntax_oid +extern MatchingRule *global_mr_password_eq; +extern MatchingRule *global_mr_presence; +extern MatchingRule *global_mr_approx; + typedef struct slap_attribute_type { LDAP_ATTRIBUTE_TYPE sat_atype; struct slap_attribute_type *sat_sup; @@ -305,8 +285,6 @@ typedef struct slap_attribute_type { MatchingRule *sat_ordering; MatchingRule *sat_substr; Syntax *sat_syntax; - /* The next one is created to help in the transition */ - int sat_syntax_compat; struct slap_attribute_type *sat_next; } AttributeType; #define sat_oid sat_atype.at_oid @@ -386,10 +364,6 @@ struct backend_db { #define be_release bd_info->bi_entry_release_rw #define be_group bd_info->bi_acl_group -#define be_connection_init bd_info->bi_connection_init -#define be_connection_destroy bd_info->bi_connection_destroy - - /* these should be renamed from be_ to bd_ */ char **be_suffix; /* the DN suffixes of data in this backend */ char **be_nsuffix; /* the normalized DN suffixes in this backend */ @@ -408,8 +382,6 @@ struct backend_db { char *be_update_ndn; /* allowed to make changes (in replicas) */ int be_lastmod; /* keep track of lastmodified{by,time} */ - char *be_realm; - void *be_private; /* anything the backend database needs */ }; @@ -474,8 +446,7 @@ struct backend_info { /* LDAP Operations Handling Routines */ int (*bi_op_bind) LDAP_P(( BackendDB *bd, struct slap_conn *c, struct slap_op *o, - char *dn, int method, char* mechanism, - struct berval *cred, char** edn )); + char *dn, int method, struct berval *cred, char** edn )); int (*bi_op_unbind) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o )); int (*bi_op_search) LDAP_P((BackendDB *bd, @@ -500,22 +471,18 @@ struct backend_info { int (*bi_op_delete) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, char *dn)); + /* Bug: be_op_abandon in unused! */ int (*bi_op_abandon) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, ber_int_t msgid)); /* Auxilary Functions */ int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, Entry *e, int rw)); - +#ifdef SLAPD_ACLGROUPS int (*bi_acl_group) LDAP_P((Backend *bd, Entry *e, char *bdn, char *edn, char *objectclassValue, char *groupattrName )); - - int (*bi_connection_init) LDAP_P((BackendDB *bd, - struct slap_conn *c)); - int (*bi_connection_destroy) LDAP_P((BackendDB *bd, - struct slap_conn *c)); - +#endif unsigned int bi_nDB; /* number of databases of this type */ void *bi_private; /* anything the backend type needs */ @@ -535,18 +502,11 @@ typedef struct slap_op { ber_tag_t o_tag; /* tag of the request */ time_t o_time; /* time op was initiated */ - - int o_bind_in_progress; /* multi-op bind in progress */ - char *o_dn; /* dn bound when op was initiated */ char *o_ndn; /* normalized dn bound when op was initiated */ - ber_int_t o_protocol; /* version of the LDAP protocol used by client */ ber_tag_t o_authtype; /* auth method used to bind dn */ /* values taken from ldap.h */ /* LDAP_AUTH_* */ - char *o_authmech; /* SASL mechanism used to bind dn */ - - LDAPControl **o_ctrls; /* controls */ /* long o_connid; *//* id of conn initiating this op */ @@ -582,14 +542,14 @@ typedef struct slap_conn { char *c_client_name; /* name of client */ /* only can be changed by binding thread */ - int c_bind_in_progress; /* multi-op bind in progress */ - char *c_cdn; /* DN provided by the client */ char *c_dn; /* DN bound to this conn */ ber_int_t c_protocol; /* version of the LDAP protocol used by client */ - ber_tag_t c_authtype;/* auth method used to bind c_dn */ - char *c_authmech; /* SASL mechanism used to bind c_dn */ - void *c_authstate; /* SASL state data */ + ber_tag_t c_authtype; /* auth method used to bind c_dn */ + +#ifdef LDAP_COMPAT + int c_version; /* for compatibility w/ U-Mich 2.0 & 3.0 */ +#endif Operation *c_ops; /* list of operations being processed */ Operation *c_pending_ops; /* list of pending operations */ @@ -604,10 +564,6 @@ typedef struct slap_conn { long c_n_ops_executing; /* num of ops currently executing */ long c_n_ops_pending; /* num of ops pending execution */ long c_n_ops_completed; /* num of ops completed */ - - long c_n_get; /* num of get calls */ - long c_n_read; /* num of read calls */ - long c_n_write; /* num of write calls */ } Connection; #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)