From: Pierangelo Masarati Date: Sun, 6 Nov 2005 23:27:09 +0000 (+0000) Subject: silence warnings X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~82 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a6453f28f89e49786dff3c137bac10df14b9ca98;p=openldap silence warnings --- diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h index 2d810b04e0..0ed0563b0d 100644 --- a/include/ldap_pvt.h +++ b/include/ldap_pvt.h @@ -279,6 +279,7 @@ LDAP_END_DECL #endif /* HAVE_OPENSSL_BN_H || HAVE_BN_H */ typedef BIGNUM* ldap_pvt_mp_t; +#define LDAP_PVT_MP_INIT (NULL) #define ldap_pvt_mp_init(mp) \ (mp) = BN_new() @@ -305,6 +306,8 @@ typedef BIGNUM* ldap_pvt_mp_t; #endif typedef mpz_t ldap_pvt_mp_t; +#define LDAP_PVT_MP_INIT { 0 } + #define ldap_pvt_mp_init(mp) \ mpz_init((mp)) @@ -327,8 +330,10 @@ typedef mpz_t ldap_pvt_mp_t; #ifdef HAVE_LONG_LONG typedef unsigned long long ldap_pvt_mp_t; +#define LDAP_PVT_MP_INIT (0LL) #else /* !HAVE_LONG_LONG */ typedef unsigned long ldap_pvt_mp_t; +#define LDAP_PVT_MP_INIT (0L) #endif /* !HAVE_LONG_LONG */ #define ldap_pvt_mp_init(mp) \ diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c index 8cff2aa207..8eb01290cd 100644 --- a/libraries/libldap/tls.c +++ b/libraries/libldap/tls.c @@ -1783,7 +1783,7 @@ tls_tmp_dh_cb( SSL *ssl, int is_export, int key_length ) dhparams = p; } } -done: + #ifdef LDAP_R_COMPILE ldap_pvt_thread_mutex_unlock( &tls_def_ctx_mutex ); #endif diff --git a/libraries/liblutil/tavl.c b/libraries/liblutil/tavl.c index f588c71d88..41e8d63018 100644 --- a/libraries/liblutil/tavl.c +++ b/libraries/liblutil/tavl.c @@ -186,7 +186,7 @@ void* tavl_delete( Avlnode **root, void* data, AVL_CMP fcmp ) { Avlnode *p, *q, *r, *top; - int side, side_bf, shorter, nside; + int side, side_bf, shorter, nside = -1; /* parent stack */ Avlnode *pptr[sizeof(void *)*8]; diff --git a/servers/slapd/back-monitor/operation.c b/servers/slapd/back-monitor/operation.c index f7aa7c6483..68a006362c 100644 --- a/servers/slapd/back-monitor/operation.c +++ b/servers/slapd/back-monitor/operation.c @@ -189,8 +189,8 @@ monitor_subsys_ops_update( { monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private; - ldap_pvt_mp_t nInitiated, - nCompleted; + ldap_pvt_mp_t nInitiated = LDAP_PVT_MP_INIT, + nCompleted = LDAP_PVT_MP_INIT; struct berval rdn; int i; Attribute *a; diff --git a/servers/slapd/back-passwd/search.c b/servers/slapd/back-passwd/search.c index 76386d756b..f34f80d523 100644 --- a/servers/slapd/back-passwd/search.c +++ b/servers/slapd/back-passwd/search.c @@ -59,7 +59,7 @@ passwd_back_search( SlapReply *rs ) { struct passwd *pw; - time_t stoptime; + time_t stoptime = (time_t)-1; LDAPRDN rdn = NULL; struct berval parent = BER_BVNULL; diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 777a7272c5..99d88b0816 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -157,7 +157,7 @@ glue_op_func ( Operation *op, SlapReply *rs ) BackendDB *b0 = op->o_bd; BackendInfo *bi0 = op->o_bd->bd_info; BI_op_modify **func; - slap_operation_t which; + slap_operation_t which = op_bind; int rc; op->o_bd = glue_back_select (b0, &op->o_req_ndn); @@ -168,6 +168,7 @@ glue_op_func ( Operation *op, SlapReply *rs ) case LDAP_REQ_DELETE: which = op_delete; break; case LDAP_REQ_MODIFY: which = op_modify; break; case LDAP_REQ_MODRDN: which = op_modrdn; break; + default: assert( 0 ); break; } func = &op->o_bd->bd_info->bi_op_bind; diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 3544112261..bd7ccc8d4f 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -2377,7 +2377,7 @@ replica_unparse( struct slap_replica_info *ri, int i, struct berval *bv ) static int config_replica(ConfigArgs *c) { int i, nr = -1; - char *replicahost, *replicauri; + char *replicahost = NULL, *replicauri = NULL; LDAPURLDesc *ludp; if (c->op == SLAP_CONFIG_EMIT) { @@ -2407,6 +2407,12 @@ config_replica(ConfigArgs *c) { if(!strncasecmp(c->argv[i], "host=", STRLENOF("host="))) { ber_len_t len; + if ( replicauri ) { + snprintf( c->msg, sizeof( c->msg ), "<%s> replica host/URI already specified", c->argv[0] ); + Debug(LDAP_DEBUG_ANY, "%s: %s \"%s\"\n", c->log, c->msg, replicauri ); + return(1); + } + replicahost = c->argv[i] + STRLENOF("host="); len = strlen( replicahost ) + STRLENOF("ldap://"); replicauri = ch_malloc( len + 1 ); @@ -2415,6 +2421,12 @@ config_replica(ConfigArgs *c) { nr = add_replica_info(c->be, replicauri, replicahost); break; } else if(!strncasecmp(c->argv[i], "uri=", STRLENOF("uri="))) { + if ( replicauri ) { + snprintf( c->msg, sizeof( c->msg ), "<%s> replica host/URI already specified", c->argv[0] ); + Debug(LDAP_DEBUG_ANY, "%s: %s \"%s\"\n", c->log, c->msg, replicauri ); + return(1); + } + if(ldap_url_parse(c->argv[i] + STRLENOF("uri="), &ludp) != LDAP_SUCCESS) { snprintf( c->msg, sizeof( c->msg ), "<%s> invalid uri", c->argv[0] ); Debug(LDAP_DEBUG_ANY, "%s: %s\n", c->log, c->msg, 0 ); @@ -2442,7 +2454,8 @@ config_replica(ConfigArgs *c) { return(1); } else if(nr == -1) { snprintf( c->msg, sizeof( c->msg ), "<%s> unable to add replica", c->argv[0] ); - Debug(LDAP_DEBUG_ANY, "%s: %s \"%s\"\n", c->log, c->msg, replicauri ); + Debug(LDAP_DEBUG_ANY, "%s: %s \"%s\"\n", c->log, c->msg, + replicauri ? replicauri : "" ); return(1); } else { for(i = 1; i < c->argc; i++) { @@ -2622,6 +2635,7 @@ config_tls_option(ConfigArgs *c) { default: Debug(LDAP_DEBUG_ANY, "%s: " "unknown tls_option <0x%x>\n", c->log, c->type, 0); + return 1; } if (c->op == SLAP_CONFIG_EMIT) { return ldap_pvt_tls_get_option( NULL, flag, &c->value_string ); @@ -2656,6 +2670,7 @@ config_tls_config(ConfigArgs *c) { Debug(LDAP_DEBUG_ANY, "%s: " "unknown tls_option <0x%x>\n", c->log, c->type, 0); + return 1; } if (c->op == SLAP_CONFIG_EMIT) { ldap_pvt_tls_get_option( NULL, flag, &c->value_int ); @@ -3120,7 +3135,7 @@ check_name_index( CfEntryInfo *parent, ConfigType ce_type, Entry *e, CfEntryInfo *ce; int index = -1, gotindex = 0, nsibs; int renumber = 0, tailindex = 0; - char *ptr1, *ptr2; + char *ptr1, *ptr2 = NULL; struct berval rdn; if ( renum ) *renum = 0; @@ -3626,7 +3641,7 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs, switch (ml->sml_op) { case LDAP_MOD_DELETE: case LDAP_MOD_REPLACE: { - BerVarray vals = NULL, nvals; + BerVarray vals = NULL, nvals = NULL; int *idx = NULL; if ( ct && ( ct->arg_type & ARG_NO_DELETE )) { rc = LDAP_OTHER; @@ -3737,9 +3752,9 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs, switch (ml->sml_op) { case LDAP_MOD_DELETE: case LDAP_MOD_REPLACE: { - BerVarray vals = NULL, nvals; + BerVarray vals = NULL, nvals = NULL; Attribute *a; - delrec *d; + delrec *d = NULL; a = attr_find( e->e_attrs, ml->sml_desc ); diff --git a/servers/slapd/filterentry.c b/servers/slapd/filterentry.c index 34b8bc784f..b0e5a595d7 100644 --- a/servers/slapd/filterentry.c +++ b/servers/slapd/filterentry.c @@ -158,7 +158,7 @@ static int test_mra_filter( void *memctx; BER_MEMFREE_FN *memfree; #ifdef LDAP_COMP_MATCH - int i, num_attr_vals; + int i, num_attr_vals = 0; #endif if ( op == NULL ) { diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c index c2d7fe65ac..93d93c4c58 100644 --- a/servers/slapd/overlays/ppolicy.c +++ b/servers/slapd/overlays/ppolicy.c @@ -1155,10 +1155,11 @@ ppolicy_modify( Operation *op, SlapReply *rs ) { slap_overinst *on = (slap_overinst *)op->o_bd->bd_info; pp_info *pi = on->on_bi.bi_private; - int i, rc, mod_pw_only, pwmod, pwmop, deladd, + int i, rc, mod_pw_only, pwmod, pwmop = -1, deladd, hsize = 0; PassPolicy pp; - Modifications *mods = NULL, *modtail, *ml, *delmod, *addmod; + Modifications *mods = NULL, *modtail = NULL, + *ml, *delmod, *addmod; Attribute *pa, *ha, at; const char *txt; pw_hist *tl = NULL, *p; @@ -1290,12 +1291,13 @@ ppolicy_modify( Operation *op, SlapReply *rs ) ppolicy_get( op, e, &pp ); - for(ml = op->oq_modify.rs_modlist, + for ( ml = op->oq_modify.rs_modlist, pwmod = 0, mod_pw_only = 1, deladd = 0, delmod = NULL, addmod = NULL, zapReset = 1; - ml != NULL; modtail = ml, ml = ml->sml_next ) { + ml != NULL; modtail = ml, ml = ml->sml_next ) + { if ( ml->sml_desc == pp.ad ) { pwmod = 1; pwmop = ml->sml_op; diff --git a/servers/slapd/overlays/valsort.c b/servers/slapd/overlays/valsort.c index c273eb361c..0c206abbae 100644 --- a/servers/slapd/overlays/valsort.c +++ b/servers/slapd/overlays/valsort.c @@ -212,7 +212,7 @@ static void do_sort( Operation *op, Attribute *a, int beg, int num, slap_mask_t sort ) { int i, j, gotnvals; - struct berval tmp, ntmp, *vals, *nvals; + struct berval tmp, ntmp, *vals = NULL, *nvals; gotnvals = (a->a_vals != a->a_nvals ); diff --git a/servers/slapd/slaptest.c b/servers/slapd/slaptest.c index 2453892230..85f08edc07 100644 --- a/servers/slapd/slaptest.c +++ b/servers/slapd/slaptest.c @@ -79,6 +79,8 @@ test_file( const char *fname, const char *ftype ) save_errno, strerror( save_errno ) ); return -1; } + + return 0; } int diff --git a/tests/data/slapd-sql.conf b/tests/data/slapd-sql.conf index 8b7ae7dc40..a93b00ede9 100644 --- a/tests/data/slapd-sql.conf +++ b/tests/data/slapd-sql.conf @@ -32,8 +32,8 @@ argsfile @TESTDIR@/slapd.1.args # cn=monitor, cn=schema, and cn=config # -access to attr=userpassword - by self =wx +access to attrs=userpassword + by self =w by anonymous =x access to *