andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

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

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