Blame SOURCES/0023-Issue-49254-Fix-compiler-failures-and-warnings.patch

8394b4
From 585d536de6927cf47ef817f541db392dfca4526b Mon Sep 17 00:00:00 2001
8394b4
From: Mark Reynolds <mreynolds@redhat.com>
8394b4
Date: Wed, 22 Jan 2020 15:10:04 -0500
8394b4
Subject: [PATCH] Issue 49254 - Fix compiler failures and warnings
8394b4
8394b4
Description:  Fix issues with new gcc compiler flag "-fno-common",
8394b4
              and clean up doxygen warnings around libsds
8394b4
8394b4
relates: https://pagure.io/389-ds-base/issue/49254
8394b4
8394b4
Reviewed by: mhonek, spichugi, and tbordaz (Thanks!!!)
8394b4
---
8394b4
 docs/slapi.doxy.in                       |  2 -
8394b4
 ldap/servers/plugins/acl/acl.c           |  1 +
8394b4
 ldap/servers/plugins/acl/acl.h           |  4 +-
8394b4
 ldap/servers/plugins/acl/acl_ext.c       |  2 +
8394b4
 ldap/servers/slapd/result.c              |  8 ++--
8394b4
 ldap/servers/slapd/slap.h                |  4 +-
8394b4
 ldap/servers/slapd/tools/ldclt/ldapfct.c |  2 +-
8394b4
 src/libsds/include/sds.h                 | 56 ++++++++++++++----------
8394b4
 8 files changed, 47 insertions(+), 32 deletions(-)
8394b4
8394b4
diff --git a/docs/slapi.doxy.in b/docs/slapi.doxy.in
8394b4
index 2cc2d5f47..b1e4810ab 100644
8394b4
--- a/docs/slapi.doxy.in
8394b4
+++ b/docs/slapi.doxy.in
8394b4
@@ -760,7 +760,6 @@ WARN_LOGFILE           =
8394b4
 
8394b4
 INPUT                  = src/libsds/include/sds.h \
8394b4
                          docs/job-safety.md \
8394b4
-                         src/nunc-stans/include/nunc-stans.h
8394b4
                          # ldap/servers/slapd/slapi-plugin.h \
8394b4
 
8394b4
 # This tag can be used to specify the character encoding of the source files
8394b4
@@ -1101,7 +1100,6 @@ HTML_EXTRA_STYLESHEET  = docs/custom.css
8394b4
 
8394b4
 # HTML_EXTRA_FILES       = docs/nunc-stans-intro.png \
8394b4
 # 						 docs/nunc-stans-job-states.png
8394b4
-HTML_EXTRA_FILES = docs/nunc-stans-job-states.png
8394b4
 
8394b4
 # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
8394b4
 # will adjust the colors in the style sheet and background images according to
8394b4
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
8394b4
index 5680de669..41a909a18 100644
8394b4
--- a/ldap/servers/plugins/acl/acl.c
8394b4
+++ b/ldap/servers/plugins/acl/acl.c
8394b4
@@ -13,6 +13,7 @@
8394b4
 
8394b4
 #include "acl.h"
8394b4
 
8394b4
+
8394b4
 /****************************************************************************
8394b4
 *
8394b4
 * acl.c
8394b4
diff --git a/ldap/servers/plugins/acl/acl.h b/ldap/servers/plugins/acl/acl.h
8394b4
index 5d453d825..becc7f920 100644
8394b4
--- a/ldap/servers/plugins/acl/acl.h
8394b4
+++ b/ldap/servers/plugins/acl/acl.h
8394b4
@@ -311,8 +311,8 @@ typedef struct aci
8394b4
 #define ATTR_ACLPB_MAX_SELECTED_ACLS    "nsslapd-aclpb-max-selected-acls"
8394b4
 #define DEFAULT_ACLPB_MAX_SELECTED_ACLS 200
8394b4
 
8394b4
-int aclpb_max_selected_acls; /* initialized from plugin config entry */
8394b4
-int aclpb_max_cache_results; /* initialized from plugin config entry */
8394b4
+extern int aclpb_max_selected_acls; /* initialized from plugin config entry */
8394b4
+extern int aclpb_max_cache_results; /* initialized from plugin config entry */
8394b4
 
8394b4
 typedef struct result_cache
