summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/acl/acllas.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2008-12-05 22:41:53 +0000
committerRich Megginson <rmeggins@redhat.com>2008-12-05 22:41:53 +0000
commit0253cf3cca45f65caaeabfe886a41da5de916bdc (patch)
treefaab17e1bf51b7ff1b147c6c648bbb6075b2a359 /ldap/servers/plugins/acl/acllas.c
parent458a42a89182a23408e0db6482c59736936410d4 (diff)
downloadds-0253cf3cca45f65caaeabfe886a41da5de916bdc.tar.gz
ds-0253cf3cca45f65caaeabfe886a41da5de916bdc.tar.xz
ds-0253cf3cca45f65caaeabfe886a41da5de916bdc.zip
Resolves: bug 454030
Bug Description: Need to address 64-bit compiler warnings - again Reviewed by: nhosoi (Thanks!) Fix Description: This patch cleans up most of the other remaining compiler warnings. I compiled the directory server code with these flags on RHEL5 x86_64: -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic I also enabled argument/format match checking for most of the commonly used varadic functions. Most of the problems I found fell into these categories: 1) Too many or not enough arguments e.g. most everything that uses or did use LDAPDebug had extra 0,0 arguments. If they had been switched to use slapi_log_error, I removed the extra arguments - for those places still using LDAPDebug, I introduced more macros to handle the number of arguments, since C macros cannot be varadic. 2) When using NSPR formatting functions, we have to use %llu or %lld for 64-bit values, even on 64-bit systems. However, for regular system formatting functions, we have to use %ld or %lu. I introduced two new macros NSPRIu64 and NSPRI64 to handle cases where we are passing explicit 64-bit values to NSPR formatting functions, so that we can use the regular PRIu64 and PRI64 macros for regular system formatting functions. I also made sure we used NSPRI* only with NSPR functions, and used PRI* only with system functions. 3) use %lu for size_t and %ld for time_t I did find a few "real" errors, places that the code was doing something definitely not right: https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/acl/aclinit.c_sec4 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/acl/acllas.c_sec17 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/http/http_impl.c_sec1 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/memberof/memberof.c_sec1 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/pam_passthru/pam_ptimpl.c_sec1 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/replication/cl5_api.c_sec5 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/replication/cl5_clcache.c_sec2 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/plugins/replication/replutil.c_sec1 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/slapd/libglobs.c_sec1 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/slapd/back-ldbm/dbverify.c_sec2 https://bugzilla.redhat.com/attachment.cgi?id=325774&action=diff#ldapserver/ldap/servers/slapd/back-ldbm/ldif2ldbm.c_sec3 This is why it's important to use this compiler checking, and why it's important to fix compiler warnings, if for no other reason than the sheer noise from so many warnings can mask real errors. Platforms tested: RHEL5 Flag Day: no Doc impact: no
Diffstat (limited to 'ldap/servers/plugins/acl/acllas.c')
-rw-r--r--ldap/servers/plugins/acl/acllas.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index d63b7885..ce342a92 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -293,7 +293,7 @@ DS_LASIpGetter(NSErr_t *errp, PList_t subject, PList_t resource, PList_t
if ( rv != LAS_EVAL_TRUE || ( NULL == aclpb )) {
acl_print_acllib_err(errp, NULL);
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "DS_LASIpGetter:Unable to get the ACLPB(%d)\n", rv,0,0);
+ "DS_LASIpGetter:Unable to get the ACLPB(%d)\n", rv);
return LAS_EVAL_FAIL;
}
@@ -346,7 +346,7 @@ DS_LASDnsGetter(NSErr_t *errp, PList_t subject, PList_t resource, PList_t
if ( rv != LAS_EVAL_TRUE || ( NULL == aclpb )) {
acl_print_acllib_err(errp, NULL);
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "DS_LASDnsGetter:Unable to get the ACLPB(%d)\n", rv,0,0);
+ "DS_LASDnsGetter:Unable to get the ACLPB(%d)\n", rv);
return LAS_EVAL_FAIL;
}
@@ -424,7 +424,7 @@ DS_LASUserEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
PList_t global_auth)
{
slapi_log_error(SLAPI_LOG_FATAL, plugin_name,
- "User LAS is not supported in the ACL\n",0,0,0);
+ "User LAS is not supported in the ACL\n");
return LAS_EVAL_INVALID;
}
@@ -436,7 +436,7 @@ DS_LASGroupEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
PList_t global_auth)
{
slapi_log_error(SLAPI_LOG_FATAL, plugin_name,
- "Group LAS is not supported in the ACL\n",0,0,0);
+ "Group LAS is not supported in the ACL\n");
return LAS_EVAL_INVALID;
}
@@ -542,7 +542,7 @@ DS_LASUserDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
char ebuf[ BUFSIZ ];
slapi_log_error(SLAPI_LOG_FATAL, plugin_name,
"DS_LASUserDnEval:Syntax error(%s)\n",
- escape_string_with_punctuation( user, ebuf ), 0,0);
+ escape_string_with_punctuation( user, ebuf ));
return LAS_EVAL_FAIL;
}
@@ -671,7 +671,7 @@ DS_LASUserDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
if (rc == ACL_ERR) {
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
"DS_LASUserDnEval:Error in matching patteren(%s)\n",
- user,0,0);
+ user);
}
slapi_filter_free(f,1);
} else {
@@ -793,7 +793,7 @@ DS_LASGroupDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
char ebuf[ BUFSIZ ];
slapi_log_error(SLAPI_LOG_FATAL, plugin_name,
"DS_LASGroupDnEval:Syntax error(%s)\n",
- escape_string_with_punctuation( groupName, ebuf ),0,0);
+ escape_string_with_punctuation( groupName, ebuf ));
}
/* Now we have the starting point of the "groupdn" */
@@ -1013,7 +1013,7 @@ DS_LASRoleDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
char ebuf[ BUFSIZ ];
slapi_log_error(SLAPI_LOG_FATAL, plugin_name,
"DS_LASRoleDnEval:Syntax error(%s)\n",
- escape_string_with_punctuation( role, ebuf ),0,0);
+ escape_string_with_punctuation( role, ebuf ));
}
/* Now we have the starting point of the "roledn" */
@@ -1244,7 +1244,7 @@ DS_LASUserDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
return LAS_EVAL_FAIL;
}
- slapi_log_error( SLAPI_LOG_ACL, plugin_name,"Attr:%s\n" , attrName, 0,0);
+ slapi_log_error( SLAPI_LOG_ACL, plugin_name,"Attr:%s\n" , attrName);
matched = ACL_FALSE;
for (i=0; i < numOflevels; i++) {
if ( levels[i] == 0 ) {
@@ -1602,7 +1602,7 @@ acllas__user_ismember_of_group( struct acl_pblock *aclpb,
*/
if ( (u_group = aclg_get_usersGroup ( aclpb , clientDN )) == NULL) {
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "Failed to find/allocate a usergroup--aborting evaluation\n", 0, 0);
+ "Failed to find/allocate a usergroup--aborting evaluation\n");
return(ACL_DONT_KNOW);
}
@@ -1748,7 +1748,7 @@ eval_another_member:
if ((nesting_level > max_nestlevel)) {
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
"GroupEval:Member not found within the allowed nesting level (Allowed:%d Looked at:%d)\n",
- max_nestlevel, nesting_level, 0);
+ max_nestlevel, nesting_level);
result = ACL_DONT_KNOW; /* don't try to cache info based on this result */
goto free_and_return;
@@ -1759,7 +1759,7 @@ eval_another_member:
max_memberlimit != -1 ) {
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
"GroupEval:Looked at too many entries:(%d, %d)\n",
- info.c_idx, info.lu_idx,0);
+ info.c_idx, info.lu_idx);
result = ACL_DONT_KNOW; /* don't try to cache info based on this result */
goto free_and_return;
}
@@ -2203,7 +2203,7 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
LDAP_UTF8DEC(ptr);
}
- slapi_log_error( SLAPI_LOG_ACL, plugin_name,"Attr:%s\n" , attrName, 0,0);
+ slapi_log_error( SLAPI_LOG_ACL, plugin_name,"Attr:%s\n" , attrName);
/* See if we have a parent[2].attr" rule */
if ( (ptr = strstr(attrName, "parent[")) != NULL) {
@@ -2229,7 +2229,7 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
*/
slapi_log_error( SLAPI_LOG_FATAL, plugin_name,
"DS_LASGroupDnattr: Exceeded the ATTR LIMIT:%d: Ignoring extra levels\n",
- ACLLAS_MAX_LEVELS,0,0);
+ ACLLAS_MAX_LEVELS);
}
} else {
/* Must be the attr name. We can goof of by
@@ -2445,7 +2445,7 @@ acllas__eval_memberGroupDnAttr (char *attrName, Slapi_Entry *e,
if ( (u_group = aclg_get_usersGroup ( aclpb , n_clientdn )) == NULL) {
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "Failed to find/allocate a usergroup--aborting evaluation\n", 0, 0);
+ "Failed to find/allocate a usergroup--aborting evaluation\n");
slapi_ch_free ( (void **)&s_str );
return(ACL_DONT_KNOW);
}
@@ -2544,7 +2544,7 @@ acllas__eval_memberGroupDnAttr (char *attrName, Slapi_Entry *e,
if (tt == info.lu_idx) {
slapi_log_error( SLAPI_LOG_ACL, plugin_name, "currDn:(%s) \n\tNO MEMBER ADDED\n",
- ACL_ESCAPE_STRING_WITH_PUNCTUATION (curMemberDn, ebuf) , 0,0);
+ ACL_ESCAPE_STRING_WITH_PUNCTUATION (curMemberDn, ebuf));
} else {
for (i=tt; i < info.lu_idx; i++)
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
@@ -2597,7 +2597,7 @@ acllas__eval_memberGroupDnAttr (char *attrName, Slapi_Entry *e,
for (j=0; j < u_group->aclug_numof_member_group; j++)
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
"acllas__eval_memberGroupDnAttr:GROUP[%d] IN CACHE:%s\n",
- j, ACL_ESCAPE_STRING_WITH_PUNCTUATION (u_group->aclug_member_groups[j], ebuf),0);
+ j, ACL_ESCAPE_STRING_WITH_PUNCTUATION (u_group->aclug_member_groups[j], ebuf));
matched = ACL_FALSE;
slapi_entry_attr_find( e, groupattr, &attr);
@@ -3060,7 +3060,7 @@ acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url
if ( NULL == aclpb->aclpb_client_entry ) {
slapi_log_error ( SLAPI_LOG_ACL, plugin_name,
- "DS_LASUserAttrEval: Unable to get client's entry\n",0,0,0);
+ "DS_LASUserAttrEval: Unable to get client's entry\n");
return ACL_FALSE;
}
@@ -3224,7 +3224,7 @@ __acllas_setup ( NSErr_t *errp, char *attr_name, CmpOp_t comparator,
(void **)&linfo->authType, NULL)) < 0) {
acl_print_acllib_err(errp, NULL);
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "%s:Unable to get the auth type(%d)\n", rc);
+ "%s:Unable to get the auth type(%d)\n", lasName, rc);
return LAS_EVAL_FAIL;
}
return 0;
@@ -3273,7 +3273,7 @@ static int acllas__user_has_role( struct acl_pblock *aclpb,
if ( NULL == aclpb->aclpb_client_entry ) {
slapi_log_error ( SLAPI_LOG_ACL, plugin_name,
- "acllas__user_has_role: Unable to get client's entry\n",0,0,0);
+ "acllas__user_has_role: Unable to get client's entry\n");
return ACL_FALSE;
}