>From 59a11fbc168b52036ebadb8c0df017cc5b09fe67 Mon Sep 17 00:00:00 2001 From: Rich Megginson <rmeggins@xxxxxxxxxx> Date: Fri, 5 Mar 2010 15:55:53 -0700 Subject: [PATCH] cleanup build warnings This patch cleans up various build warnings found by compiling the code with -Wall on RHEL5. --- ldap/servers/plugins/acl/acllas.c | 1 - ldap/servers/plugins/dna/dna.c | 2 +- ldap/servers/plugins/pwdstorage/smd5_pwd.c | 7 ++--- ldap/servers/plugins/referint/referint.c | 2 +- ldap/servers/plugins/replication/cl5_api.c | 2 + ldap/servers/plugins/retrocl/retrocl.c | 2 +- ldap/servers/plugins/retrocl/retrocl_po.c | 4 +- ldap/servers/slapd/attrsyntax.c | 15 +++++++----- ldap/servers/slapd/back-ldbm/back-ldbm.h | 1 + ldap/servers/slapd/back-ldbm/import-threads.c | 6 ++-- ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c | 29 ++++++++++++------------- ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 6 ++-- ldap/servers/slapd/entry.c | 2 +- ldap/servers/slapd/modrdn.c | 4 +- ldap/servers/slapd/plugin.c | 2 +- ldap/servers/slapd/tools/ldclt/ldclt.h | 1 + 16 files changed, 45 insertions(+), 41 deletions(-) diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c index 53620e4..9a57d7c 100644 --- a/ldap/servers/plugins/acl/acllas.c +++ b/ldap/servers/plugins/acl/acllas.c @@ -1711,7 +1711,6 @@ DS_LASSSFEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, char *ptr; int len; int rc; - char *s = NULL; lasInfo lasinfo; int aclssf; diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c index c82bf6b..0da8f07 100644 --- a/ldap/servers/plugins/dna/dna.c +++ b/ldap/servers/plugins/dna/dna.c @@ -859,7 +859,7 @@ dna_parse_config_entry(Slapi_Entry * e, int apply) entry->threshold = strtoull(value, 0, 0); slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM, - "----------> %s [%" NSPRIu64 "]\n", DNA_THRESHOLD, value); + "----------> %s [%s]\n", DNA_THRESHOLD, value); slapi_ch_free_string(&value); } else { diff --git a/ldap/servers/plugins/pwdstorage/smd5_pwd.c b/ldap/servers/plugins/pwdstorage/smd5_pwd.c index 6747a20..65c6b2a 100644 --- a/ldap/servers/plugins/pwdstorage/smd5_pwd.c +++ b/ldap/servers/plugins/pwdstorage/smd5_pwd.c @@ -70,7 +70,6 @@ smd5_pw_cmp( const char *userpwd, const char *dbpwd ) unsigned char *dbhash = quick_dbhash; struct berval salt; char *hashresult = NULL; - SECItem binary_item; ctx = PK11_CreateDigestContext(SEC_OID_MD5); if (ctx == NULL) { @@ -84,13 +83,13 @@ smd5_pw_cmp( const char *userpwd, const char *dbpwd ) */ hash_len = pwdstorage_base64_decode_len(dbpwd, 0); if ( hash_len >= sizeof(quick_dbhash) ) { /* get more space: */ - dbhash = (char*) slapi_ch_calloc( hash_len + 1, sizeof(char) ); + dbhash = (unsigned char*) slapi_ch_calloc( hash_len + 1, sizeof(char) ); if ( dbhash == NULL ) goto loser; } else { memset( quick_dbhash, 0, sizeof(quick_dbhash) ); } - hashresult = PL_Base64Decode( dbpwd, 0, dbhash ); + hashresult = PL_Base64Decode( dbpwd, 0, (char *)dbhash ); if (NULL == hashresult) { slapi_log_error( SLAPI_LOG_PLUGIN, SALTED_MD5_SUBSYSTEM_NAME, "smd5_pw_cmp: userPassword \"%s\" is the wrong length " @@ -125,7 +124,7 @@ smd5_pw_enc( const char *pwd ) unsigned int outLen; unsigned char hash_out[MD5_LENGTH + MD5_DEFAULT_SALT_LENGTH]; unsigned char b2a_out[(MD5_LENGTH*2) + (MD5_MAX_SALT_LENGTH*2)]; /* conservative */ - char *salt = hash_out + MD5_LENGTH; + unsigned char *salt = hash_out + MD5_LENGTH; struct berval saltval; SECItem binary_item; diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c index a38ad0a..b459a7a 100644 --- a/ldap/servers/plugins/referint/referint.c +++ b/ldap/servers/plugins/referint/referint.c @@ -477,7 +477,7 @@ _update_one_per_mod(const char *entryDN, /* DN of the searched entry */ } slapi_ch_free_string(&newDN); } -bail: + /* in case these memories have not freed */ slapi_ch_free_string(&newvalue); slapi_ch_free_string(&sval); diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c index 95c55e3..b468d32 100644 --- a/ldap/servers/plugins/replication/cl5_api.c +++ b/ldap/servers/plugins/replication/cl5_api.c @@ -2276,6 +2276,7 @@ static int _cl5RemoveEnv () return CL5_SUCCESS; } +#ifdef NEED_CL5_REMOVE_LOGS static int _cl5RemoveLogs () { int rc = CL5_DB_ERROR; @@ -2321,6 +2322,7 @@ static int _cl5RemoveLogs () } return rc; } +#endif /* NEED_CL5_REMOVE_LOGS */ static int _cl5AppInit (PRBool *didRecovery) { diff --git a/ldap/servers/plugins/retrocl/retrocl.c b/ldap/servers/plugins/retrocl/retrocl.c index 271e7fd..556dede 100644 --- a/ldap/servers/plugins/retrocl/retrocl.c +++ b/ldap/servers/plugins/retrocl/retrocl.c @@ -358,7 +358,7 @@ static int retrocl_start (Slapi_PBlock *pb) } else { retrocl_attributes[i] = slapi_ch_malloc(pos-value+1); strncpy(retrocl_attributes[i], value, pos-value); - retrocl_attributes[i][pos-value] = NULL; + retrocl_attributes[i][pos-value] = '\0'; retrocl_aliases[i] = slapi_ch_malloc(value+length-pos); strcpy(retrocl_aliases[i], pos+1); diff --git a/ldap/servers/plugins/retrocl/retrocl_po.c b/ldap/servers/plugins/retrocl/retrocl_po.c index 0e537ee..6b1aa56 100644 --- a/ldap/servers/plugins/retrocl/retrocl_po.c +++ b/ldap/servers/plugins/retrocl/retrocl_po.c @@ -219,7 +219,7 @@ write_replog_db( if ( strcasecmp( attributeName, attr_nsuniqueid ) == 0 ) { Slapi_Entry *entry = NULL; - char *uniqueId = NULL; + const char *uniqueId = NULL; slapi_pblock_get( pb, SLAPI_ENTRY_POST_OP, &entry ); if ( entry == NULL ) { @@ -231,7 +231,7 @@ write_replog_db( slapi_log_error( SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME, "write_replog_db: add %s: \"%s\"\n", attributeAlias, uniqueId ); - val.bv_val = uniqueId; + val.bv_val = (char *)uniqueId; val.bv_len = strlen( uniqueId ); slapi_entry_add_values( e, attributeAlias, vals ); diff --git a/ldap/servers/slapd/attrsyntax.c b/ldap/servers/slapd/attrsyntax.c index f39c0e9..698c1cd 100644 --- a/ldap/servers/slapd/attrsyntax.c +++ b/ldap/servers/slapd/attrsyntax.c @@ -691,10 +691,10 @@ attr_syntax_create( "Error: the EQUALITY matching rule [%s] is not compatible " "with the syntax [%s] for the attribute [%s]\n", mr_equality, attr_syntax, attr_names[0]); -/* +#ifdef ENFORCE_MR_SYNTAX_COMPAT rc = LDAP_INAPPROPRIATE_MATCHING; goto done; -*/ +#endif /* ENFORCE_MR_SYNTAX_COMPAT */ } a.asi_mr_eq_plugin = plugin_mr_find( mr_equality ); if (mr_ordering && !slapi_matchingrule_is_compat(mr_ordering, attr_syntax)) { @@ -702,10 +702,10 @@ attr_syntax_create( "Error: the ORDERING matching rule [%s] is not compatible " "with the syntax [%s] for the attribute [%s]\n", mr_ordering, attr_syntax, attr_names[0]); -/* +#ifdef ENFORCE_MR_SYNTAX_COMPAT rc = LDAP_INAPPROPRIATE_MATCHING; goto done; -*/ +#endif /* ENFORCE_MR_SYNTAX_COMPAT */ } a.asi_mr_ord_plugin = plugin_mr_find( mr_ordering ); if (mr_substring && !slapi_matchingrule_is_compat(mr_substring, attr_syntax)) { @@ -713,10 +713,10 @@ attr_syntax_create( "Error: the SUBSTR matching rule [%s] is not compatible " "with the syntax [%s] for the attribute [%s]\n", mr_substring, attr_syntax, attr_names[0]); -/* +#ifdef ENFORCE_MR_SYNTAX_COMPAT rc = LDAP_INAPPROPRIATE_MATCHING; goto done; -*/ +#endif /* ENFORCE_MR_SYNTAX_COMPAT */ } a.asi_mr_sub_plugin = plugin_mr_find( mr_substring ); a.asi_flags = flags; @@ -736,7 +736,10 @@ attr_syntax_create( } *asip = attr_syntax_dup(&a); + +#ifdef ENFORCE_MR_SYNTAX_COMPAT done: +#endif /* ENFORCE_MR_SYNTAX_COMPAT */ slapi_ch_free((void **)&a.asi_name); return rc; diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h index 1153ff3..b9545b2 100644 --- a/ldap/servers/slapd/back-ldbm/back-ldbm.h +++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h @@ -258,6 +258,7 @@ typedef u_int32_t ID; #define MAXID ((ID)-3) #define NOID ((ID)-2) #define ALLID ((ID)-1) +#define ID_FMT "%u" /* used in printf-like statements */ /* * effective only on idl_new_fetch diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c index 892fd8e..37e1f4d 100644 --- a/ldap/servers/slapd/back-ldbm/import-threads.c +++ b/ldap/servers/slapd/back-ldbm/import-threads.c @@ -2460,7 +2460,7 @@ import_get_and_add_parent_rdns(ImportWorkerInfo *info, if (rc) { slapi_log_error(SLAPI_LOG_FATAL, "ldif2dbm", "import_get_and_add_parent_rdns: Failed to " - "position at ID %lu\n", id); + "position at ID " ID_FMT "\n", id); return rc; } /* rdn is allocated in get_value_from_string */ @@ -2468,7 +2468,7 @@ import_get_and_add_parent_rdns(ImportWorkerInfo *info, if (rc) { slapi_log_error(SLAPI_LOG_FATAL, "ldif2dbm", "import_get_and_add_parent_rdns: " - "Failed to get rdn of entry %lu\n", id); + "Failed to get rdn of entry " ID_FMT "\n", id); goto bail; } /* rdn is set to srdn */ @@ -2476,7 +2476,7 @@ import_get_and_add_parent_rdns(ImportWorkerInfo *info, if (rc < 0) { /* expect rc == 1 since we are setting "rdn" not "dn" */ slapi_log_error(SLAPI_LOG_FATAL, "ldif2dbm", "import_get_and_add_parent_rdns: " - "Failed to add rdn %s of entry %lu\n", rdn, id); + "Failed to add rdn %s of entry " ID_FMT "\n", rdn, id); goto bail; } rc = get_value_from_string((const char *)data.dptr, diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c index 985b690..6717674 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c @@ -518,6 +518,20 @@ int attrcrypt_check_enable_cipher(attrcrypt_cipher_entry *ace) return ret; } +int +attrcrypt_cleanup(attrcrypt_cipher_state *acs) +{ + LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_cleanup\n", 0, 0, 0); + if (acs->key) { + slapd_pk11_FreeSymKey(acs->key); + } + if (acs->slot) { + slapd_pk11_FreeSlot(acs->slot); + } + LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_cleanup\n", 0, 0, 0); + return 0; +} + /* * This function cleans up the inst_attrcrypt_state_private in each backend * instance. @@ -525,7 +539,6 @@ int attrcrypt_check_enable_cipher(attrcrypt_cipher_entry *ace) int attrcrypt_cleanup_private(ldbm_instance *li) { - int i = 0; attrcrypt_cipher_state **current = NULL; LDAPDebug(LDAP_DEBUG_TRACE, "-> attrcrypt_cleanup_private\n", 0, 0, 0); @@ -541,20 +554,6 @@ attrcrypt_cleanup_private(ldbm_instance *li) return 0; } -int -attrcrypt_cleanup(attrcrypt_cipher_state *acs) -{ - LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_cleanup\n", 0, 0, 0); - if (acs->key) { - slapd_pk11_FreeSymKey(acs->key); - } - if (acs->slot) { - slapd_pk11_FreeSlot(acs->slot); - } - LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_cleanup\n", 0, 0, 0); - return 0; -} - static attrcrypt_cipher_state * attrcrypt_get_acs(backend *be, attrcrypt_private *priv) { diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c index e5faa27..b913d68 100644 --- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c +++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c @@ -3080,7 +3080,7 @@ _get_and_add_parent_rdns(backend *be, if (rc) { slapi_log_error(SLAPI_LOG_FATAL, "ldif2dbm", "_get_and_add_parent_rdns: Failed to position " - "at ID %lu\n", id); + "at ID " ID_FMT "\n", id); goto bail; } /* rdn is allocated in get_value_from_string */ @@ -3088,7 +3088,7 @@ _get_and_add_parent_rdns(backend *be, if (rc) { slapi_log_error(SLAPI_LOG_FATAL, "ldif2dbm", "_get_and_add_parent_rdns: " - "Failed to get rdn of entry %lu\n", id); + "Failed to get rdn of entry " ID_FMT "\n", id); goto bail; } /* rdn is going to be set to srdn */ @@ -3096,7 +3096,7 @@ _get_and_add_parent_rdns(backend *be, if (rc < 0) { /* expect rc == 1 since we are setting "rdn" not "dn" */ slapi_log_error(SLAPI_LOG_FATAL, "ldif2dbm", "_get_and_add_parent_rdns: " - "Failed to add rdn %s of entry %lu\n", rdn, id); + "Failed to add rdn %s of entry " ID_FMT "\n", rdn, id); goto bail; } /* pid */ diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c index 00558f7..3816d42 100644 --- a/ldap/servers/slapd/entry.c +++ b/ldap/servers/slapd/entry.c @@ -2882,7 +2882,7 @@ slapi_entry_apply_mods( Slapi_Entry *e, LDAPMod **mods ) int entry_apply_mods( Slapi_Entry *e, LDAPMod **mods ) { - int err, j; + int err; LDAPMod **mp = NULL; LDAPDebug( LDAP_DEBUG_TRACE, "=> entry_apply_mods\n", 0, 0, 0 ); diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c index 38d1300..7873c80 100644 --- a/ldap/servers/slapd/modrdn.c +++ b/ldap/servers/slapd/modrdn.c @@ -383,7 +383,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args) (NULL == newrdn) ? "(null)" : newrdn); } else { slapi_log_error(SLAPI_LOG_ARGS, NULL, - "conn=%" NSPRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n", + "conn=%s op=%d MODRDN invalid new RDN (\"%s\")\n", LOG_INTERNAL_OP_CON_ID, LOG_INTERNAL_OP_OP_ID, (NULL == newrdn) ? "(null)" : newrdn); @@ -415,7 +415,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args) (NULL == newsuperior) ? "(null)" : newsuperiorbuf); } else { slapi_log_error(SLAPI_LOG_ARGS, NULL, - "conn=%" NSPRIu64 " op=%d MODRDN invalid new superior (\"%s\")", + "conn=%s op=%d MODRDN invalid new superior (\"%s\")", LOG_INTERNAL_OP_CON_ID, LOG_INTERNAL_OP_OP_ID, (NULL == newsuperior) ? "(null)" : newsuperiorbuf); diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c index 24f66b9..133f60e 100644 --- a/ldap/servers/slapd/plugin.c +++ b/ldap/servers/slapd/plugin.c @@ -2888,7 +2888,7 @@ void plugin_print_lists(void) struct slapdplugin *tmp = NULL; for (i = 0; i < PLUGIN_LIST_GLOBAL_MAX; i++) { - if (list = get_plugin_list(i)) + if ((list = get_plugin_list(i))) { slapi_log_error(SLAPI_LOG_PLUGIN, NULL, "---- Plugin List (type %d) ----\n", i); diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.h b/ldap/servers/slapd/tools/ldclt/ldclt.h index e6c858a..c8ead2c 100644 --- a/ldap/servers/slapd/tools/ldclt/ldclt.h +++ b/ldap/servers/slapd/tools/ldclt/ldclt.h @@ -740,6 +740,7 @@ extern int connectToServer (thread_context *tttctx); /*JLS 14-03-01*/ extern char *dnFromMessage (thread_context *tttctx, LDAPMessage *res); extern int doAddEntry (thread_context *tttctx); extern int doAttrReplace (thread_context *tttctx); /*JLS 21-11-00*/ +extern int doAttrFileReplace (thread_context *tttctx); extern int doBindOnly (thread_context *tttctx); /*JLS 04-05-01*/ extern int doDeleteEntry (thread_context *tttctx); extern int doExactSearch (thread_context *tttctx); -- 1.5.5.6
-- 389-devel mailing list 389-devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/389-devel