From 927b0efb4291e1d514c1bab4fb20ec8bdf8eab10 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Oct 25 2012 17:13:08 +0000 Subject: 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. . replaced an obsolete api escape_filter_value with slapi_escape_ filter_value. . eliminated an unused variable uid_dn_value. 2) posix-group-task.c . replaced an obsolete api escape_filter_value with slapi_escape_ filter_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..0e373da 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; @@ -298,10 +300,10 @@ posix_winsync_foreach_parent(Slapi_Entry *entry, char **attrs, plugin_search_ent char *cookie = NULL; Slapi_Backend *be = NULL; - const char *value = slapi_entry_get_ndn(entry); + char *value = slapi_entry_get_ndn(entry); size_t vallen = value ? strlen(value) : 0; - char *filter_escaped_value = slapi_ch_calloc(sizeof(char), vallen*3+1); - char *filter = slapi_ch_smprintf("(uniqueMember=%s)", escape_filter_value(value, vallen, filter_escaped_value)); + char *filter_escaped_value = slapi_escape_filter_value(value, vallen); + char *filter = slapi_ch_smprintf("(uniqueMember=%s)", filter_escaped_value); slapi_ch_free_string(&filter_escaped_value); Slapi_PBlock *search_pb = slapi_pblock_new(); @@ -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..8d9d8ac 100644 --- a/ldap/servers/plugins/posix-winsync/posix-group-task.c +++ b/ldap/servers/plugins/posix-winsync/posix-group-task.c @@ -271,15 +271,15 @@ posix_group_fix_memberuid_callback(Slapi_Entry *e, void *callback_data) int i; for (i = slapi_attr_first_value(muid_attr, &v); i != -1; i = slapi_attr_next_value(muid_attr, i, &v)) { - const char *muid = slapi_value_get_string(v); + char *muid = (char *)slapi_value_get_string(v); slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "_fix_memberuid iterating memberuid: %s\n", muid); size_t vallen = muid ? strlen(muid) : 0; - char *filter_escaped_value = slapi_ch_calloc(sizeof(char), vallen*3+1); - char *filter = slapi_ch_smprintf("(uid=%s)", escape_filter_value(muid, vallen, filter_escaped_value)); + char *filter_escaped_value = slapi_escape_filter_value(muid, vallen); + char *filter = slapi_ch_smprintf("(uid=%s)", filter_escaped_value); slapi_ch_free_string(&filter_escaped_value); Slapi_Entry **search_entries = NULL;