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

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