Skip to content

Commit

Permalink
Issue 4093 - fix compiler warnings and update doxygen
Browse files Browse the repository at this point in the history
Description:  Update the doxy file (doxygen), fix compiler warnings
              (x86_64, arm, and s390x), and update Rust cargo file.

relates: 389ds#4093

Reviewed by: firstyear, spichugi, & progier(Thanks!!!)
  • Loading branch information
mreynolds389 committed Jan 27, 2021
1 parent 08c83d3 commit ae87e6c
Show file tree
Hide file tree
Showing 73 changed files with 862 additions and 850 deletions.
391 changes: 289 additions & 102 deletions docs/slapi.doxy.in

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions ldap/servers/plugins/acctpolicy/acct_util.c
Expand Up @@ -16,6 +16,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Contributors:
Hewlett-Packard Development Company, L.P.
Copyright (C) 2021 Red Hat, Inc.
******************************************************************************/

#include <stdio.h>
Expand All @@ -27,7 +29,7 @@ Hewlett-Packard Development Company, L.P.
#include "slapi-plugin.h"

/* Globals */
static void *plugin_id = NULL;
static void *global_plugin_id = NULL;
/* attributes that no clients are allowed to add or modify */
static char *protected_attrs_login_recording[] = {"createTimestamp",
NULL};
Expand Down Expand Up @@ -180,7 +182,7 @@ free_acctpolicy(acctPolicy **policy)
void
set_identity(void *identity)
{
plugin_id = identity;
global_plugin_id = identity;
}

