From dfcc435a5678a0b3679f565e5364f5a32665b356 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Jul 05 2011 16:42:33 +0000 Subject: Bug 719069 - clean up compiler warnings in 389-ds-base 1.2.9 https://bugzilla.redhat.com/show_bug.cgi?id=719069 Description: slapd/entry.c -- added const qualifier to the 2nd arg of _entry_set_tombstone_rdn. slapd/mapping_tree.c -- commented out mapping_tree_node_validate. plugins/automember/automember.c -- removed a unused variable smods. -- modified to use label "bail". -- replaced deprecated slapi_entry_attr_hasvalue with slapi_entry_attr_has_syntax_value. plugins/mep/mep.c -- replaced deprecated slapi_entry_attr_hasvalue with slapi_entry_attr_has_syntax_value. --- diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c index af5dfba..7fd6dab 100644 --- a/ldap/servers/plugins/automember/automember.c +++ b/ldap/servers/plugins/automember/automember.c @@ -1689,15 +1689,15 @@ automember_mod_pre_op(Slapi_PBlock * pb) static int automember_mod_post_op(Slapi_PBlock *pb) { - Slapi_Mods *smods = NULL; char *dn = NULL; slapi_log_error(SLAPI_LOG_TRACE, AUTOMEMBER_PLUGIN_SUBSYSTEM, "--> automember_mod_post_op\n"); /* Just bail if we aren't ready to service requests yet. */ - if (!g_plugin_started) - return 0; + if (!g_plugin_started) { + goto bail; + } if (automember_oktodo(pb) && (dn = automember_get_dn(pb))) { /* Check if the config is being modified and reload if so. */ @@ -1749,8 +1749,12 @@ automember_add_post_op(Slapi_PBlock *pb) if (e) { /* If the entry is a tombstone, just bail. */ - if (slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS, - SLAPI_ATTR_VALUE_TOMBSTONE)) { + Slapi_Value *tombstone = + slapi_value_new_string(SLAPI_ATTR_VALUE_TOMBSTONE); + int rc = slapi_entry_attr_has_syntax_value(e, SLAPI_ATTR_OBJECTCLASS, + tombstone); + slapi_value_free(&tombstone); + if (rc) { return 0; } diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c index fad56ee..520a8c2 100644 --- a/ldap/servers/plugins/mep/mep.c +++ b/ldap/servers/plugins/mep/mep.c @@ -116,6 +116,7 @@ static int mep_parse_mapped_attr(char *mapping, Slapi_Entry *origin, char **type, char **value); static int mep_is_managed_entry(Slapi_Entry *e); static int mep_is_mapped_attr(Slapi_Entry *template, char *type); +static int mep_has_tombstone_value(Slapi_Entry * e); /* * Config cache locking functions @@ -2096,7 +2097,7 @@ mep_mod_post_op(Slapi_PBlock *pb) } /* Fetch the modified entry. This will not be set for a chaining - * backend, so don't treat the message as fatal. */ + * backend, so don't treat the message as fatal. */ slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &e); if (e == NULL) { slapi_log_error(SLAPI_LOG_PLUGIN, MEP_PLUGIN_SUBSYSTEM, @@ -2105,8 +2106,7 @@ mep_mod_post_op(Slapi_PBlock *pb) } /* If the entry is a tombstone, just bail. */ - if (slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS, - SLAPI_ATTR_VALUE_TOMBSTONE)) { + if (mep_has_tombstone_value(e)) { goto bail; } @@ -2218,8 +2218,7 @@ mep_add_post_op(Slapi_PBlock *pb) if (e) { /* If the entry is a tombstone, just bail. */ - if (slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS, - SLAPI_ATTR_VALUE_TOMBSTONE)) { + if (mep_has_tombstone_value(e)) { return 0; } @@ -2287,8 +2286,7 @@ mep_del_post_op(Slapi_PBlock *pb) char *managed_dn = NULL; /* If the entry is a tombstone, just bail. */ - if (slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS, - SLAPI_ATTR_VALUE_TOMBSTONE)) { + if (mep_has_tombstone_value(e)) { return 0; } @@ -2365,8 +2363,7 @@ mep_modrdn_post_op(Slapi_PBlock *pb) } /* If the entry is a tombstone, just bail. */ - if (slapi_entry_attr_hasvalue(post_e, SLAPI_ATTR_OBJECTCLASS, - SLAPI_ATTR_VALUE_TOMBSTONE)) { + if (mep_has_tombstone_value(post_e)) { return 0; } @@ -2549,3 +2546,12 @@ mep_modrdn_post_op(Slapi_PBlock *pb) return 0; } +static int +mep_has_tombstone_value(Slapi_Entry * e) +{ + Slapi_Value *tombstone = slapi_value_new_string(SLAPI_ATTR_VALUE_TOMBSTONE); + int rc = slapi_entry_attr_has_syntax_value(e, SLAPI_ATTR_OBJECTCLASS, + tombstone); + slapi_value_free(&tombstone); + return rc; +} diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c index 80a4640..54dd87b 100644 --- a/ldap/servers/plugins/replication/windows_protocol_util.c +++ b/ldap/servers/plugins/replication/windows_protocol_util.c @@ -2166,7 +2166,7 @@ mod_already_made(Private_Repl_Protocol *prp, Slapi_Mod *smod, Slapi_Entry *ad_en * mods to take prior mods into account when * determining what can be skipped. */ if (retval == 0) { - slapi_entry_apply_mod(ad_entry, slapi_mod_get_ldapmod_byref(smod)); + slapi_entry_apply_mod(ad_entry, (LDAPMod *)slapi_mod_get_ldapmod_byref(smod)); } return retval; diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c index 9e0ea2e..0977c78 100644 --- a/ldap/servers/slapd/entry.c +++ b/ldap/servers/slapd/entry.c @@ -62,7 +62,7 @@ #define DELETED_VALUE_STRSIZE 8 /* sizeof(";deleted") */ /* a helper function to set special rdn to a tombstone entry */ -static int _entry_set_tombstone_rdn(Slapi_Entry *e, char *normdn); +static int _entry_set_tombstone_rdn(Slapi_Entry *e, const char *normdn); /* * An attribute name is of the form 'basename[;option]'. @@ -3867,7 +3867,7 @@ out: /* a helper function to set special rdn to a tombstone entry */ /* Since this a tombstone, it requires a special treatment for rdn*/ static int -_entry_set_tombstone_rdn(Slapi_Entry *e, char *normdn) +_entry_set_tombstone_rdn(Slapi_Entry *e, const char *normdn) { int rc = 0; char *tombstone_rdn = slapi_ch_strdup(normdn); diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c index a0f7a67..967b2d7 100644 --- a/ldap/servers/slapd/mapping_tree.c +++ b/ldap/servers/slapd/mapping_tree.c @@ -986,6 +986,8 @@ done: return result; } +#if 0 +/* defined but not used */ /* * Description: * A first attempt at walking over the mapping tree and making sure things @@ -1018,6 +1020,7 @@ mapping_tree_node_validate(mapping_tree_node *node) } } } +#endif static void mtn_free_referral_in_node (mapping_tree_node *node)