ldap/servers/plugins/posix-winsync/posix-group-func.c | 17 ++++++++++-------
ldap/servers/plugins/posix-winsync/posix-group-func.h | 2 ++
ldap/servers/plugins/posix-winsync/posix-group-task.c | 5 +++--
3 files changed, 15 insertions(+), 9 deletions(-)
New commits:
commit 56ebbb20fa9f8d1add75075fdf421f53ed5348f1
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Wed Oct 24 16:13:32 2012 -0700
Fixing compiler warnings in the posix-winsync plugin
The commit b9eeb2e1a8e688dfec753e8965d0e5aeb119e638 for Ticket #481
"expand nested posix groups" introduced these compiler warnings.
1) posix-grou-func.c
. added missing format strings "%s" in searchUid.
. added a function declaration hasObjectClass.
. eliminated an unused variable uid_dn_value.
2) posix-group-task.c
. included "slapi-private.h" for filter_escaped_value.
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-func.c
b/ldap/servers/plugins/posix-winsync/posix-group-func.c
index be3a6ec..9ad636f 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-func.c
+++ b/ldap/servers/plugins/posix-winsync/posix-group-func.c
@@ -28,6 +28,8 @@
Slapi_Value **
valueset_get_valuearray(const Slapi_ValueSet *vs); /* stolen from proto-slap.h */
+static int hasObjectClass(Slapi_Entry *entry, const char *objectClass);
+
static PRMonitor *memberuid_operation_lock = 0;
void
@@ -133,13 +135,13 @@ searchUid(const char *udn)
}
slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
- "searchUid: About to free entry\n", udn);
+ "searchUid: About to free entry (%s)\n", udn);
slapi_entry_free(entry);
}
slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
- "searchUid: <==\n", udn);
+ "searchUid(%s): <==\n", udn);
return uid;
}
@@ -260,7 +262,7 @@ smods_has_mod(Slapi_Mods *smods, int modtype, const char *type, const
char *val)
return rc;
}
-int
+static int
hasObjectClass(Slapi_Entry *entry, const char *objectClass)
{
int rc = 0;
@@ -704,7 +706,6 @@ modGroupMembership(Slapi_Entry *entry, Slapi_Mods *smods, int
*do_modify)
if (smod_deluids == NULL) { /* deletion of the last value, deletes the
Attribut from entry complete, this operation has no value, so we must look by self */
Slapi_Attr * um_attr = NULL; /* Entry attributes */
- Slapi_Value * uid_dn_value = NULL; /* Attribute values */
int rc = slapi_entry_attr_find(entry, "uniquemember",
&um_attr);
if (rc != 0 || um_attr == NULL) {
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-func.h
b/ldap/servers/plugins/posix-winsync/posix-group-func.h
index 9452022..0f0ae37 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-func.h
+++ b/ldap/servers/plugins/posix-winsync/posix-group-func.h
@@ -17,5 +17,7 @@ char * searchUid(const char *udn);
void memberUidLock();
void memberUidUnlock();
int memberUidLockInit();
+int addUserToGroupMembership(Slapi_Entry *entry);
+void propogateDeletionsUpward(Slapi_Entry *, const Slapi_DN *, Slapi_ValueSet*,
Slapi_ValueSet *, int);
#endif
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-task.c
b/ldap/servers/plugins/posix-winsync/posix-group-task.c
index e5385b0..92ac342 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-task.c
+++ b/ldap/servers/plugins/posix-winsync/posix-group-task.c
@@ -1,4 +1,5 @@
#include "slapi-plugin.h"
+#include "slapi-private.h"
#include "nspr.h"
#include "posix-wsp-ident.h"
commit a57d9131f9d0ae7a5d9865dd6be7f37f26de376c
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Wed Oct 24 15:27:48 2012 -0700
Coverity defects
The commit b9eeb2e1a8e688dfec753e8965d0e5aeb119e638 for Ticket #481
"expand nested posix groups" introduced 4 coverity defects.
Description:
13100, 13101: Missing return statement
Fix description: addUserToGroupMembership and propogateDeletion-
UpwardCallback are declared to return an integer value, but
nothing was returned. This patch changes it to return 0.
13102: Resource leak
Fix description: The memory of valueset muid_old_vs is internally
allocated. It was meant to be set to muid_upward_vs and freed
together when muid_upward_vs is freed. But due to the function
calling order, it was not properly set and it lost the chance to
be freed. This patch calls slapi_attr_get_valueset prior to
slapi_valueset_set_valueset and let free muid_old_vs together
with slapi_valueset_set_valueset.
13103: Uninitialized pointer read
Fix description: Possibly uninitialized variable was passed to
a logging function slapi_log_error, but actually it was not
referred. With this patch, the variable filter is no longer to
passed to the function.
(cherry picked from commit e9941a2915ac848abe9a4afe802d0432aa0c354a)
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-func.c
b/ldap/servers/plugins/posix-winsync/posix-group-func.c
index 66b9272..be3a6ec 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-func.c
+++ b/ldap/servers/plugins/posix-winsync/posix-group-func.c
@@ -473,15 +473,15 @@ propogateMembershipUpward(Slapi_Entry *entry, Slapi_ValueSet
*muid_vs, int depth
muid_here_vs = muid_vs;
}
else {
+ int i = 0;
+ Slapi_Value *v = NULL;
/* Eliminate duplicates */
muid_upward_vs = slapi_valueset_new();
muid_here_vs = slapi_valueset_new();
+ slapi_attr_get_valueset(muid_old_attr, &muid_old_vs);
slapi_valueset_set_valueset(muid_upward_vs, muid_old_vs);
- slapi_attr_get_valueset(muid_old_attr, &muid_old_vs);
- int i = 0;
- Slapi_Value *v = NULL;
for (i = slapi_valueset_first_value(muid_vs, &v); i != -1;
i = slapi_valueset_next_value(muid_vs, i, &v)) {
@@ -542,6 +542,7 @@ propogateDeletionsUpwardCallback(Slapi_Entry *entry, void
*callback_data)
{
struct propogateDeletionsUpwardArgs *args = (struct propogateDeletionsUpwardArgs
*)(callback_data);
propogateDeletionsUpward(entry, args->base_sdn, args->smod_deluids,
args->del_nested_vs, args->depth);
+ return 0;
}
void
@@ -920,6 +921,7 @@ addUserToGroupMembership(Slapi_Entry *entry)
propogateMembershipUpward(entry, muid_vs, 0);
slapi_valueset_free(muid_vs); muid_vs = NULL;
+ return 0;
}
int
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-task.c
b/ldap/servers/plugins/posix-winsync/posix-group-task.c
index 4555f1b..e5385b0 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-task.c
+++ b/ldap/servers/plugins/posix-winsync/posix-group-task.c
@@ -152,9 +152,9 @@ posix_group_task_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry
*eAfter, int
rv = SLAPI_DSE_CALLBACK_OK;
}
- out:
+out:
slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
- "posix_group_task_add: <==\n", filter);
+ "posix_group_task_add: <==\n");
return rv;
}