Blame SOURCES/0009-Ticket-49394-slapi_pblock_get-may-leave-unchanged-th.patch

058656
From 0b58d1a62679c3961bc41e03591c4277fb9f183e Mon Sep 17 00:00:00 2001
058656
From: Thierry Bordaz <tbordaz@redhat.com>
058656
Date: Thu, 5 Oct 2017 12:50:50 +0200
058656
Subject: [PATCH] Ticket 49394 - slapi_pblock_get may leave unchanged the
058656
 provided variable
058656
058656
Bug Description:
058656
	Since 1.3.6.4 the pblock struct is a split in sub-structs
058656
	(https://pagure.io/389-ds-base/issue/49097)
058656
058656
	Before, it was a quite flat calloc struct and any slapi-pblock-get
058656
	retrieved the field (NULL if not previously slapi_pblock_set) and
058656
	assigned the provided variable.
058656
058656
	Now, the sub-struct are allocated on demand (slapi_pblock_set).
058656
	If a substruct that contains the requested field is not allocated the
058656
	provided variable is unchanged.
058656
058656
	This is a change of behavior, because a uninitialized local variable can
058656
	get random value (stack) if the lookup field/struct has not been set.
058656
058656
Fix Description:
058656
	Update slapi_pblock_set so that it systematically sets the
058656
	provided variable when those substructs are NULL
058656
		pb_mr
058656
		pb_dse
058656
		pb_task
058656
		pb_misc
058656
		pb_intop
058656
		pb_intplugin
058656
		pb_deprecated
058656
058656
https://pagure.io/389-ds-base/issue/49394
058656
058656
Reviewed by: Mark Reynolds, William Brown
058656
058656
Platforms tested: F23
058656
058656
Flag Day: no
058656
058656
Doc impact: no
058656
---
058656
 ldap/servers/slapd/pblock.c | 166 +++++++++++++++++++++++++++++++++++++++++++-
058656
 1 file changed, 165 insertions(+), 1 deletion(-)
058656
058656
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
058656
index 077684d23..8f87de5b5 100644
058656
--- a/ldap/servers/slapd/pblock.c
058656
+++ b/ldap/servers/slapd/pblock.c
058656
@@ -379,6 +379,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_BACKEND_COUNT:
058656
         if (pblock->pb_misc != NULL) {
058656
             (*(int *)value) = pblock->pb_misc->pb_backend_count;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_BE_TYPE:
058656
@@ -616,6 +618,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_REQUESTOR_ISROOT:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(int *)value) = pblock->pb_intop->pb_requestor_isroot;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_SKIP_MODIFIED_ATTRS:
058656
@@ -657,6 +661,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_DESTROY_CONTENT:
058656
         if (pblock->pb_deprecated != NULL) {
058656
             (*(int *)value) = pblock->pb_deprecated->pb_destroy_content;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -685,16 +691,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_PLUGIN_OPRETURN:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(int *)value) = pblock->pb_intop->pb_opreturn;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_OBJECT:
058656
         if (pblock->pb_intplugin != NULL) {
058656
             (*(void **)value) = pblock->pb_intplugin->pb_object;
058656
+        } else {
058656
+            (*(void **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_DESTROY_FN:
058656
         if (pblock->pb_intplugin != NULL) {
058656
             (*(IFP *)value) = pblock->pb_intplugin->pb_destroy_fn;
058656
+        } else {
058656
+            (*(IFP *)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_DESCRIPTION:
058656
@@ -703,11 +715,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_PLUGIN_IDENTITY:
058656
         if (pblock->pb_intplugin != NULL) {
058656
             (*(void **)value) = pblock->pb_intplugin->pb_plugin_identity;
058656
+        } else {
058656
+            (*(void **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_CONFIG_AREA:
058656
         if (pblock->pb_intplugin != NULL) {
058656
             (*(char **)value) = pblock->pb_intplugin->pb_plugin_config_area;
058656
+        } else {
058656
+            (*(char **)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_CONFIG_DN:
058656
@@ -718,16 +734,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_PLUGIN_INTOP_RESULT:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(int *)value) = pblock->pb_intop->pb_internal_op_result;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(Slapi_Entry ***)value) = pblock->pb_intop->pb_plugin_internal_search_op_entries;
058656
+        } else {
058656
+            (*(Slapi_Entry ***)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(char ***)value) = pblock->pb_intop->pb_plugin_internal_search_op_referrals;
058656
+        } else {
058656
+            (*(char ***)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -1167,11 +1189,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_ENTRY_PRE_OP:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(Slapi_Entry **)value) = pblock->pb_intop->pb_pre_op_entry;
058656
+        } else {
058656
+            (*(Slapi_Entry **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_ENTRY_POST_OP:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(Slapi_Entry **)value) = pblock->pb_intop->pb_post_op_entry;
058656
+        } else {
058656
+            (*(Slapi_Entry **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -1419,12 +1445,16 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_CONTROLS_ARG: /* used to pass control argument before operation is created */
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(LDAPControl ***)value) = pblock->pb_intop->pb_ctrls_arg;
058656
+        } else {
058656
+            (*(LDAPControl ***)value) = NULL;
058656
         }
058656
         break;
058656
     /* notes to be added to the access log RESULT line for this op. */
058656
     case SLAPI_OPERATION_NOTES:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(unsigned int *)value) = pblock->pb_intop->pb_operation_notes;
058656
+        } else {
058656
+            (*(unsigned int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -1486,6 +1516,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_SYNTAX_SUBSTRLENS: /* aka SLAPI_MR_SUBSTRLENS */
058656
         if (pblock->pb_intplugin != NULL) {
058656
             (*(int **)value) = pblock->pb_intplugin->pb_substrlens;
058656
+        } else {
058656
+            (*(int **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_SYNTAX_VALIDATE:
058656
@@ -1505,11 +1537,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_MANAGEDSAIT:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(int *)value) = pblock->pb_intop->pb_managedsait;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_PWPOLICY:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(int *)value) = pblock->pb_intop->pb_pwpolicy_ctrl;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -1522,11 +1558,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_ADD_EXISTING_DN_ENTRY:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(Slapi_Entry **)value) = pblock->pb_intop->pb_existing_dn_entry;
058656
+        } else {
058656
+            (*(Slapi_Entry **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_ADD_EXISTING_UNIQUEID_ENTRY:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(Slapi_Entry **)value) = pblock->pb_intop->pb_existing_uniqueid_entry;
058656
+        } else {
058656
+            (*(Slapi_Entry **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_ADD_PARENT_ENTRY:
058656
@@ -1537,6 +1577,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_ADD_PARENT_UNIQUEID:
058656
         if (pblock->pb_op != NULL) {
058656
             (*(char **)value) = pblock->pb_op->o_params.p.p_add.parentuniqueid;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -1624,16 +1666,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_MODRDN_PARENT_ENTRY:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(Slapi_Entry **)value) = pblock->pb_intop->pb_parent_entry;
058656
+        } else {
058656
+            (*(Slapi_Entry **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_MODRDN_NEWPARENT_ENTRY:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(Slapi_Entry **)value) = pblock->pb_intop->pb_newparent_entry;
058656
+        } else {
058656
+            (*(Slapi_Entry **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_MODRDN_TARGET_ENTRY:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(Slapi_Entry **)value) = pblock->pb_intop->pb_target_entry;
058656
+        } else {
058656
+            (*(Slapi_Entry **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_MODRDN_NEWSUPERIOR_ADDRESS:
058656
@@ -1740,26 +1788,36 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_PLUGIN_MR_FILTER_MATCH_FN:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(mrFilterMatchFn *)value) = pblock->pb_mr->filter_match_fn;
058656
+        } else {
058656
+            (*(mrFilterMatchFn *)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_FILTER_INDEX_FN:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(IFP *)value) = pblock->pb_mr->filter_index_fn;
058656
+        } else {
058656
+            (*(IFP *)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_FILTER_RESET_FN:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(IFP *)value) = pblock->pb_mr->filter_reset_fn;
058656
+        } else {
058656
+            (*(IFP *)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_INDEX_FN:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(IFP *)value) = pblock->pb_mr->index_fn;
058656
+        } else {
058656
+            (*(IFP *)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_INDEX_SV_FN:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(IFP *)value) = pblock->pb_mr->index_sv_fn;
058656
+        } else {
058656
+            (*(IFP *)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -1767,41 +1825,57 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_PLUGIN_MR_OID:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(char **)value) = pblock->pb_mr->oid;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_TYPE:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(char **)value) = pblock->pb_mr->type;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_VALUE:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(struct berval **)value) = pblock->pb_mr->value;
058656
+        } else {
058656
+            (*(struct berval **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_VALUES:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(struct berval ***)value) = pblock->pb_mr->values;
058656
+        } else {
058656
+            (*(struct berval ***)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_KEYS:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(struct berval ***)value) = pblock->pb_mr->keys;
058656
+        } else {
058656
+            (*(struct berval ***)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(unsigned int *)value) = pblock->pb_mr->filter_reusable;
058656
+        } else {
058656
+            (*(unsigned int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_QUERY_OPERATOR:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(int *)value) = pblock->pb_mr->query_operator;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_PLUGIN_MR_USAGE:
058656
         if (pblock->pb_mr != NULL) {
058656
             (*(unsigned int *)value) = pblock->pb_mr->usage;
058656
+        } else {
058656
+            (*(unsigned int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -1865,16 +1939,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_SEQ_TYPE:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->seq_type;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_SEQ_ATTRNAME:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char **)value) = pblock->pb_task->seq_attrname;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_SEQ_VAL:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char **)value) = pblock->pb_task->seq_val;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -1882,47 +1962,65 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_LDIF2DB_FILE:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char ***)value) = pblock->pb_task->ldif_files;
058656
+        } else {
058656
+            (*(char ***)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_LDIF2DB_REMOVEDUPVALS:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->removedupvals;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_DB2INDEX_ATTRS:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char ***)value) = pblock->pb_task->db2index_attrs;
058656
+        } else {
058656
+            (*(char ***)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_LDIF2DB_NOATTRINDEXES:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->ldif2db_noattrindexes;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_LDIF2DB_INCLUDE:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char ***)value) = pblock->pb_task->ldif_include;
058656
+        } else {
058656
+            (*(char ***)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_LDIF2DB_EXCLUDE:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char ***)value) = pblock->pb_task->ldif_exclude;
058656
+        } else {
058656
+            (*(char ***)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_LDIF2DB_GENERATE_UNIQUEID:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->ldif_generate_uniqueid;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_LDIF2DB_ENCRYPT:
058656
     case SLAPI_DB2LDIF_DECRYPT:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->ldif_encrypt;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_LDIF2DB_NAMESPACEID:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char **)value) = pblock->pb_task->ldif_namespaceid;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -1930,16 +2028,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_DB2LDIF_PRINTKEY:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->ldif_printkey;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_DB2LDIF_DUMP_UNIQUEID:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->ldif_dump_uniqueid;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_DB2LDIF_FILE:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char **)value) = pblock->pb_task->ldif_file;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -1947,37 +2051,51 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_BACKEND_INSTANCE_NAME:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char **)value) = pblock->pb_task->instance_name;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_BACKEND_TASK:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(Slapi_Task **)value) = pblock->pb_task->task;
058656
+        } else {
058656
+            (*(Slapi_Task **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_TASK_FLAGS:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->task_flags;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_DB2LDIF_SERVER_RUNNING:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->server_running;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_BULK_IMPORT_ENTRY:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(Slapi_Entry **)value) = pblock->pb_task->import_entry;
058656
+        } else {
058656
+            (*(Slapi_Entry **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_BULK_IMPORT_STATE:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(int *)value) = pblock->pb_task->import_state;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     /* dbverify */
058656
     case SLAPI_DBVERIFY_DBDIR:
058656
         if (pblock->pb_task != NULL) {
058656
             (*(char **)value) = pblock->pb_task->dbverify_dbdir;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -1993,11 +2111,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_TXN:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(void **)value) = pblock->pb_intop->pb_txn;
058656
+        } else {
058656
+            (*(void **)value) = NULL;
058656
         }
058656
         break;
058656
     case SLAPI_TXN_RUV_MODS_FN:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(IFP *)value) = pblock->pb_intop->pb_txn_ruv_mods_fn;
058656
+        } else {
058656
+            (*(IFP *)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -2052,6 +2174,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_PB_RESULT_TEXT:
058656
         if (pblock->pb_intop != NULL) {
058656
             *((char **)value) = pblock->pb_intop->pb_result_text;
058656
+        } else {
058656
+            *((char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -2059,6 +2183,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_DBSIZE:
058656
         if (pblock->pb_misc != NULL) {
058656
             (*(unsigned int *)value) = pblock->pb_misc->pb_dbsize;
058656
+        } else {
058656
+            (*(unsigned int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -2153,11 +2279,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_ARGC:
058656
         if (pblock->pb_misc != NULL) {
058656
             (*(int *)value) = pblock->pb_misc->pb_slapd_argc;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
     case SLAPI_ARGV:
058656
         if (pblock->pb_misc != NULL) {
058656
             (*(char ***)value) = pblock->pb_misc->pb_slapd_argv;
058656
+        } else {
058656
+            (*(char ***)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -2165,6 +2295,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_CONFIG_DIRECTORY:
058656
         if (pblock->pb_intplugin != NULL) {
058656
             (*(char **)value) = pblock->pb_intplugin->pb_slapd_configdir;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -2175,12 +2307,16 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD:
058656
         if (pblock->pb_deprecated != NULL) {
058656
             (*(char **)value) = pblock->pb_deprecated->pb_pwd_storage_scheme_user_passwd;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
     case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD:
058656
         if (pblock->pb_deprecated != NULL) {
058656
             (*(char **)value) = pblock->pb_deprecated->pb_pwd_storage_scheme_db_passwd;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -2208,6 +2344,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_PLUGIN_ENABLED:
058656
         if (pblock->pb_intplugin != NULL) {
058656
             *((int *)value) = pblock->pb_intplugin->pb_plugin_enabled;
058656
+        } else {
058656
+            *((int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -2215,6 +2353,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_DSE_DONT_WRITE_WHEN_ADDING:
058656
         if (pblock->pb_dse != NULL) {
058656
             (*(int *)value) = pblock->pb_dse->dont_add_write;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -2222,6 +2362,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_DSE_MERGE_WHEN_ADDING:
058656
         if (pblock->pb_dse != NULL) {
058656
             (*(int *)value) = pblock->pb_dse->add_merge;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -2229,6 +2371,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_DSE_DONT_CHECK_DUPS:
058656
         if (pblock->pb_dse != NULL) {
058656
             (*(int *)value) = pblock->pb_dse->dont_check_dups;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -2236,6 +2380,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_DSE_REAPPLY_MODS:
058656
         if (pblock->pb_dse != NULL) {
058656
             (*(int *)value) = pblock->pb_dse->reapply_mods;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -2243,6 +2389,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_DSE_IS_PRIMARY_FILE:
058656
         if (pblock->pb_dse != NULL) {
058656
             (*(int *)value) = pblock->pb_dse->is_primary_file;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
@@ -2250,42 +2398,56 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_SCHEMA_FLAGS:
058656
         if (pblock->pb_dse != NULL) {
058656
             (*(int *)value) = pblock->pb_dse->schema_flags;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
     case SLAPI_URP_NAMING_COLLISION_DN:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(char **)value) = pblock->pb_intop->pb_urp_naming_collision_dn;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
     case SLAPI_URP_TOMBSTONE_UNIQUEID:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(char **)value) = pblock->pb_intop->pb_urp_tombstone_uniqueid;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
     case SLAPI_URP_TOMBSTONE_CONFLICT_DN:
058656
         if (pblock->pb_intop != NULL) {
058656
-		(*(char **)value) = pblock->pb_intop->pb_urp_tombstone_conflict_dn;
058656
+            (*(char **)value) = pblock->pb_intop->pb_urp_tombstone_conflict_dn;
058656
+        } else {
058656
+            (*(char **)value) = NULL;
058656
         }
058656
 	break;
058656
 		
058656
     case SLAPI_SEARCH_CTRLS:
058656
         if (pblock->pb_intop != NULL) {
058656
             (*(LDAPControl ***)value) = pblock->pb_intop->pb_search_ctrls;
058656
+        } else {
058656
+            (*(LDAPControl ***)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
     case SLAPI_PLUGIN_SYNTAX_FILTER_NORMALIZED:
058656
         if (pblock->pb_intplugin != NULL) {
058656
             (*(int *)value) = pblock->pb_intplugin->pb_syntax_filter_normalized;
058656
+        } else {
058656
+            (*(int *)value) =  0;
058656
         }
058656
         break;
058656
 
058656
     case SLAPI_PLUGIN_SYNTAX_FILTER_DATA:
058656
         if (pblock->pb_intplugin != NULL) {
058656
             (*(void **)value) = pblock->pb_intplugin->pb_syntax_filter_data;
058656
+        } else {
058656
+            (*(void **)value) = NULL;
058656
         }
058656
         break;
058656
 
058656
@@ -2311,6 +2473,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
058656
     case SLAPI_ACI_TARGET_CHECK:
058656
         if (pblock->pb_misc != NULL) {
058656
             (*(int *)value) = pblock->pb_misc->pb_aci_target_check;
058656
+        } else {
058656
+            (*(int *)value) = 0;
058656
         }
058656
         break;
058656
 
058656
-- 
058656
2.13.6
058656