8394b4
 {
8394b4
diff --git a/ldap/servers/plugins/acl/acl_ext.c b/ldap/servers/plugins/acl/acl_ext.c
8394b4
index 31c61c2f4..797c5d2fd 100644
8394b4
--- a/ldap/servers/plugins/acl/acl_ext.c
8394b4
+++ b/ldap/servers/plugins/acl/acl_ext.c
8394b4
@@ -23,6 +23,8 @@ static int acl__put_aclpb_back_to_pool(Acl_PBlock *aclpb);
8394b4
 static Acl_PBlock *acl__malloc_aclpb(void);
8394b4
 static void acl__free_aclpb(Acl_PBlock **aclpb_ptr);
8394b4
 
8394b4
+int aclpb_max_selected_acls = DEFAULT_ACLPB_MAX_SELECTED_ACLS;
8394b4
+int aclpb_max_cache_results = DEFAULT_ACLPB_MAX_SELECTED_ACLS;
8394b4
 
8394b4
 struct acl_pbqueue
8394b4
 {
8394b4
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
8394b4
index 89f776716..0b13c30e9 100644
8394b4
--- a/ldap/servers/slapd/result.c
8394b4
+++ b/ldap/servers/slapd/result.c
8394b4
@@ -1954,9 +1954,11 @@ notes2str(unsigned int notes, char *buf, size_t buflen)
8394b4
              */
8394b4
             buflen -= len;
8394b4
             p += len;
8394b4
-            /* Put in the end quote, then back track p. */
8394b4
-            *p++ = '"';
8394b4
-            *p--;
8394b4
+            /*
8394b4
+             * Put in the end quote. If another snp_detail is append a comma
8394b4
+             * will overwrite the quote.
8394b4
+             */
8394b4
+            *(p + 1) = '"';
8394b4
         }
8394b4
     }
8394b4
 
8394b4
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
8394b4
index d73e9aaae..44f6be97a 100644
8394b4
--- a/ldap/servers/slapd/slap.h
8394b4
+++ b/ldap/servers/slapd/slap.h
8394b4
@@ -935,7 +935,7 @@ enum
8394b4
 };
8394b4
 
8394b4
 /* DataList definition */
