Преглед изворни кода

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.
Noriko Hosoi пре 14 година
родитељ
комит
dfcc435a56

+ 9 - 5
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;
         }
 

+ 15 - 9
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;
+}

+ 1 - 1
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;

+ 2 - 2
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);

+ 3 - 0
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)