summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-07-06 12:41:57 -0500
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-23 17:08:38 -0700
commit5bdd0d0ca1a15bca996d538f075de4943b76598c (patch)
tree866ec2686da1e7dd7f8f62f752d3f3aa52d25363
parentbccfb4412bcc61641561c8a858dc468bf9573752 (diff)
downloadds-5bdd0d0ca1a15bca996d538f075de4943b76598c.tar.gz
ds-5bdd0d0ca1a15bca996d538f075de4943b76598c.tar.xz
ds-5bdd0d0ca1a15bca996d538f075de4943b76598c.zip
Bug 611790 - fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166
https://bugzilla.redhat.com/show_bug.cgi?id=611790 Resolves: bug 611790 Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166 Fix description: Catch possible NULL pointer in plugin_invoke_plugin_sdn().
-rw-r--r--ldap/servers/slapd/plugin.c60
1 files changed, 25 insertions, 35 deletions
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index a64fcd67..e283a276 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -2432,6 +2432,10 @@ plugin_invoke_plugin_sdn (struct slapdplugin *plugin, int operation, Slapi_PBloc
int method = -1;
PR_ASSERT (plugin);
+ if (!pb) {
+ LDAPDebug(LDAP_DEBUG_ANY, "plugin_invoke_plugin_sdn: NULL pblock.\n", 0, 0, 0);
+ return PR_FALSE;
+ }
/* get configuration from the group plugin if necessary */
config = plugin_get_config (plugin);
@@ -2441,57 +2445,43 @@ plugin_invoke_plugin_sdn (struct slapdplugin *plugin, int operation, Slapi_PBloc
{
int repl_op;
- /* if pb is NULL we assume it is not a replicated operation */
- if (pb)
- {
- slapi_pblock_get (pb, SLAPI_IS_REPLICATED_OPERATION, &repl_op);
- if (repl_op)
- return PR_FALSE;
- }
+ slapi_pblock_get (pb, SLAPI_IS_REPLICATED_OPERATION, &repl_op);
+ if (repl_op)
+ return PR_FALSE;
}
- if (pb)
- {
- if (pb->pb_op)
- {
- op = operation_get_type(pb->pb_op);
-
- if (op == SLAPI_OPERATION_BIND || op == SLAPI_OPERATION_UNBIND)
- {
- bindop = PR_TRUE;
- }
- else
- {
- bindop = PR_FALSE;
- }
+ if (pb->pb_op)
+ {
+ op = operation_get_type(pb->pb_op);
- slapi_pblock_get (pb, SLAPI_REQUESTOR_ISROOT, &isroot);
+ if (op == SLAPI_OPERATION_BIND || op == SLAPI_OPERATION_UNBIND)
+ {
+ bindop = PR_TRUE;
}
else
{
bindop = PR_FALSE;
- isroot = 1;
}
- slapi_pblock_get (pb, SLAPI_BACKEND, &be);
-
- /* determine whether data are local or remote */
- /* remote if chaining backend or default backend */
-
- if ( be!=NULL ) {
- islocal=!(slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA));
- } else {
- islocal = be != defbackend_get_backend();
- }
-
+ slapi_pblock_get (pb, SLAPI_REQUESTOR_ISROOT, &isroot);
}
else
{
bindop = PR_FALSE;
- islocal = PR_TRUE;
isroot = 1;
}
+ slapi_pblock_get (pb, SLAPI_BACKEND, &be);
+
+ /* determine whether data are local or remote */
+ /* remote if chaining backend or default backend */
+
+ if ( be!=NULL ) {
+ islocal=!(slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA));
+ } else {
+ islocal = be != defbackend_get_backend();
+ }
+
if (bindop)
{
ptd = &(config->plgc_bind_subtrees);