8394b4
-struct datalist
8394b4
+typedef struct datalist
8394b4
 {
8394b4
     void **elements;   /* array of elements */
8394b4
     int element_count; /* number of elements in the array */
8394b4
@@ -1737,7 +1737,7 @@ typedef struct conn
8394b4
  *  * Online tasks interface (to support import, export, etc)
8394b4
  *   * After some cleanup, we could consider making these public.
8394b4
  *    */
8394b4
-struct slapi_task
8394b4
+typedef struct slapi_task
8394b4
 {
8394b4
     struct slapi_task *next;
8394b4
     char *task_dn;
8394b4
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
8394b4
index ca0912d6c..dbfc553d3 100644
8394b4
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
8394b4
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
8394b4
@@ -698,7 +698,7 @@ connectToLDAP(thread_context *tttctx, const char *bufBindDN, const char *bufPass
8394b4
             }
8394b4
             if (mode & VERY_VERBOSE)
8394b4
                 printf("ldclt[%d]: T%03d: Before ldap_simple_bind_s (%s, %s)\n",
8394b4
-                       mctx.pid, thrdNum, binddn,
8394b4
+                       mctx.pid, thrdNum, binddn ? binddn : "Anonymous",
8394b4
                        passwd ? passwd : "NO PASSWORD PROVIDED");
8394b4
             ret = ldap_sasl_bind_s(ld, binddn,
8394b4
                                    LDAP_SASL_SIMPLE, &cred, NULL, NULL, &servercredp); /*JLS 05-01-01*/
8394b4
diff --git a/src/libsds/include/sds.h b/src/libsds/include/sds.h
8394b4
index c649c036d..3f0dd8684 100644
8394b4
--- a/src/libsds/include/sds.h
8394b4
+++ b/src/libsds/include/sds.h
8394b4
@@ -221,13 +221,13 @@ void sds_free(void *ptr);
8394b4
  * sds_crc32c uses the crc32c algorithm to create a verification checksum of data.
8394b4
  * This checksum is for data verification, not cryptographic purposes. It is used
8394b4
  * largely in debugging to find cases when bytes in structures are updated incorrectly,
8394b4
- * or to find memory bit flips during operation. If avaliable, this will use the
8394b4
+ * or to find memory bit flips during operation. If available, this will use the
8394b4
  * intel sse4 crc32c hardware acceleration.
8394b4
  *
8394b4
  * \param crc The running CRC value. Initially should be 0. If in doubt, use 0.
8394b4
  * \param data Pointer to the data to checksum.
8394b4
  * \param length number of bytes to validate.
8394b4
- * \retval crc The crc of this data. May be re-used in subsequent sds_crc32c calls
8394b4
+ * \retval rcrc The crc of this data. May be re-used in subsequent sds_crc32c calls
8394b4
  * for certain datatypes.
8394b4
  */
8394b4
 uint32_t sds_crc32c(uint32_t crc, const unsigned char *data, size_t length);
8394b4
@@ -1356,48 +1356,60 @@ typedef enum _sds_ht_slot_state {
8394b4
     SDS_HT_BRANCH = 2,
8394b4
 } sds_ht_slot_state;
8394b4
 
8394b4
+/**
8394b4
+ * ht values
8394b4
+ */
8394b4
 typedef struct _sds_ht_value
8394b4
 {
8394b4
-    uint32_t checksum;
8394b4
-    void *key;
8394b4
-    void *value;
8394b4
+    uint32_t checksum;  /**< the checksum */
8394b4
+    void *key;  /**< the key */
8394b4
+    void *value;  /**< the key value */
8394b4
     // may make this a LL of values later for collisions
8394b4
 } sds_ht_value;
8394b4
 
8394b4
+/**
8394b4
+ * ht slot
8394b4
+ */
8394b4
 typedef struct _sds_ht_slot
8394b4
 {
8394b4
-    sds_ht_slot_state state;
8394b4
+    sds_ht_slot_state state; /**< the checksum */
8394b4
     union
8394b4
     {
8394b4
         sds_ht_value *value;
8394b4
         struct _sds_ht_node *node;
8394b4
-    } slot;
8394b4
+    } slot;  /**< slot union */
8394b4
 } sds_ht_slot;
8394b4
 
8394b4
+/**
8394b4
+ *  ht node
8394b4
+ */
8394b4
 typedef struct _sds_ht_node
8394b4
 {
8394b4
-    uint32_t checksum;
8394b4
-    uint64_t txn_id;
8394b4
-    uint_fast32_t count;
8394b4
+    uint32_t checksum; /**< the checksum */
8394b4
+    uint64_t txn_id; /**< transaction id */
8394b4
+    uint_fast32_t count; /**< the count */
8394b4
 #ifdef SDS_DEBUG
8394b4
     uint64_t depth;
8394b4
 #endif
8394b4
-    struct _sds_ht_node *parent;
8394b4
-    size_t parent_slot;
8394b4
-    sds_ht_slot slots[HT_SLOTS];
8394b4
+    struct _sds_ht_node *parent; /**< the parent */
8394b4
+    size_t parent_slot; /**< the parent slot */
8394b4
+    sds_ht_slot slots[HT_SLOTS]; /**< the slots */
8394b4
 } sds_ht_node;
8394b4
 
8394b4
+/**
8394b4
+ *  ht instance
8394b4
+ */
8394b4
 typedef struct _sds_ht_instance
8394b4
 {
8394b4
-    uint32_t checksum;
8394b4
-    char hkey[16];
8394b4
-    sds_ht_node *root;
8394b4
-    int64_t (*key_cmp_fn)(void *a, void *b);
8394b4
-    uint64_t (*key_size_fn)(void *key);
8394b4
-    void *(*key_dup_fn)(void *key);
8394b4
-    void (*key_free_fn)(void *key);
8394b4
-    void *(*value_dup_fn)(void *value);
8394b4
-    void (*value_free_fn)(void *value);
8394b4
+    uint32_t checksum; /**< the checksum */
8394b4
+    char hkey[16]; /**< the key */
8394b4
+    sds_ht_node *root; /**< the root */
8394b4
+    int64_t (*key_cmp_fn)(void *a, void *b); /**< the keycompare function */
8394b4
+    uint64_t (*key_size_fn)(void *key); /**< the key size function */
8394b4
+    void *(*key_dup_fn)(void *key); /**< the key dup function */
8394b4
+    void (*key_free_fn)(void *key); /**< the key free function */
8394b4
+    void *(*value_dup_fn)(void *value); /**< the value dup function */
8394b4
+    void (*value_free_fn)(void *value); /**< the value free function */
8394b4
 } sds_ht_instance;
8394b4
 
8394b4
 uint64_t sds_uint64_t_size(void *key);
8394b4
-- 
8394b4
2.21.1
8394b4