zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

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

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