From: Kurt Zeilenga Date: Tue, 15 Jan 2002 07:29:15 +0000 (+0000) Subject: Misc. cleanup, remove lint, remove unused deprecated functions, etc. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~126 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=13af7fb0730906aa6a1323c14c07c9a8434170dc;p=openldap Misc. cleanup, remove lint, remove unused deprecated functions, etc. --- diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index 955e4453b9..5d534a8533 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -263,8 +263,8 @@ bdb_idl_fetch_key( data.flags = DB_DBT_USERMEM; /* fetch it */ rc = db->get( db, tid, key, &data, bdb->bi_db_opflags ); - #endif + if( rc == DB_NOTFOUND ) { return rc; diff --git a/servers/slapd/back-bdb/index.c b/servers/slapd/back-bdb/index.c index a69e66f85e..adf07c7566 100644 --- a/servers/slapd/back-bdb/index.c +++ b/servers/slapd/back-bdb/index.c @@ -71,7 +71,6 @@ int bdb_index_is_indexed( Backend *be, AttributeDescription *desc ) { - int rc; slap_mask_t mask; char *dbname; struct berval prefix; @@ -82,7 +81,7 @@ int bdb_index_is_indexed( return LDAP_INAPPROPRIATE_MATCHING; } - return LDAP_SUCCESS; + return LDAP_SUCCESS; } int bdb_index_param( diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index c6abc86dea..48b2ebac55 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -391,6 +391,7 @@ bdb_initialize( { static char *controls[] = { LDAP_CONTROL_MANAGEDSAIT, + LDAP_CONTROL_SUBENTRIES, NULL }; diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index 9359fe084c..03b8692a9c 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -165,7 +165,8 @@ idl_fetch( Datum data; ID_BLOCK *idl; ID_BLOCK **tmp; - int i, nids; + int nids; + unsigned i; idl = idl_fetch_one( be, db, key ); diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index fc8e85059e..9257ebaabc 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -68,7 +68,6 @@ int index_is_indexed( Backend *be, AttributeDescription *desc ) { - int rc; slap_mask_t mask; char *dbname; struct berval prefix; @@ -79,7 +78,7 @@ int index_is_indexed( return LDAP_INAPPROPRIATE_MATCHING; } - return LDAP_SUCCESS; + return LDAP_SUCCESS; } int index_param( diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 7442953c7d..eb3efa04aa 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -77,7 +77,7 @@ read_config( const char *fname ) int rc; struct berval vals[2]; - static int lastmod = ON; + static int lastmod = 1; static BackendInfo *bi = NULL; static BackendDB *be = NULL; @@ -1996,13 +1996,13 @@ read_config( const char *fname ) if ( be ) { be->be_flags &= ~SLAP_BFLAG_NOLASTMOD; } else { - lastmod = ON; + lastmod = 1; } } else { if ( be ) { be->be_flags |= SLAP_BFLAG_NOLASTMOD; } else { - lastmod = OFF; + lastmod = 0; } } diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index de3ae7dbac..a392485128 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -735,7 +735,7 @@ dnExtractRdn( } /* - * FIXME: should be replaced by dnExtractRdn() (together with dn_rdn) + * FIXME: should be replaced by dnExtractRdn() */ int dn_rdnlen( @@ -768,60 +768,6 @@ dn_rdnlen( return p - dn_in->bv_val; } -/* - * FIXME: should be replaced by dnExtractRdn() (together with dn_rdnlen) - */ -char * dn_rdn( - Backend *be, - struct berval *dn_in ) -{ - struct berval rdn; - - assert( dn_in ); - - if ( dn_in == NULL ) { - return NULL; - } - - if ( !dn_in->bv_len ) { - return NULL; - } - - if ( be != NULL && be_issuffix( be, dn_in->bv_val ) ) { - return NULL; - } - - if ( dnExtractRdn( dn_in, &rdn ) != LDAP_SUCCESS ) { - return NULL; - } - - return rdn.bv_val; -} - -/* - * dn_issuffix - tells whether suffix is a suffix of dn. - * Both dn and suffix must be normalized. - * deprecated in favor of dnIsSuffix() - */ -int -dn_issuffix( - const char *dn, - const char *suffix -) -{ - struct berval bvdn, bvsuffix; - - assert( dn ); - assert( suffix ); - - bvdn.bv_val = (char *) dn; - bvdn.bv_len = strlen( dn ); - bvsuffix.bv_val = (char *) suffix; - bvsuffix.bv_len = strlen( suffix ); - - return dnIsSuffix( &bvdn, &bvsuffix ); -} - /* rdn_attr_type: * * Given a string (i.e. an rdn) of the form: diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index a754f3b339..fb8c2aae43 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -401,9 +401,7 @@ LDAP_SLAPD_F (int) rdnValidate LDAP_P(( struct berval * rdn )); LDAP_SLAPD_F (char *) dn_validate LDAP_P(( char *dn )); LDAP_SLAPD_F (char *) dn_normalize LDAP_P(( char *dn )); LDAP_SLAPD_F (char *) dn_parent LDAP_P(( Backend *be, const char *dn )); -LDAP_SLAPD_F (char *) dn_rdn LDAP_P(( Backend *be, struct berval *dn )); LDAP_SLAPD_F (int) dn_rdnlen LDAP_P(( Backend *be, struct berval *dn )); -LDAP_SLAPD_F (int) dn_issuffix LDAP_P(( const char *dn, const char *suffix )); LDAP_SLAPD_F (char *) rdn_attr_value LDAP_P(( const char * rdn )); LDAP_SLAPD_F (char *) rdn_attr_type LDAP_P(( const char * rdn )); LDAP_SLAPD_F (int) rdn_attrs LDAP_P(( const char * rdn, @@ -1067,7 +1065,6 @@ LDAP_SLAPD_F (int) do_extended LDAP_P((Connection *conn, Operation *op)); LDAP_SLAPD_V (ber_socket_t) dtblsize; - LDAP_END_DECL #endif /* _proto_slap */ diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 43c2871bf3..b9c1b5b9e1 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -190,6 +190,7 @@ static AttributeTypeSchemaCheckFN rootDseAttribute; static AttributeTypeSchemaCheckFN aliasAttribute; static AttributeTypeSchemaCheckFN referralAttribute; static AttributeTypeSchemaCheckFN subentryAttribute; +static AttributeTypeSchemaCheckFN administrativeRoleAttribute; static AttributeTypeSchemaCheckFN dynamicAttribute; static struct slap_schema_ad_map { @@ -357,7 +358,7 @@ static struct slap_schema_ad_map { "EQUALITY objectIdentifierMatch " "USAGE directoryOperation " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )", - NULL, 0, NULL, NULL, NULL, + administrativeRoleAttribute, 0, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_administrativeRole) }, { "subtreeSpecification", "( 2.5.18.6 NAME 'subtreeSpecification' " "SINGLE-VALUE " @@ -944,6 +945,28 @@ static int subentryAttribute ( return LDAP_SUCCESS; } +static int administrativeRoleAttribute ( + Backend *be, + Entry *e, + Attribute *attr, + const char** text, + char *textbuf, size_t textlen ) +{ + *text = textbuf; + + if( !SLAP_SUBENTRIES(be) ) { + snprintf( textbuf, textlen, + "attribute \"%s\" not supported in context", + attr->a_desc->ad_cname.bv_val ); + return LDAP_OBJECT_CLASS_VIOLATION; + } + + snprintf( textbuf, textlen, + "attribute \"%s\" not supported!", + attr->a_desc->ad_cname.bv_val ); + return LDAP_OBJECT_CLASS_VIOLATION; +} + static int dynamicAttribute ( Backend *be, Entry *e, diff --git a/servers/slapd/sets.h b/servers/slapd/sets.h index 72be10f3ca..2478790080 100644 --- a/servers/slapd/sets.h +++ b/servers/slapd/sets.h @@ -4,6 +4,13 @@ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ +#ifndef SLAP_SETS_H_ +#define SLAP_SETS_H_ + +#include + +LDAP_BEGIN_DECL + /* this routine needs to return the bervals instead of * plain strings, since syntax is not known. It should * also return the syntax or some "comparison cookie" @@ -20,3 +27,6 @@ slap_set_filter (SLAP_SET_GATHER gatherer, void *cookie, struct berval *filter, char *user, char *this, BerVarray *results); +LDAP_END_DECL + +#endif \ No newline at end of file diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index cda6b28613..293aa269c6 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -69,10 +69,6 @@ LDAP_BEGIN_DECL */ #define SLAP_MOD_SOFTADD 0x1000 -#define ON (1) -#define OFF (-1) -#define UNDEFINED (0) - #define MAXREMATCHES (10) #define SLAP_MAX_WORKER_THREADS (32) @@ -343,7 +339,7 @@ typedef int slap_mr_filter_func LDAP_P(( typedef struct slap_matching_rule { LDAPMatchingRule smr_mrule; - ber_len_t smr_oidlen; + ber_len_t smr_oidlen; slap_mask_t smr_usage; #define SLAP_MR_HIDE 0x8000U @@ -433,11 +429,11 @@ typedef struct slap_attribute_type { struct slap_attribute_type *sat_next; -#define sat_oid sat_atype.at_oid -#define sat_names sat_atype.at_names -#define sat_desc sat_atype.at_desc +#define sat_oid sat_atype.at_oid +#define sat_names sat_atype.at_names +#define sat_desc sat_atype.at_desc #define sat_obsolete sat_atype.at_obsolete -#define sat_sup_oid sat_atype.at_sup_oid +#define sat_sup_oid sat_atype.at_sup_oid #define sat_equality_oid sat_atype.at_equality_oid #define sat_ordering_oid sat_atype.at_ordering_oid #define sat_substr_oid sat_atype.at_substr_oid @@ -445,7 +441,7 @@ typedef struct slap_attribute_type { #define sat_single_value sat_atype.at_single_value #define sat_collective sat_atype.at_collective #define sat_no_user_mod sat_atype.at_no_user_mod -#define sat_usage sat_atype.at_usage +#define sat_usage sat_atype.at_usage #define sat_extensions sat_atype.at_extensions struct slap_attr_desc *sat_ad; @@ -1357,9 +1353,6 @@ struct slap_backend_info { #define o_tls_ssf o_authz.sai_tls_ssf #define o_sasl_ssf o_authz.sai_sasl_ssf -struct slap_op; -struct slap_conn; - typedef void (slap_response)( struct slap_conn *, struct slap_op *, ber_tag_t, ber_int_t, ber_int_t, const char *, const char *, BerVarray, const char *, struct berval *, diff --git a/servers/slapd/slapd.dsp b/servers/slapd/slapd.dsp index ef53909efc..8f004daab4 100644 --- a/servers/slapd/slapd.dsp +++ b/servers/slapd/slapd.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 advapi32.lib sasl.lib libdb32.lib hs_regex.lib libsasl.lib rpcrt4.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 advapi32.lib rpcrt4.lib sasl.lib libdb40.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "slapd - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 advapi32.lib libdb32.lib hs_regex.lib libsasl.lib rpcrt4.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 advapi32.lib rpcrt4.lib libdb40d.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "slapd - Win32 Single Debug" diff --git a/servers/slapd/tools/slapadd.dsp b/servers/slapd/tools/slapadd.dsp index 7cd2e25981..5ea8cd547b 100644 --- a/servers/slapd/tools/slapadd.dsp +++ b/servers/slapd/tools/slapadd.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 sasl.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" +# ADD LINK32 sasl.lib libdb40.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" !ELSEIF "$(CFG)" == "slapadd - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" +# ADD LINK32 libdb40d.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" !ELSEIF "$(CFG)" == "slapadd - Win32 Single Debug" diff --git a/servers/slapd/tools/slapcat.dsp b/servers/slapd/tools/slapcat.dsp index 1c3ca8f54f..ace03cb2da 100644 --- a/servers/slapd/tools/slapcat.dsp +++ b/servers/slapd/tools/slapcat.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 sasl.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" +# ADD LINK32 sasl.lib libdb40.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" !ELSEIF "$(CFG)" == "slapcat - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" +# ADD LINK32 libdb40d.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" !ELSEIF "$(CFG)" == "slapcat - Win32 Single Debug" diff --git a/servers/slapd/tools/slapindex.dsp b/servers/slapd/tools/slapindex.dsp index 71fe5edf2c..fd61b1a31b 100644 --- a/servers/slapd/tools/slapindex.dsp +++ b/servers/slapd/tools/slapindex.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 sasl.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" +# ADD LINK32 sasl.lib libdb40.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" !ELSEIF "$(CFG)" == "slapindex - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" +# ADD LINK32 libdb40d.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" !ELSEIF "$(CFG)" == "slapindex - Win32 Single Debug"