/*
Expand All @@ -189,7 +191,7 @@ set_identity(void *identity)
void *
get_identity()
{
return (plugin_id);
return (global_plugin_id);
}

/*
Expand Down
30 changes: 17 additions & 13 deletions ldap/servers/plugins/acl/acl.c
@@ -1,6 +1,6 @@
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2021 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
Expand Down Expand Up @@ -1655,16 +1655,19 @@ acl_modified(Slapi_PBlock *pb, int optype, Slapi_DN *e_sdn, void *change)
group_change = 1;
if (optype == SLAPI_OPERATION_MODIFY) {
Slapi_Attr *a = NULL;
int rv;
rv = slapi_entry_attr_find(e, "uniqueMember", &a);
if (rv != 0)
int rc;
rc = slapi_entry_attr_find(e, "uniqueMember", &a);
if (rc != 0) {
break;
rv = slapi_entry_attr_find(e, "Member", &a);
if (rv != 0)
}
rc = slapi_entry_attr_find(e, "Member", &a);
if (rc != 0) {
break;
rv = slapi_entry_attr_find(e, "MemberURL", &a);
if (rv != 0)
}
rc = slapi_entry_attr_find(e, "MemberURL", &a);
if (rc != 0) {
break;
}
/* That means we are not changing the member
** list, so it's okay to let go this
** change
Expand Down Expand Up @@ -2455,7 +2458,7 @@ acl__resource_match_aci(Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *a
{
Targetattrfilter **attrFilterArray = NULL;
Targetattrfilter *attrFilter = NULL;
Slapi_Attr *attr_ptr = NULL;
Slapi_Attr *target_attr_ptr = NULL;
Slapi_Value *sval;
const struct berval *attrVal;
int k;
Expand All @@ -2481,9 +2484,10 @@ acl__resource_match_aci(Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *a
* If this filter applies to an attribute in the entry,
* apply it to the entry.
* Otherwise just ignore it.
*
*/
if (slapi_entry_attr_find(aclpb->aclpb_curr_entry, attrFilter->attr_str, &attr_ptr) == 0) {
if (slapi_entry_attr_find(aclpb->aclpb_curr_entry,
attrFilter->attr_str,
&target_attr_ptr) == 0) {
/*
* This is an applicable filter.
* The filter is to be applied to the entry being added or deleted.
Expand All @@ -2493,7 +2497,7 @@ acl__resource_match_aci(Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *a
*/
sval = NULL;
attrVal = NULL;
k = slapi_attr_first_value(attr_ptr, &sval);
k = slapi_attr_first_value(target_attr_ptr, &sval);
done = 0;
while (k != -1 && !done) {
attrVal = slapi_value_get_berval(sval);
Expand All @@ -2509,7 +2513,7 @@ acl__resource_match_aci(Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *a
slapi_entry_free(aclpb->aclpb_filter_test_entry);
}

k = slapi_attr_next_value(attr_ptr, k, &sval);
k = slapi_attr_next_value(target_attr_ptr, k, &sval);
} /* while */

/*
Expand Down
23 changes: 11 additions & 12 deletions ldap/servers/plugins/acl/acllas.c
@@ -1,6 +1,6 @@
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2021 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
Expand Down Expand Up @@ -1516,14 +1516,14 @@ DS_LASLdapUrlAttrEval(NSErr_t *errp __attribute__((unused)), char *attr_name __a
if (levels[i] == 0) { /* parent[0] or the target itself */
Slapi_Value *sval = NULL;
const struct berval *attrVal;
Slapi_Attr *attrs;
int i;
Slapi_Attr *target_attrs;
int ii = 0;

/* Get the attr from the resouce entry */
if (0 == slapi_entry_attr_find(lasinfo.resourceEntry,
attrName, &attrs)) {
i = slapi_attr_first_value(attrs, &sval);
if (i == -1) {
attrName, &target_attrs)) {
ii = slapi_attr_first_value(target_attrs, &sval);
if (ii == -1) {
/* Attr val not there
* so it's value cannot equal other one */
matched = ACL_FALSE;
Expand All @@ -1541,7 +1541,7 @@ DS_LASLdapUrlAttrEval(NSErr_t *errp __attribute__((unused)), char *attr_name __a
lasinfo.clientDn,
attrVal->bv_val);
if (matched != ACL_TRUE)
i = slapi_attr_next_value(attrs, i, &sval);
ii = slapi_attr_next_value(target_attrs, ii, &sval);
if (matched == ACL_DONT_KNOW) {
got_undefined = 1;
}
Expand Down Expand Up @@ -1956,7 +1956,7 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb,

char *attrs[5];
char *currDN;
int i, j;
int i;
int result = ACL_FALSE;
struct eval_info info = {0};
int nesting_level;
Expand Down Expand Up @@ -2147,7 +2147,6 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb,
*/
while (1) {
int evalNext = 0;
int j;
if (info.c_idx > info.lu_idx) {
/* That means we have crossed the limit. We
** may end of in this situation if we
Expand All @@ -2162,7 +2161,7 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb,
if ((NULL == groupMember) || ((currDN = groupMember->member) != NULL))
break;

for (j = 0; j < info.c_idx; j++) {
for (size_t j = 0; j < info.c_idx; j++) {
groupMember = info.memberInfo[j];
if (groupMember->member &&
(slapi_utf8casecmp((ACLUCHP)currDN, (ACLUCHP)groupMember->member) == 0)) {
Expand Down Expand Up @@ -2225,7 +2224,7 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb,
int already_cached = 0;

parentGroup = (groupMember->parentId < 0) ? NULL : info.memberInfo[groupMember->parentId];
for (j = 0; j < u_group->aclug_numof_member_group; j++) {
for (size_t j = 0; j < u_group->aclug_numof_member_group; j++) {
if (slapi_utf8casecmp((ACLUCHP)groupMember->member,
(ACLUCHP)u_group->aclug_member_groups[j]) == 0) {
already_cached = 1;
Expand Down Expand Up @@ -2270,7 +2269,7 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb,
int already_cached = 0;

parentGroup = (groupMember->parentId < 0) ? NULL : info.memberInfo[groupMember->parentId];
for (j = 0; j < u_group->aclug_numof_notmember_group; j++) {
for (size_t j = 0; j < u_group->aclug_numof_notmember_group; j++) {
if (slapi_utf8casecmp((ACLUCHP)groupMember->member,
(ACLUCHP)u_group->aclug_notmember_groups[j]) == 0) {
already_cached = 1;
Expand Down
33 changes: 16 additions & 17 deletions ldap/servers/plugins/acl/aclparse.c
@@ -1,6 +1,6 @@
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2021 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
Expand Down Expand Up @@ -267,7 +267,7 @@ __aclp__parse_aci(char *str, aci_t *aci_item, char **errbuf)

if ((s = strstr(str, "!=")) != NULL) {
type |= ACI_TARGET_ATTR_NOT;
strncpy(s, single_space, 1);
memcpy(s, single_space, 1);
}
/* Get individual components of the targetattr.
* (targetattr = "cn || u* || phone ||tel:add:(tel=1234)
Expand Down Expand Up @@ -365,7 +365,7 @@ __aclp__parse_aci(char *str, aci_t *aci_item, char **errbuf)
}
if ((s = strstr(str, "!=")) != NULL) {
type |= ACI_TARGET_NOT;
strncpy(s, single_space, 1);
memcpy(s, single_space, 1);
}
if ((s = strchr(str, '=')) != NULL) {
s++;
Expand Down Expand Up @@ -433,7 +433,7 @@ __aclp__parse_aci(char *str, aci_t *aci_item, char **errbuf)
}
if ((s = strstr(str, "!=")) != NULL) {
type |= ACI_TARGET_NOT;
strncpy(s, single_space, 1);
memcpy(s, single_space, 1);
}
if ((s = strchr(str, '=')) != NULL) {
s++;
Expand Down Expand Up @@ -602,17 +602,16 @@ __aclp__parse_aci(char *str, aci_t *aci_item, char **errbuf)
* things are missing.
*
* Input:
* char *str - String containg the acl text
* int *err - error status
* char *str - String containing the acl text
* int *err - error status
*
* Returns:
* 0 --- good status
* <0 --- error
* <0 --- error
*
* Error Handling:
* None.
*
*
**************************************************************************/
static int
__aclp__sanity_check_acltxt(aci_t *aci_item, char *str)
Expand All @@ -630,8 +629,8 @@ __aclp__sanity_check_acltxt(aci_t *aci_item, char *str)
newstr = str;

while ((s = strstr(newstr, "authenticate")) != NULL) {
char *next;
next = s + 12;
char *next_str;
next_str = s + 12;
s--;
while (s > str && ldap_utf8isspace(s))
LDAP_UTF8DEC(s);
Expand All @@ -640,7 +639,7 @@ __aclp__sanity_check_acltxt(aci_t *aci_item, char *str)
return ACL_INVALID_AUTHORIZATION;

} else {
newstr = next;
newstr = next_str;
}
}

Expand Down Expand Up @@ -1603,7 +1602,7 @@ __aclp__init_targetattr(aci_t *aci, char *attr_val, char **errbuf)
}

while (str != 0 && *str != 0) {
int lenstr = 0;
int len_str = 0;

__acl_strip_leading_space(&str);

Expand All @@ -1630,9 +1629,9 @@ __aclp__init_targetattr(aci_t *aci, char *attr_val, char **errbuf)
*/
attr = (Targetattr *)slapi_ch_calloc(1, sizeof(Targetattr));
/* strip double quotes */
lenstr = strlen(str);
if (*str == '"' && *(str + lenstr - 1) == '"') {
*(str + lenstr - 1) = '\0';
len_str = strlen(str);
if (*str == '"' && *(str + len_str - 1) == '"') {
*(str + len_str - 1) = '\0';
str++;
}
if (strchr(str, '*')) {
Expand All @@ -1643,8 +1642,8 @@ __aclp__init_targetattr(aci_t *aci, char *attr_val, char **errbuf)
char *newline = NULL;
struct slapi_filter *f = NULL;

if (lenstr > 92) { /* 100 - 8 for "(attr=%s)\0" */
newline = slapi_ch_malloc(lenstr + 8);
if (len_str > 92) { /* 100 - 8 for "(attr=%s)\0" */
newline = slapi_ch_malloc(len_str + 8);
lineptr = newline;
}

Expand Down
17 changes: 8 additions & 9 deletions ldap/servers/plugins/acl/aclutil.c
@@ -1,6 +1,6 @@
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2021 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
Expand Down Expand Up @@ -688,7 +688,6 @@ acl_dn_component_match(const char *ndn __attribute__((unused)), char *match_this
char *
acl_match_macro_in_target(const char *ndn, char *match_this, char *macro_ptr)
{

char *macro_prefix = NULL;
int macro_prefix_len = 0;
char *macro_suffix = NULL;
Expand Down Expand Up @@ -780,21 +779,21 @@ acl_match_macro_in_target(const char *ndn, char *match_this, char *macro_ptr)
/*
* ($dn) matches ndn[0..ndn_len-macro_suffix_len]
*/
int matched_val_len = 0;
int val_len = 0;

matched_val_len = ndn_len - macro_suffix_len;
val_len = ndn_len - macro_suffix_len;

matched_val = (char *)slapi_ch_malloc(matched_val_len + 1);
matched_val = (char *)slapi_ch_malloc(val_len + 1);
strncpy(matched_val, ndn, ndn_len - macro_suffix_len);
/*
* Null terminate matched_val, removing trailing "," if there is
* one.
*/
if (matched_val_len > 1) {
if (matched_val[matched_val_len - 1] == ',') {
matched_val[matched_val_len - 1] = '\0';
if (val_len > 1) {
if (matched_val[val_len - 1] == ',') {
matched_val[val_len - 1] = '\0';
} else {
matched_val[matched_val_len] = '\0';
matched_val[val_len] = '\0';
}
}
ret_val = matched_val;
Expand Down
6 changes: 2 additions & 4 deletions ldap/servers/plugins/chainingdb/cb_controls.c
@@ -1,6 +1,6 @@
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2021 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
Expand Down Expand Up @@ -116,7 +116,6 @@ cb_update_controls(Slapi_PBlock *pb,

int cCount = 0;
int dCount = 0;
int i;
char *proxyDN = NULL;
LDAPControl **reqControls = NULL;
LDAPControl **ctrls = NULL;
Expand All @@ -129,6 +128,7 @@ cb_update_controls(Slapi_PBlock *pb,
int addauth = (ctrl_flags & CB_UPDATE_CONTROLS_ADDAUTH);
int isabandon = (ctrl_flags & CB_UPDATE_CONTROLS_ISABANDON);
int op_type = 0;
size_t i;

*controls = NULL;
slapi_pblock_get(pb, SLAPI_OPERATION_TYPE, &op_type);
Expand Down Expand Up @@ -216,8 +216,6 @@ cb_update_controls(Slapi_PBlock *pb,
/* Add to the control list later */

} else {

int i;
for (i = 0; cbb->config.forward_ctrls != NULL && cbb->config.forward_ctrls[i] != NULL; ++i) {
if (strcmp(cbb->config.forward_ctrls[i], reqControls[cCount]->ldctl_oid) == 0) {
break;
Expand Down

0 comments on commit ae87e6c

Please sign in to comment.